From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, 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: 

Get All Elements of Class Private Data

In a member VI of a .lvclass, is there a way to iterate through the elements of the class private data, similar to iterating through the elements of a cluster?

paul_a_cardinale_2-1722947977198.png

 

There's no property for it,

paul_a_cardinale_1-1722947890780.png

but is there any way to do it?

0 Kudos
Message 1 of 5
(388 Views)

Like that?

raphschru_0-1722951270071.png

I don't think it works in an exe though...

 

Regards,

Raphaël.

0 Kudos
Message 2 of 5
(371 Views)

Your question is a bit vague.  If you're trying to do some sort of scripting, then raphschru's answer is probably the way, but it doesn't get you the values of the elements of the private data of the class wire that's passing through the class wire currently inside your VI.  It also wouldn't get you anything from the parents or children of the class unless you add additional scripting looking for those as well.

 

If you're trying to get values instead of just the structure of the private data of one level of the class hierarchy, then it's a lot harder, and deliberately so.  The only way I can think to do this is to use one of the built-in "flatten" commands, either flattening to string or to XML, and then parsing through the output.

 

If you're trying to write or modify values rather than just read them, it's even harder, as you'd have to smash whatever you want to write back into the flattened string without breaking the formatting, then convert it back.

 

So what's the actual objective here?  In general, it feels like you're trying to go against the design principles of OOP and LV classes in an attempt to be efficient and/or clever.

0 Kudos
Message 3 of 5
(342 Views)

My purpose was to save and recall settings which consists of values and some properties of some front panel controls; and to do it in such a manner that if the set of controls changes, settings from older files could still be read.

 

My initial idea was to use the automatic mutation capabilities of classes.

But I've gone with a different approach.

0 Kudos
Message 4 of 5
(336 Views)

This is the best encapsulation break I'm aware of

https://www.vipm.io/package/pnr_lib_labview_composition/

 

0 Kudos
Message 5 of 5
(330 Views)