I am trying my first steps into Labview OOP and am currently thinking on how to best proceed.
I have an existing RT application running on a CRIO system that has as one of its components,
a multi channel analyzer (MCA8000).
I thought this would be a good candidate for my first LV class since the vi's I curently have for this MCA
are all connected via a rather large cluster with sub-clusters to store status information and so on for
this device. Exactly the kind of data which is better defined as private within a class!
In the currently working code for the whole intrument (non-OOP) I use several queues to send commands
to indivudal loops of the software and one general message and error logging queue.
In the code I want to re-implement as OOP for the MCA I use data queues and the "general" logging
queue of the main program. These queues are all typedefed in the main program.
So instead of error in's and out's I have the typedefed logging queue as input and errors are logged there
when they occur. Not sure if this is good practice but this is a good way to let the user know of errors that occur
on the RT target since the queued log "entries" are all sent to the UI which runs on a laptop.
The MCA specific queue typedefs I can include into the class project so that they are part of the MCA class.
What I am not sure about is how to handle the "general" logging queue since it is also used elsewhere in the main
program. And I am not "yet" planning of re-implementing the whole thing using oop, I wanted to start with a small
In a fully OOP project I would probably define the logging queue in a parent class if I understand OOP correctly?
Sorry, I am rather new to LV OOP so I might be asking something obvious...
depending on how complex your project is, I wouldn't recomment to change to OOP just partly because it is a different programming paradigm. So the concept of your project would become inconsistent, and therefore difficult to manage, especially for other developers.
But in general there are many different ways to solve your task.
1. You can create a basic logging handling class as parent which could contain basic Information. Then your derived classes would implement the specific task (error logging, message logging, etc.)
2. If you are using the message queue for communication I would split these tasks into two classes. One Message/Communcation-Handling class and another Error Handling/Report class.
Depending on your projects task there could also be better solutions on how to organize the class hierarchy.
If you are really planning on implementing your OOP in pieces I would recommend attacking it from the most common and shared items first. So, start with your logs, error processing and messaging components. These are the types of things that will get used by your higher level classes. They also tend to be a bit more self contained and easier to start with.