Jpp
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
JLANG::JSingleton::getInstance
static data_type & getInstance()
Get unique instance of template class.
Definition: JSingleton.hh:27
JLANG::JSingleton::data_type
T data_type
Definition: JSingleton.hh:20
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JLANG::JSingleton::JSingleton
JSingleton()
Default constructor.
Definition: JSingleton.hh:38
JLANG::JSingleton::operator=
JSingleton & operator=(const JSingleton &)
JLANG::JSingleton
Simple singleton class.
Definition: JSingleton.hh:18
JLANG
Auxiliary classes and methods for language specific functionality.
Definition: JAbstractClass.hh:10
JLANG::JSingleton::JSingleton
JSingleton(const JSingleton &)
Copy constructor.
Definition: JSingleton.hh:45