Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JSingleton.hh
Go to the documentation of this file.
1 #ifndef __JLANG__JSINGLETON__
2 #define __JLANG__JSINGLETON__
3 
4 /**
5  * \author mdejong
6  */
7 
8 namespace JLANG {}
9 namespace JPP { using namespace JLANG; }
10 
11 namespace JLANG {
12 
13 
14  /**
15  * Simple singleton class.
16  */
17  template<class T>
18  struct JSingleton {
19 
20  typedef T data_type;
21 
22  /**
23  * Get unique instance of template class.
24  *
25  * \return object
26  */
28  {
29  static data_type value;
30 
31  return value;
32  }
33 
34  protected:
35  /**
36  * Default constructor.
37  */
39  {}
40 
41 
42  /**
43  * Copy constructor.
44  */
46  {}
47 
48  private:
50  };
51 }
52 
53 #endif
JSingleton(const JSingleton &)
Copy constructor.
Definition: JSingleton.hh:45
Simple singleton class.
Definition: JSingleton.hh:18
JSingleton()
Default constructor.
Definition: JSingleton.hh:38
JSingleton & operator=(const JSingleton &)
do set_variable OUTPUT_DIRECTORY $WORKDIR T
static data_type & getInstance()
Get unique instance of template class.
Definition: JSingleton.hh:27