LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Intaris

Give us some way of FORCING a specific LVOOP cast

Status: Completed

Available in LabVIEW 2009 and later. Use the 'Preserve Run-Time Class' function to achieve this functionality. 

This ties into a recent post I made on the NI Forum HERE.

 

I have already run into this problem a few times.

 

Somewhere in my code I have a process returning an object of a particular class which does not have the exact same type as a dynamic dispatch input.   My post above shows a workaround for this (which, if it wasn't so horrible it'd be funny).

 

Load class from XML workaround.PNG

 

I've run into similar problems where the object is being passed via Queue or Event where I have to pass the Objects as a parent class to enable portability but where I KNOW the only source of the data is a VI sending an object of EXACTLY THE SAME TYPE as the dynamic dispatch input.

 

A normal "to more specific class" does not work presumably because the resulting object COULD be a further sibling of the required object, thus breaking any dynamic dispatch tables.

 

Up to now I've had to write a class member to take the existing object and another object of type parent and make a cast and update the values manually which is really annoying because it requires each and every child class to implement this (and make use of the parent function).

 

So what I'd like is a function to allow an EXACT cast of an LVOOP object so that I can still satisfy the Dynamic Dispatch requirements without having to have a piece of code for each and every child class created.  If the Object classes don't match EXACTLY, return an error and the contents of the object used for the cast.

 

Shane.

14 Comments
Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 3 kudos within 3 years after posting will be automatically declined.

Intaris
Proven Zealot

Declined, but implemented.  OK.

AristosQueue (NI)
NI Employee (retired)

Hehehe. Good catch, Intaris.  Yes, this idea was completed, just not marked as such, in LV 2009. Here's the primitive:

Untitled.png

We'll update the status.

Darren
Proven Zealot
Status changed to: Completed

Available in LabVIEW 2009 and later. Use the 'Preserve Run-Time Class' function to achieve this functionality.