03-10-2010 11:03 AM
nathand wrote:Ben wrote:
NI has carefully never said that the class wire is just a reference. If you look at the VI the LVOOP creates, you will see that they are the form where the icon connectors are on the root of the diagram and on the icon connector so the data is not necessarily copied into the LVOOP method but can be acted on in-place (see teh Clear as Mud thread).
I'm pretty sure a class wire acts just like a cluster, with exactly the same rules about in-place operations, which items are stored inline (fixed-size data types) versus stored as references (strings and arrays), and when a copy is made.
Thank you Nathan for "Listening to what I meant and not what I wrote."!
Ben
03-10-2010 11:07 AM
In place is an excellent way of handling this, as tst says, and it sounds like that would possibly be the right choice. However, you may have the same issues with the In Place Element Structure as you do with semaphores simply because when you actually reference the object, nothing else can access this bit of memory thereby causing other attempts to reference the object in question hang until the object is dereferenced.
Cheers, Matt
03-10-2010 01:34 PM
mtat76 wrote:...However, you may have the same issues with the In Place Element Structure as you do with semaphores simply because when you actually reference the object, nothing else can access this bit of memory thereby causing other attempts to reference the object in question hang until the object is dereferenced.
There is one crucial difference - a semaphore only provides the lock. A DVR/SEQ manages the actual data as well, which is my understanding of what the OP wanted (essentially by-ref OOP, which is quite a common request).
03-10-2010 02:11 PM
The original poster said they wanted a way to pass data between loops, where those loops happen to be inside of a VI that's part of a LVOOP class - or at least, that was my reading of it. If that's true, I'd ask: "What would you do if this VI wasn't part of a class?" I don't think there was any request for a by-ref object.
tst wrote:There is one crucial difference - a semaphore only provides the lock. A DVR/SEQ manages the actual data as well, which is my understanding of what the OP wanted (essentially by-ref OOP, which is quite a common request).
03-10-2010 04:22 PM
03-10-2010 06:28 PM
toad wrote:
Hi all, What's the best way of transfering the state of an object between 2 loops on a class VI? ....
Any ideas? Phill
This is how I transfered the state.
I should have thought of this earlier.
Ben
03-10-2010 07:32 PM
I hope I'm not hijacking the thread here, but I was wondering how the approach would differ if the loops were running in separate VIs? Say for example you create an object in your main VI, but you want to periodically update the object in a subVI launched with VI server... Would you use a named single element queue, store the class in an action engine/functional global, or something else entirely?
Thanks,
JasonP - CLD
03-10-2010 08:08 PM
Jason P wrote:I hope I'm not hijacking the thread here, but I was wondering how the approach would differ if the loops were running in separate VIs? Say for example you create an object in your main VI, but you want to periodically update the object in a subVI launched with VI server... Would you use a named single element queue, store the class in an action engine/functional global, or something else entirely?
Thanks,
JasonP - CLD
Unamed. See above.
The code I showed
is the method executed by each instance when the main app is trying to save the state of all of the VI launched plug-ins.
Ben
03-11-2010 02:37 AM
02-18-2011 05:47 AM
Hi all
Does anyone know what the concurrency / thread safety aspects of In Place Structures and data reference read / write elements?
I'm revisiting the original problem and am trying the class reference solution.
I create a reference to my controller class object and pass this to my various views.
This allows the views to communicate directly with the controller from an in place structure.
I'm just worried whether I need to protect access to the class controller.
Regards
P