From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

GDS(Goop Development Suite)

cancel
Showing results for 
Search instead for 
Did you mean: 

Why DVR type cast to Number and reverse needed in object new.vi

Generally, i understand a GDS object use a data value reference  and a signle element queue to hold/transfer data.  but why DVR need to typecast to a U32 number  and  a U32 typecast to DVR is needed in every object new.vi?   i deleted the typecast part in attachment in a parent class and its child class,  and the test.vi runs OK.        I know that if communicating with other APP or OS, we have to typecast a ref to a number,like in Veristand, using a U64.  It seems pure LabVIEW  can just use DVR without the typecast part, why GOOP4 behaves like that?

0 Kudos
Message 1 of 4
(1,664 Views)

Hi,
Great question.
This is a trick to allow Composition.
Try to add the a lvclass control of the same class into it's ObjectAttribute Cluster.
You'll see some error like this:
The private data control defines the default value for a class. This private data control has values set as the defaults that are illegal. Illegal default values include: any value of this class itself, any value of any child class, any class that has not been loaded into memory, and any class that uses this class as a member in its own private data control. If you do not see the problem value immediately, you might check the default value of any variant controls in the private data to make sure their default values are not the problem.
Cheers,
Mike

Message 2 of 4
(1,608 Views)

Hello MikaelH, Thank you for the explanation.  i do a test as you said, and find that childclass can have parent class as private member without error, while when i try to let a class have its self class or its child class as private class. the compilation of type definition occurs. it seems LabVIEW compiler do a limitation to  the reource of DVR point to(for prventage of possible cyclic call/definition?).  but GOOP4 with type cast DVR  bypasses the limitation.  

0 Kudos
Message 3 of 4
(1,587 Views)

When people using by-value classes and need to do composition, they use the base LV class object in the attribute and then they type-cast it back every type they like to access it.

0 Kudos
Message 4 of 4
(1,576 Views)