08-10-2013 08:20 AM
Does anybody know how to get a list of the public properties for a class?
Preferably the tool looks like the app method 'Get Class Methods'
Ton
Solved! Go to Solution.
08-10-2013 09:21 AM
LVOOP classes only have private properties. To provide public access to a property, you have to write an accessor VI. There's no standard pattern for naming accessor VIs, so there's no generic tool for finding and enumerating them.
VI Server classes list all their public properties when you click on a property node that's configured for that class.
Or did you mean some other kind of class?
08-10-2013 10:43 AM
No you understand correctly I mean the properties that you (externally) access via property node. However I need the list programmatically for documentation function. I hope someone allready had made a tool that could retrieve the list.
08-11-2013 11:27 AM
Not seen anything specific but I would think, if it is for development purposes I would be tempted to take a look at the project API. As they are a special definition in the project I suspect there would be a way to pull it through this.
08-12-2013 10:56 AM
You should be able to open a reference to the LV class and then iterate through its project items looking for any that are of type PropertyFolder and then testing that their access scope is public.
08-12-2013 03:39 PM
Yes the project API gave me the solution, I will post it after polishing things.
Ton
08-13-2013 01:54 PM
Here's the working code:
In short I get all property folders, iterate over them, get all containing VI's, check if they match the correct connector pane, the location of indicators and controls.
The case structure should have the case 'Public .. Community'
Ton
PS AQ why is the enum of 'Scope' in this order:
08-13-2013 02:05 PM
Why bother checking the conpanes? If they're in a property folder, they either match the required conpane or the class is broken. If there are two VIs, then set both the read and the write. If there's only one, just check which of the two terminals is wired. Much much faster than the code you've written.
> AQ why is the enum of 'Scope' in this order:
Because protected scope was added after libraries were finished. Community scope was added three versions of LV after the others and enums can only be extended by adding to the end of an enum (otherwise you break existing code).
08-13-2013 02:30 PM
I do extensive checking because I thought that it was possible to have more than two VIs in a property definition folder. However checking in LV 2011 and 2012 prove me wrong. 2010 perhaps?
Ton
08-13-2013 04:22 PM
TCPlomp wrote:
2010 perhaps?
Nope. Never.