LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

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
0 Kudos
Message 1 of 7
(3,715 Views)
 
To do full object oriented programming, you need LabVIEW 8.20. It is a new feature.
 
 
 
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

Message 2 of 7
(3,705 Views)

As altenbach indicated, you may not need to go with classes for something like that. However, if you find yourself needing to use classes and are still running 7.1, you can try OpenGOOP or dqGOOP. I've used both, with a preference towards dqGOOP. OpenGOOP is available from OpenG.org, and dqGOOP is available from dataACT. You can also try the old GOOP Toolkit, or Endevo's toolkit.

 
Message 3 of 7
(3,696 Views)

The easiest way is to upgrade to LV 8.2, and use the new built-in object system...Smiley Wink

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....   Smiley Mad

Message 4 of 7
(3,692 Views)
 

 


@smercurio_fc wrote:
As altenbach indicated, you may not need to go with classes for something like that. However, if you find yourself needing to use classes and are still running 7.1, you can try OpenGOOP or dqGOOP. I've used both, with a preference towards dqGOOP. OpenGOOP is available from OpenG.org, and dqGOOP is available from dataACT. You can also try the old GOOP Toolkit, or Endevo's toolkit.
 


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


___________________
Try to take over the world!
Message 5 of 7
(3,682 Views)
Is there a way to create a VI dynamically?  I was thinking that I could create a class-like thing by just having a vi which will create and destroy other vis. 
0 Kudos
Message 6 of 7
(3,634 Views)

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?


___________________
Try to take over the world!
0 Kudos
Message 7 of 7
(3,624 Views)