|
Last change
on this file since 4578 was
4519,
checked in by bensch, 20 years ago
|
|
orxonox/trunk: changed all getInstances into inline functions to save some (minor) time
|
|
File size:
616 bytes
|
| Line | |
|---|
| 1 | /*! |
|---|
| 2 | \file proto_singleton.h |
|---|
| 3 | \brief Definition of the ... singleton Class |
|---|
| 4 | |
|---|
| 5 | */ |
|---|
| 6 | |
|---|
| 7 | #ifndef _PROTO_SINGLETON_H |
|---|
| 8 | #define _PROTO_SINGLETON_H |
|---|
| 9 | |
|---|
| 10 | #include "base_object.h" |
|---|
| 11 | |
|---|
| 12 | // FORWARD DEFINITION |
|---|
| 13 | |
|---|
| 14 | //! A default singleton class. |
|---|
| 15 | class ProtoSingleton : public BaseObject { |
|---|
| 16 | |
|---|
| 17 | public: |
|---|
| 18 | virtual ~ProtoSingleton(void); |
|---|
| 19 | /** \returns a Pointer to the only object of this Class */ |
|---|
| 20 | inline static ProtoSingleton* getInstance(void) { if (!singletonRef) singletonRef = new ProtoSingleton(); return singletonRef; }; |
|---|
| 21 | |
|---|
| 22 | private: |
|---|
| 23 | ProtoSingleton(void); |
|---|
| 24 | static ProtoSingleton* singletonRef; |
|---|
| 25 | }; |
|---|
| 26 | |
|---|
| 27 | #endif /* _PROTO_SINGLETON_H */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.