LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Object and in place element structure

Solved!
Go to solution

Hi!

I need some help!

How can I do the following?

In the 1.)  Set the new value here - make some changes takes effect the whole array, previously and take effect for the 2. wire?

I have tried that in place element structure without any success.

The reason is why I would like to do this is : I wanna avoid the always usage of get - set pairs when I am working with objects, tipically array of objects.

so my goal is, how to see only 10 values in both arrays?

 

-----

My real problem is the following:

I have an array with objects. The order of the objects is very important, can not be changed. I use a stack - algorithm on the elements. Randomly push many elements into the stack, and randomly pop them. When I pop, I wanna use a set-method on the object, (set something flag/property) . So I want this chage to take effect the memory .

(If used a simle enable - indexing in the loop, I would lost the real order of the original array.)

(maybe I can calculate the index of the element what I want to update, but I think there is more easier alternative to do that and I should use the get - set again...)

21303i42317476B75EEB2C

 

 

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
0 Kudos
Message 1 of 4
(3,571 Views)
Solution
Accepted by topic author D60

The native LVOOP implementation is by-val and not by ref.as in most OOP implementations. If you are coming from an OOP background, think like: every time you branch a wire, it creates a clone of the object on the wire (or all the objects in the array in your case). As a general rule, this is the desired behaviour in about 80% of the cases (when using LabVIEW). So consider if you can't do it using a by-val implementation.

 

There are several falvours of by-ref implementation, where you will have the same objects on both wires:

* private data inside SEQ (single element queue, no replaced by the next one)

* private data inside DVR (data value reference)

* object inside DVR

 

which implementation you choose is up to you. From your image/code, I'd place the object inside the DVR. You could create the DVR with the obj in the first for loop. In the secend for loop, index your elements and use the IPE to get the obj out of the DVR for your get-set operation and place it back.

 

Felix

0 Kudos
Message 2 of 4
(3,559 Views)

Dear Felix!

 

 

Thank your for your fast reply!

 

 Could you help me that where can I find sample/ example codes for the following techniques?

 

* private data inside SEQ (single element queue, no replaced by the next one)

* private data inside DVR (data value reference)

* object inside DVR

 

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
0 Kudos
Message 3 of 4
(3,543 Views)

There is an OOP section in the examples that ship with LV.

 

Felix

0 Kudos
Message 4 of 4
(3,534 Views)