diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2006-05-03 06:49:30 +0000 | 
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2006-05-03 06:49:30 +0000 | 
| commit | 96b00553a0ffe6bb34af6ad15e1cfc2bed67bd75 (patch) | |
| tree | a930fe51f01a7400fe97b46db2fcfcdc1f2712da /src/singleton.h | |
| parent | 33fef4a17290e7872293d8cc173bec826f24001c (diff) | |
| download | libbu++-96b00553a0ffe6bb34af6ad15e1cfc2bed67bd75.tar.gz libbu++-96b00553a0ffe6bb34af6ad15e1cfc2bed67bd75.tar.bz2 libbu++-96b00553a0ffe6bb34af6ad15e1cfc2bed67bd75.tar.xz libbu++-96b00553a0ffe6bb34af6ad15e1cfc2bed67bd75.zip  | |
Added a simple test for the log system, and switched the multilog to the new
singleton system, which unfortunately changed it's API slightly.  Now it's not
a pointer from the singleton, but I did add a new macro to make most usage of it
even easier.
Diffstat (limited to 'src/singleton.h')
| -rw-r--r-- | src/singleton.h | 13 | 
1 files changed, 13 insertions, 0 deletions
diff --git a/src/singleton.h b/src/singleton.h index c69e6f1..47adbd5 100644 --- a/src/singleton.h +++ b/src/singleton.h  | |||
| @@ -30,12 +30,25 @@ template <class T> | |||
| 30 | class Singleton | 30 | class Singleton | 
| 31 | { | 31 | { | 
| 32 | protected: | 32 | protected: | 
| 33 | /** | ||
| 34 | * Private constructor. This constructor is empty but has a body so that | ||
| 35 | * you can make your own override of it. Be sure that you're override is | ||
| 36 | * also protected. | ||
| 37 | */ | ||
| 33 | Singleton() {}; | 38 | Singleton() {}; | 
| 34 | 39 | ||
| 35 | private: | 40 | private: | 
| 41 | /** | ||
| 42 | * Copy constructor, defined so that you could write your own as well. | ||
| 43 | */ | ||
| 36 | Singleton( const Singleton& ); | 44 | Singleton( const Singleton& ); | 
| 37 | 45 | ||
| 38 | public: | 46 | public: | 
| 47 | /** | ||
| 48 | * Get a handle to the contained instance of the contained class. It is | ||
| 49 | * a reference. | ||
| 50 | *@returns A reference to the contained object. | ||
| 51 | */ | ||
| 39 | static T &getInstance() | 52 | static T &getInstance() | 
| 40 | { | 53 | { | 
| 41 | static T i; | 54 | static T i; | 
