LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

To More Specific Class & Plugin Architecture

Hello there,

 

I have a plugin architecture and I want to load a particular class on demand, when a user clicks a button etc.

I can do this using 'Get LV Class Default Value.vi' knowing the path of the .lvclass file, and I can then use the 'To More Specific Class' vi to cast it from type LV Object to the specific class I know it to be.

 

However if I have 30 different classes with this method I would have to have 30 different class constants in a case structure so I can cast to the right one.  This works but it means all the classes are loaded into memory when the program is run, even though the user may never want to use most of them, which is a waste of time/memory.

 

Is there a better way of doing this please?

 

Thanks,

 

Martin

0 Kudos
Message 1 of 3
(2,496 Views)

I wonder if minute 4:00 in Michael's video will help you. It avoids the constants, as long as all the classes are descendants of a common class:

http://vishots.com/005-visv-labview-class-factory-pattern/

0 Kudos
Message 2 of 3
(2,490 Views)

Thank you for the helpful link, it is working fine now. I had made a silly mistake.

0 Kudos
Message 3 of 3
(2,480 Views)