11-04-2013 04:49 PM
Essentially I'm looking for a method of Private Write Public Read accessors without using a class.
Use Case (oversimplified)
Create a boolean that can only be true if the value is written by a member on a specific lvlib.
Think a vi in "Unit Test.lvlib in lvproj xxx" will allow me to set Unit Test Mode == True and nobody else can call the vi that sets this value true such that Unit Test mode cannot be faked outside of unit test.
Or the functionality in this project WITHOUT LVOOP-
Any ideas?
Solved! Go to Solution.
11-04-2013 05:20 PM
Hi Jeff,
Something like this?
11-04-2013 05:36 PM
I'd rather break any vi that tries to set the value out of scope.
11-04-2013 05:43 PM - edited 11-04-2013 05:49 PM
If it's in a LVLib, why not use the scoping functionality you have available there? Make your "set Unit Test True" VI private to the LVLib, and put the other functionality that you want to be able to access this VI in the same LVLib.
11-04-2013 05:53 PM
11-04-2013 06:01 PM
@for(imstuck) wrote:
If it's in a LVLib, why not use the scoping functionality you have available there? Make your "set Unit Test True" VI private to the LVLib, and put the other functionality that you want to be able to access this VI in the same LVLib.
Nice one- I had an inkling that that was possible, but missed it this time around.
Regards,
11-04-2013 06:16 PM
Greg's solution is definately the way to go. By making the write VI and the global variable private inside of a lvlib, only VIs inside of that library can access them. Any VI outside of the library that tries to call them will have a broken run arrow.
11-05-2013 07:47 AM
11-05-2013 09:50 AM - edited 11-05-2013 10:02 AM
I hadn't thought of a semiprivate friend for a second lvlib.
You gotta love the forums! Thanks
Pidi- If you want a bunch more kudos toss some documentation in that and cross post it to the micro-nuggets thread. That is an interesting solution to a tricky problem
11-05-2013 04:28 PM - edited 11-05-2013 04:32 PM
Be careful with friending, some poeple have had issues when friending classes, although this may not apply to your specific situation. Just something to be aware of.