09-04-2009 03:47 PM
Has any of the OOP programmers out there ever developed a generic object manager? What I mean by this is a an Object in LabVIEW that can hold references to all objects in an application that can be accessed generically through a name input and not via know each individual class type. I have been trying to create a class that essentially has as its attributes an array of LV Objects since all objects descend from this class. I am struggling with getting the specific class back from the generic class. If I probe the array it shows the class specific type.
So what I am trying to do is search an array of standard LabVIEW Objects for a specific LabVIEW type. Here I created an array of LabVIEW object by casting specific classes to the most generic class - LabVIEW Object. Then I want to search an array for a specific class by taking a specific class constant and casting it to a more generic class. It seems like it keeps the reference information (ID).
Any thoughts?
09-04-2009 06:18 PM
LV2009 added a function which is probably crucial to delivering a nice solution to this problem. The function is called Preserve Run-time Class. It allows you to propogate the strict type of an object through a subVI that is coded to operate on a more generic class type.
Here's an example written in LV2009 for a simple class that stores any other LV class object by name.