From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Questions about using a reference held in private class data without changes to the reference value

So, I have a bunch of boilerplate code that looks like variations on the following:

 

boilerplateSnippet.png

 

Here, you can see an IPE Structure, with unbundle/bundle of a (COM, but it doesn't matter afaik for this question) reference. Then I do something with the reference using a property or invoke node (here invoke). The reference coming out of the node is to my understanding identical in every way to the one entering the node.

 

Whilst looking for the suitable way to do this in a child class (using the same private data, but now belonging to a parent and so inaccessible directly using an IPE) I came across this idea post in which the problem is discussed. There, AQ tells the OP that starting in 2013, LabVIEW will use inline accessors in the same manner as an IPE, subject to some conditions regarding their placement.

 

AQ also describes how ideally APIs should discourage wiring 'object out' indicators from 'Read' accessors, in order to avoid artificial dataflow constraints.

 

My question becomes, should I instead do this:

boilerplate2.png

 

and use a 'Read' only accessor when in a child class, like here (same VI, so not actually a child, but the point should be clear):

boilerplate3.png

 

(in this case, I have an object out indicator - my bad, but it does make it 'nicer' looking, and here the outcome should be identical I think - just a fork in the wire from in to out in the inlined subVI, which has nothing more than an unbundle node)

 


GCentral
0 Kudos
Message 1 of 2
(2,219 Views)

In this case, I would make protected methods in the parent class for the common actions on the reference.  This might even remove the need for the accessor VI.  With the VI in the Protected access mode, only children can use the method.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 2
(2,181 Views)