LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to store the member data of an object?

hi,
    how do i store the data member of an object in labview? I want the data to be available from a different vi as well. i'll cretae an object and would set some attributes to it. So when i call this object by its name from a different vi, i want the attributes that was set to the object to be displayed. how do i achieve this.
 
 
Regards
Jayaraman
0 Kudos
Message 1 of 6
(3,023 Views)
I'd put the data in a private vi, in a functional global vi. Then use 2 public vis to access and mutate the data.

_____________________________
- Cheers, Ed
0 Kudos
Message 2 of 6
(3,013 Views)
Hi Jayaraman,
about what objects do you speak?
Mike
0 Kudos
Message 3 of 6
(3,012 Views)
Now I'm back from lunch I shall elaborate

Brief bit of OO theory: You want to keep your member data private, it is easier to debug as there are limited ways to edit data and it is easier to enforce behaviour. So you need a public way to access the data

As I am sure you are aware, a useful part of non re-entrant VIs is that if they are called from multiple points at the same time, they must wait until the VI is availavble again, enforcing data protection and race conditions, etc... So if we use this as our member data storage

If you have multiple instances of an object, then you will need to implement a handler class which stores the children. e.g. you have a class called 'book' each 'book' object will store its own private member data. another class 'shelf' will store references to each book (usually in the form of an array) then you add to or remove from this array

Attached is a simple object class which should help. Pipe up if you're not sure on anything
_____________________________
- Cheers, Ed
0 Kudos
Message 4 of 6
(2,998 Views)
hi mike,
             im having a class wherein i have two vi's with some functionality. Now if i create an instance (object) of this class, i want to set some attributes to it and i would like to call these set attributes from a same and/or a different vi but my ultimte aim is that i should store it in some container from where i can use it if necessary. i don want this to be stored in a file. Cos once the vi stops running i don want this data to be available anymore. I hope u got my ques clearly now.
 
 
 
Regards
Jayaraman
0 Kudos
Message 5 of 6
(2,974 Views)
If the only thing you need is a container to store values, then, as I mentionned in your other post:
 
Do a search on "Action Engine" within this forum.  A sub-section of Action Engines is something called a "Functional Global Variable".
 
You can also do a search on that.  Functional Global Variables are VERY different from Globals or Shared Variables.  They are often used as a container to store values and allow to share among VI's.  It only retains the last value written to it (unless you modify the structure but I won't get into that). 
 
 
 
 
 
0 Kudos
Message 6 of 6
(2,937 Views)