LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Forking a class object to multiple loops?

Solved!
Go to solution

Me again trying to learn LVOOP.  So I've made good progress.  Now I have a UI loop plus some process loops that need to share some of the same data.  If I fork the class wires used in these multiple loops, I'm pretty sure that I will make copies made of the data within.  Included in one of the classes are some queue and user event refnums used for communicating between the loops.  I fear that once I fork the wires, I will "break the links" between the various processes, and the refnums won't work.

 

Now, forking such refnums is normal, proper practice - that's how we always roll, right?!  But can anybody tell me whether those refnums will still work when contained as class data on forked class wires?

 

Now I just know that at least one of you will try and lead me into that dark dangerous forest called The Dark Dangerous DVR Forest (says that on my map).  After 3 weeks of learning OOP, I barely have enough neurons to eat dinner and go to bed.  I fear the DVR Forest and the dangers within, to be honest - paul

0 Kudos
Message 1 of 5
(2,708 Views)
Solution
Accepted by topic author PaulOfElora

I think you may be overthinking references.  Here is an example of a reference:

 

NI.con user PaulOfElora

 

And now I'll make some copies of the reference:

 

NI.con user PaulOfElora

NI.con user PaulOfElora

NI.con user PaulOfElora

 

Now, why do you think these copies won't "work"?

 

Queue and User Event references are just the same; they are just a type combined with an identifier, which in their case is just a number rather than a username:

 

Queue 31645789

User Event 6526890

 

There's no magic that can get broken, that's all they are.  A type and a number.  You could turn them to just numbers, pass them to another application over TCP, pass them back again and turn them back to references and they will work (and I have done this as part of message reply routing).

Message 2 of 5
(2,658 Views)

Guilty As Charged of Overthinking!  Career criminal, honestly.  Thank you for clarifying, Dr. Powell - paul

0 Kudos
Message 3 of 5
(2,649 Views)

@PaulOfElora wrote:

Me again trying to learn LVOOP.  So I've made good progress.  Now I have a UI loop plus some process loops that need to share some of the same data.  If I fork the class wires used in these multiple loops, I'm pretty sure that I will make copies made of the data within.  Included in one of the classes are some queue and user event refnums used for communicating between the loops.  I fear that once I fork the wires, I will "break the links" between the various processes, and the refnums won't work.

 

Now, forking such refnums is normal, proper practice - that's how we always roll, right?!  But can anybody tell me whether those refnums will still work when contained as class data on forked class wires?

 

Now I just know that at least one of you will try and lead me into that dark dangerous forest called The Dark Dangerous DVR Forest (says that on my map).  After 3 weeks of learning OOP, I barely have enough neurons to eat dinner and go to bed.  I fear the DVR Forest and the dangers within, to be honest - paul


Yes, forking the wire will copy the data. If it's a reference it'll work fine as long as it was created beforehand. Any private data apart from references are now unique and their own instance. (Technically so if the reference, it's just that it points to the same place/instance as before) 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 5
(2,611 Views)

Thanks Yamaeda, that's what I thought - paul

0 Kudos
Message 5 of 5
(2,601 Views)