Last change
on this file since 61 was
22,
checked in by rings, 14 years ago
|
|
-
Property svn:executable set to
*
|
File size:
602 bytes
|
Line | |
---|
1 | /** |
---|
2 | * @file Singleton.h |
---|
3 | * Defines the Singleton class template |
---|
4 | * @author Alexandre Berge |
---|
5 | * @version 1.0 |
---|
6 | * @date 16/07/2009 |
---|
7 | */ |
---|
8 | #ifndef SINGLETON_H |
---|
9 | #define SINGLETON_H |
---|
10 | template <class T> |
---|
11 | /** |
---|
12 | * Template class for singleton objects. |
---|
13 | */ |
---|
14 | class Singleton |
---|
15 | { |
---|
16 | public: |
---|
17 | /** |
---|
18 | * The methods returns the singleton instance of this class. |
---|
19 | * @return Class instance |
---|
20 | */ |
---|
21 | static T& Instance() { |
---|
22 | static T m_instance; |
---|
23 | return m_instance; |
---|
24 | } |
---|
25 | |
---|
26 | protected: |
---|
27 | Singleton() {}; |
---|
28 | virtual ~Singleton() {}; |
---|
29 | |
---|
30 | private: |
---|
31 | Singleton(Singleton const&); |
---|
32 | Singleton& operator=(Singleton const&); |
---|
33 | }; |
---|
34 | |
---|
35 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.