Classes, and being classy, using LV 7.1... how to make them?

Classes, and being classy, using LV 7.1... how to make them?

Post by IEC » Sat, 07 Oct 2006 01:40:07


Can someone refer me to some info about making classes and whatnot in lv7.1?
 
I have need to make a class which has the following data types associated with it;
1 ROI
~10-15 Float
2 Bool
1 or 2 string
 
then i'll need to be able to create such an object dynamically and tie it into a queue.
 
thanks,
 
jonathan
 
 
 

Classes, and being classy, using LV 7.1... how to make them?

Post by altenbac » Sat, 07 Oct 2006 01:40:11

To do full object oriented programming, you need LabVIEW 8.20. It is a new feature.
 
(For details, see the application note: <a href=" http://www.yqcomputer.com/ " target="_blank"> http://www.yqcomputer.com/ ;/a> )
 
 
Maybe all you need is a cluster of a DBL, two booleans, and two strings? Leave string 2 empty if only one string is needed.Message Edited by altenbach on 10-05-2006 09:33 AM

 
 
 

Classes, and being classy, using LV 7.1... how to make them?

Post by Anthony de » Sat, 07 Oct 2006 02:10:07

The easiest way is to upgrade to LV 8.2, and use the new built-in object system...:smileywink:
But it's not so difficult in LV7 either.
First, you must make a custom control.  i.e.  a .ctl file, with 'strict type def.'   That file defines your class data structure.  Place a cluster with all your data in the control.
Then, you make a 'create object vi'.   In that vi, you create a queue.  The queue elements are of the type of your custom control. The 'destroy object ' vi is simply a vi that destroys the queue.
The queue will hold the object data.  One queue for every object.  The vi's are the object methods.
At any time, the queue holds only one element.  Every method will read the element from the queue, perform any operation on it, and put it back into the queue.   If you don't put it back on the queue, you loose your object's data...
And that's basicly it...   
I would have attached a few example vi's for you...  if only LV 8.2 would have allowed to save for a version more previous than 8.0....   :smileymad:
 
 
 

Classes, and being classy, using LV 7.1... how to make them?

Post by tst » Sat, 07 Oct 2006 02:40:07


And there's also GOOP Developer from Sciware and JKI which also supports inheritance.
 
 
 

Classes, and being classy, using LV 7.1... how to make them?

Post by tst » Sat, 07 Oct 2006 22:40:07

You can create a VI dynamically by using VI scripting (check out the LAVA forums), but I'm not sure how that will help you as you will still need to write the code to perform the methods. If you mean creating instances by creating a new instance of an existing VI, then you could probably do this by using VI templates, but it would be slow, memory consumption would be big and I'm not sure that it would really be an object oriented approach since you would be duplicating the methods instead of duplicating the data.
Can you elaborate more on just what you had in mind?