From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Object Oriented Implementation Question

So I've inherited a project that uses objects.  And I want to improve upon the design by introducing asynchronous loops.  But before I go about messing with this too much to implement, I was curious if objects work anything like Data Value References and FGVs.  If I update the object in any of the asynchronously running VIs, is it updated everywhere or only in that instance?

0 Kudos
Message 1 of 7
(980 Views)

The object itself is just an object, like a DBL or I32. However, an object can be implemented so that all of the data contained in the object is by reference (with a DVR, for example). So the answer to your question is maybe, but it depends on how the original developer set them up.

0 Kudos
Message 2 of 7
(953 Views)

LVOOP is By-Value.  You can use a DVR (of the class) to make it By-Reference, but this is generally not recommended.  I think there is an article floating around about this.  I'd have to do some digging to see if I can find it.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 7
(947 Views)

@johntrich1971 wrote:

The object itself is just an object, like a DBL or I32. However, an object can be implemented so that all of the data contained in the object is by reference (with a DVR, for example). So the answer to your question is maybe, but it depends on how the original developer set them up.


So the photo I'm showing is a simple "right-click create class" object.  So what do I do to this class so that it updates in all instances?

DailyDose_0-1651855823028.png

 

0 Kudos
Message 4 of 7
(939 Views)

No, objects are, by default, by-value. You can make them by-ref by using DVR's, single-element queues, etc. There's also the GOOP toolkit that automates some of that but I've never used it myself.

0 Kudos
Message 5 of 7
(911 Views)

@DailyDose wrote:

So the photo I'm showing is a simple "right-click create class" object.  So what do I do to this class so that it updates in all instances?

DailyDose_0-1651855823028.png


You pass around the DVR reference and use the In Place Element Structure to access the object.  The IPES will act as a mutex to keep multiple places from trying to access it at the same time.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(890 Views)

@DailyDose wrote:

@johntrich1971 wrote:

The object itself is just an object, like a DBL or I32. However, an object can be implemented so that all of the data contained in the object is by reference (with a DVR, for example). So the answer to your question is maybe, but it depends on how the original developer set them up.


So the photo I'm showing is a simple "right-click create class" object.  So what do I do to this class so that it updates in all instances?

DailyDose_0-1651855823028.png


wiebeCARYA_0-1652099818320.png

Turn this off, then you can put the class in a DVR.

 

I personally avoid DVRs (anything not by wire actually) at almost all costs.

 

They are hell to debug.

Message 7 of 7
(827 Views)