If you use LabVIEW classes in your application, examples, POCs, etc., you may have been wondering how to implement a singleton object.
What is a singleton? Singletons are known in the LabVIEW world as action engines, functional globals with methods, and under a few other names. Basically it is a set of data with associated functions, and you ever only one instance of this object in your application. A functional global (non-reentrant subVI), with uninitialized shift registers (USR)) to store the data and multiple cases to implement the different functions, is the most common example of a singleton in LabVIEW. Using OOP you can easily create a class which contains the same data and functions, however, by default a class will not limit the application to only one instance (object) of the class.
There recently was a good discussion on LAVA about singletons, including a good reference example of a singleton implemented as a LV class provided by LV R&D.
http://lavag.org/topic/11513-singleton-design-pattern/page__view__findpost__p__70428
One application of a singleton object may be a database interface in an application where many different components or other objects access the same database. Typically you only want one object or component touching the database to avoid conflicts, race conditions, etc. A database access class with a singleton object is a good solution for this type of application.
developing embedded systems and industrial control applications.
Showing posts with label design. Show all posts
Showing posts with label design. Show all posts
Tuesday, January 19, 2010
Thursday, July 30, 2009
My first go at writing a blog failed miserably after the first post. But as the saying goes, Try Try again. So here is my blog, Take 2.
I'm glad to say the xCE project, which I mentioned in my first post, has been completed very successfully, albeit not by me. It will be posted in the next few days on NI Developer Zone and I will write about it in an upcoming post. Search for it on ni.com in the mean time.
My time in the last few months has been occupied coordinating an update to the Machine Control Reference Architecture which we will publish for NIWeek. As part of this project I have updated the Queued Message Handler (QMH) design pattern and extracted the messaging piece into a separate Asynchronous Message Communication (AMC) reference library. It can be used to pass a variety of messages (commands, faults, alarms, status updates, etc.) between different parts of a LabVIEW application, including different LabVIEW targets connected by Ethernet.
My other area of focus recently has been deployment and replication of applications on the LabVIEW Real-Time and LabVIEW Touch Panel targets. I will be discussing this topic during NIWeek on Tuesday and will also be publishing a LV RT Application Deployment Utility reference application.
Going forward here I plan on highlighting and discussing different reference designs developed by the Systems Engineering group at NI and will throw in other random LabVIEW design and architecture topics.
If you see me at NIWeek, come say Hi. I'd love to talk with you about your applications.
I'm glad to say the xCE project, which I mentioned in my first post, has been completed very successfully, albeit not by me. It will be posted in the next few days on NI Developer Zone and I will write about it in an upcoming post. Search for it on ni.com in the mean time.
My time in the last few months has been occupied coordinating an update to the Machine Control Reference Architecture which we will publish for NIWeek. As part of this project I have updated the Queued Message Handler (QMH) design pattern and extracted the messaging piece into a separate Asynchronous Message Communication (AMC) reference library. It can be used to pass a variety of messages (commands, faults, alarms, status updates, etc.) between different parts of a LabVIEW application, including different LabVIEW targets connected by Ethernet.
My other area of focus recently has been deployment and replication of applications on the LabVIEW Real-Time and LabVIEW Touch Panel targets. I will be discussing this topic during NIWeek on Tuesday and will also be publishing a LV RT Application Deployment Utility reference application.
Going forward here I plan on highlighting and discussing different reference designs developed by the Systems Engineering group at NI and will throw in other random LabVIEW design and architecture topics.
If you see me at NIWeek, come say Hi. I'd love to talk with you about your applications.
Labels:
design,
engineering,
labview,
reference,
systems
Subscribe to:
Posts (Atom)