08-06-2024 07:40 AM
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?
There's no property for it,
but is there any way to do it?
08-06-2024 08:39 AM
08-06-2024 11:20 AM
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.
08-06-2024 11:41 AM
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.
08-06-2024 11:48 AM
This is the best encapsulation break I'm aware of
https://www.vipm.io/package/pnr_lib_labview_composition/