wrote: ha escrito: wrote: A big choice is whether you want this buffer to be by reference using a FGV, DVR, Queue, etc., or by value (in place element structures). Another choice is if it should be global (or a 'singleton'), or by wire. By ref\by wire is mutually exclusive with instance\singleton. Both will effect the buffer in it's core.
I would suggest just doing a by-value buffer, as it is easy to then use this inside a DVR or other by-reference method of one's choice.
To be honest, I don't understand anything here. Neither your message nor wiebe@CARYA quotation. Could I get more information? What's the differente between having the buffer by reference or by value? I have never work with DVR.
OK, here it goes. I'll try to be objective, although I'm not .
So a reference refers to something. In this context, let's say you have a reference or reference based buffer. You'd have a wire, and when you split the wire, you get two wires referring to the same buffer. That means if you add data at one place, you can read it in the other.
Data Value References do that. Queues would also have that effect. The init creates a queue\DVR, and a cluster, class or raw reference (queue\DVR) will copy the reference, but not the data it points to.
That's by reference.
A simple 2D array on the other hand, acts completely different. (In fact, it works exactly the same*.) Splitting the wire (even when embedded in a class or cluster) conceptually makes a copy of the data. (LV doesn't copy data if it can be avoided.) So when adding data in one place, this data does not magically appear in the other place.
That's by value.
*The trick is that the reference is the data, and it's copied exactly the same as the 2D array. So it is very consistent, but the effect is completely different.
When something is by wire, you need the wire to refer to that object. If the wire (e.g. a class or cluster) contains a reference, you still need the wire to get the reference.
That's by wire.
A Functional Global on the other hand, is not by wire. It's a VI, and there's nothing to refer to it. As a consequence, you can't reuse the FG for different purposes. If you want to reuse it, you need to save a copy (which is usually a bad thing). Not needing a wire is sometimes perceived as a good thing (notice my bias against it ). There are two sides of the coin. It's convenient, easy and fast to use (+), it's more difficult to search (-), tight coupling lurks (-) and copying\reuse is harder (-).
That's a singleton\global.
So you can have:
by value\by ref
by wire\ global
For a global, by value \ by ref is mood. A global doesn't need to be passed, so a wire nor a reference is needed
By value \ by wire is 'plain' LabVIEW.
By ref \ by wire is for instance a queue reference in a cluster.
By value \ by wire is often considered more difficult when scaling up. The moment you get parallel loops\processes, you'll want to get data from one to the other loop. By reference solves that, and I think people find it more difficult to do this by value. However, values can be send from one loop to the other, for instance by queue, with (user) events, or by messaging libraries.
By reference can be more difficult to debug (the reference dies when the main VI stops running) and they can cause memory leaks more easily.