04-17-2024 09:44 AM - edited 04-17-2024 02:19 PM
I started trying out GOOP. What is the private data bool None good for, when creating a LVClass via GOOP? Is it just a placeholder for scripting?
Where is best practice to initialize private data member. Shoud I add this into the automatically created _create.vi? or should I add a Init.vi myself?
Solved! Go to Solution.
04-19-2024 06:27 AM
..._Create.vi is a common place to initialize object attributes (private data). But if some attribute(s) must be reset during run of the SW without destruction of the object, the initialization/reset can be done in a separate method init.vi or reset.vi or whatevername.vi. Usually such a method is added in ..._Create.vi as a sub-VI and called first time there.
04-19-2024 06:39 AM
And regarding 'None' - I thought someone may use it as some kind of null? But I think it's just a placeholder right now
04-19-2024 09:27 AM
Sorry, where this "None" is located? I don't remember anything having this name
04-19-2024 09:41 AM
04-19-2024 10:27 PM - edited 04-19-2024 10:28 PM
Sorry, seems I did not read your first message very carefully. You ask about native LabVIEW classes. I never use GDS to work with these classes. As a fact I use them only as data-wrappers (probably similar to messages in Actor Framework) and as single function providers (same as used in Sort 1D Array.vim).
Anyhow, the private member None is a placeholder. It is here to avoid errors in automatically created methods .._Init.vi and CleanUp.vi.
04-21-2024 09:48 PM
Hi,
For a native by value class you can have an empty Private Data Cluster, but for the by reference classes you have a normal Type Def cluster for storing the data, and since you can't have an empty cluster we need to add something in that cluster.
But we do that for a By Value class as well. It makes it easier for the Init and Cleanup methods if they have something to bundle and unbundle.
So the first thing you would do is to update the class private data to your needs.
If you don't need and attributes, sure then you just need to update the Init and Cleanup, but in that case you might want to use an interface.