JeVois
1.22
JeVois Smart Embedded Machine Vision Toolkit
|
|
#include <jevois/Types/Singleton.H>
A generic singleton class to enforce a single instance of an object.
The Singleton class should be inherited by any class which needs:
Note that there are currently no guarantees on the order of destruction of Singletons, so care should be taken to never reference another Singleton in the destructor of a Singleton.
This particular implementation is from: http://stackoverflow.com/questions/1008019/c-singleton-design-pattern
The following is an example use of the Singleton:
T | The class that is being made the singleton. |
This class was first designed by Rand Voorhies in the Neuromorphic Robotics Toolkit.
Definition at line 91 of file Singleton.H.
Static Public Member Functions | |
static T & | instance () |
Get the global, unique instance of the class T. | |
Protected Member Functions | |
Singleton () | |
Only classes that inherit from Singleton can construct it via its protected default constructor. | |
|
protected |
Only classes that inherit from Singleton can construct it via its protected default constructor.
|
static |
Get the global, unique instance of the class T.
If the global, unique instance of class T has not yet been created, then this method will create it in a thread-safe manner.