Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 67061

Understanding DVRs

$
0
0

LV2013, Win7

 

I'm an old hand at LabVIEW, but brand new to Data Value References (DVR), and I'm not understanding what I am seeing.

 

I have a class, that contains one I32, and has one method to increment and display that number.

My main program has what i think should be a SINGLE INSTANCE of that class.

 

Main can launch any number of "Child" VIs, each in separate windows.  The child VI is reentrant.

 

When I launch a child, I create a DVR to the one and only instance of the class, and off you go:

DVR Test Main.PNG

 

The child VI is set to OPEN FRONT PANEL WHEN CALLED.

 

It has a GO button, and when you click that, it dereferences the DVR, and calls the INCREMENT method on that class.

 

 

DVR Test Child.PNG

 

 The class method is simple: DVR Test Dialog.PNG

What I EXPECT to happen is that there is ONE and ONLY ONE instance of the class.

The children get a REFERENCE to that class, and operate on the REFERENCE.

So therefore, the I32 in that class would get incremented by a call from EITHER child.  And they both operate on the same instance of the same class.

 

BUT NO.

 

What ACTUALLY happens is that it appears there are TWO instances of the class.  Each child "owns" its own copy and they are independent.

 

 

The class method is NOT reentrant.

The class is set so that RESTRICT REFERENCES TO CLASS METHODS is OFF, so that I can create the reference at launch time (is that a problem?)

 

Here's a JING showing what happens: <http://www.screencast.com/t/2gN64oWF>

 

Attached is a project.

 

if I launch 3 or more instances, there are 3 or more different integers.

 

What's wrong with my thinking?  Why aren't the two children referring to the same instance of the class?


Viewing all articles
Browse latest Browse all 67061

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>