LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pass object as reference

Hiw can i pass a LV object as a reference?
0 Kudos
Message 1 of 7
(2,628 Views)

What exactly do you mean?

You can create references as seen in the picture...

 



Remember Cunningham's Law
0 Kudos
Message 2 of 7
(2,624 Views)

Sorry i didn't have a proper question. I have a LV class - Thread. Which has a VI that runs ascyn. LV is baased on data flow, thus most things are pass by values. However i wanted to hold values for the Object created in the VI therefore it has to be pass by reference.

 

Whats the generic lass for LV object?

0 Kudos
Message 3 of 7
(2,605 Views)

You can use a global variable in that case. Check out the link below.

http://zone.ni.com/reference/en-XX/help/371361G-01/glang/global_variable/

 

Satish

0 Kudos
Message 4 of 7
(2,595 Views)
Well, global would solve the problem not i won't do it as it defeats the purpose of OO, having data encapsulated. Anyway thanks!
0 Kudos
Message 5 of 7
(2,593 Views)

You can still create references from objects. I was able to do it, in the usual way ( Right click object -> Create -> Reference).

 

Once you drop the class in block diagram, did you select right - click and  'Change to control' ?

 

Satish

0 Kudos
Message 6 of 7
(2,588 Views)

Search this site for "Singlton".

 

There are a couple of ways of achieving a Singlton in LV. Early versions used a single element queue to hold the data so that only the thread that has the lock on the queue can access it.

 

An updated version uses a DVR (Data Value Refence) to hold the instance of the class.

 

If you are developing an Active Object there is supposedly ( I have not read it yet) an Actor pattern recently included in LV.

 

I hope that helps,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 7
(2,571 Views)