SLIC
6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
include
Singleton.hh
Go to the documentation of this file.
1
#ifndef SLIC_SINGLETON_HH_
2
#define SLIC_SINGLETON_HH_ 1
3
8
template
<
class
T>
9
10
class
Singleton
{
11
12
public
:
13
17
static
T*
instance
();
18
22
void
release
();
23
27
Singleton
();
28
32
~Singleton
();
33
34
private
:
35
static
T*
m_singleton
;
36
};
37
38
template
<
class
T> T*
Singleton<T>::m_singleton
= 0;
39
40
template
<
class
T>
41
Singleton<T>::Singleton
() {
42
}
43
44
template
<
class
T>
45
Singleton<T>::~Singleton
() {
46
}
47
48
template
<
class
T>
49
T*
Singleton<T>::instance
() {
50
if
(
m_singleton
== 0) {
51
m_singleton
=
new
T;
52
}
53
return
m_singleton
;
54
}
55
56
template
<
class
T>
57
void
Singleton<T>::release
() {
58
if
(
m_singleton
== 0)
59
return
;
60
delete
m_singleton
;
61
m_singleton
= 0;
62
}
63
64
#endif
65
Singleton
Definition:
Singleton.hh:10
Singleton::Singleton
Singleton()
Singleton::release
void release()
Singleton::~Singleton
~Singleton()
Singleton::m_singleton
static T * m_singleton
Definition:
Singleton.hh:35
Singleton::instance
static T * instance()
Generated by
1.9.1