LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

destructive and non-destructive buffer reads on branch wires

I was asked this morning what are "Destructive and non-destructive buffer reads on branched wires" are.

I was at a loss at first and the I thought some and read a posting by Jim that inspried me.

My first thought was the case of an array wired to a replace array element and an index array function. I that case the the index has to execute before the replace array element because the replace re-uses its input buffer. Not really detructive but seemed close.

There is also the case of a buffer (like a string) being wired into a CIN and the same buffer being re-used be the CIN to return the result. The CIN "destroys" the original values.

Jim mentioned the concatenate string having to destroy the buffer
s hold the strings that are concantenated and moved to another buffer.

Also when I do a AI read the buffer I read from is destroyed after I read it. Similarly with reading from VISA and the like.

What does the above phrase really mean and are there other examples that I have missed?

Trying to learn something here,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 1 of 3
(2,713 Views)
That phrase may have been describing a combination of factors. Documentation from NI points out that if a wire branches, LabVIEW will try to avoid making a copy of the data, including scheduling (as in your example) read operations on branch A before write operations on branch B if possible. Since branch A doesn't tamper with the data, no copy is necessary.

The author of a CIN or DLL could indeed choose to create his function in such a manner that it uses the same physical buffer in memory for input and output. This is by no means the only way to return values from a function, but it's quite common for efficiency reasons. LabVIEW might even assume that a CIN or DLL always overwrites any buffer passed into it (and may therefore make a copy if a wire branche
s both to a CIN and somewhere else).

So to me, the phrase you cited connotes the G compiler's decision of whether or not a wire branch modifies the data (e.g., string concatenation, removing elements from arrays) or just reads it (e.g., an index or input to a calculation).
Message 2 of 3
(2,713 Views)
Hi UnDees,

Thank you for your reply.

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