11-09-2009 10:53 AM
Hi,
i have more of a standards type LabVIEW discussion i wanted to start or if someone has a definitive answer that'd be great. Anyways, i lately have been trying to implement as much OOP into my LabVIEW applications as possible. I have found myself creating a config.lvclass for almost every application i write. The data in the class typedef is ONLY the initial settings for the application before the user starts, by pressing a start button, the test (since all my apps are tests).
I have been keeping a library of classes i have written along with a nice inheritance heirarchy in that library. I was thinking that it would be a good idea to implement a config.lvclass that each of my applications could inherit from. Pretty much i think it would include a file path for the actual file and then a few methods that would need to be overridden by its children (eg: open and save).
Most of my apps also include a test status.lvclass which includes all the information for a test to resume in the event that it crashed or computer's power was lost and it correlates to a file as well that is updated as certain aspects of a tests are changed. Another would be a data.lvclass for obvious reasons but also correlates to a file.
I thought it would be a good idea to add base versions of these classes to my library for every application to inherit off of but is there already a standard way to perform this type of functionality built into LabVIEW. Also keep in mind that these classes do use the built in config file functions that come with labview but they each include a setup.vi which is overridden so that it displays a window for the user to set everything up.
Does this all sound like good ways to get this functionality or are there better ways? i hope i described this all well enough for you.
Thanks
Brent
11-10-2009 02:30 PM
Hi Brent,
It sounds like you have a pretty good start, and I think the methods that you are using are valid. Below is are a couple of documents that you can use to fine tune the way you are doing things. You should find some pretty good tips in them.
LabVIEW Object-Oriented Programming
http://zone.ni.com/devzone/cda/tut/p/id/5786
LabVIEW Object-Oriented Programming FAQ
http://zone.ni.com/devzone/cda/tut/p/id/3573
Nick Keel
Applications Engineering
National Instruments
11-10-2009 02:56 PM
Brent, I have no practice in LVOOP, but I can put the theoretical things. It is about encapsulation and inheritance. Encapsulation can be achieved via AE (action engines) as well. But inheritance is only via OOP and you mentioned a lot of it in your design considerations.
The main advantage of doing LVOOP is to have some code reusable in the opposite way of using SubVIs. So if you are doing the design, just go clearly with any objective/spec (checking if the file/folder exists,forcing a lot on first call ...).
As you want to use the same concept for several projects, the 'optimal solution' would be a mix of:
* OOP inheritance
* templates (one template with others inside)
* static (non-template) reusable SubVIs, such as the OpenG Config VIs
Felix
11-25-2009 12:05 PM
Brent,
Did you get any further with your idea of a generic config class?
I am also pondering this very problem...
11-30-2009 11:29 AM