LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LVOOP reference

I have started with LVOOP recently and I am always learning. I understand that the LVOOP is influenced by the data flow concept of LV. In other languages such as Java I was used to implement e.g. a list or tree of objects by using references to next / previous object. I've read this is not possible in LVOOP. My question is:
How do the programmers cope with that ? How to implement e.g. a net of objects ?

0 Kudos
Message 1 of 3
(2,429 Views)

You can use references in LV just like in other languages. Since LV 2009, the easiest tool for this is the Data Value Reference. In the case of something like a linked list class, this would usually be a class where each node has as part of its data a DVR to the next node (and the previous one, if it's doubly linked) and the methods to search, add, delete, etc. Note that LV doesn't let a class have a static recursive link to itself, so the DVR would have to have the type of a parent class and you have to do the downcasting at run time to get the actual class.

 

I seem to also remember a by-value implementation of a linked list which Aristos Queue once posted to the LAVA forums (which basically used the swap values primitive to allow moving values in and out of the list without creating copies), but that was more of an experiment and I don't think it's worth it. I would suggest you search both the LAVA forums and the NI communities area for terms like "data structures" as there have been some discussions about this in the past, with some specific implementations as well.


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

Thank you.
The solution can be found here:

https://decibel.ni.com/content/docs/DOC-12668

0 Kudos
Message 3 of 3
(2,401 Views)