|
My Project
UDK 3.2.7 C/C++ API Reference
|
template for implementing singleton classes. More...
#include <singletonref.hxx>
Classes | |
| struct | SingletonLockInit |
| creates an own mutex for guarding static contents. | |
Public Member Functions | |
| SingletonRef () | |
| standard ctor. | |
| ~SingletonRef () | |
| standard dtor. | |
| SingletonClass * | operator-> () const |
| Allows rSingle->someBodyOp(). | |
| SingletonClass & | operator* () const |
| Allows (*rSingle).someBodyOp(). | |
template for implementing singleton classes.
Such classes can be instanciated everytimes they
are needed. But the internal wrapped object will
be created one times only. Of course its used
resources are referenced one times only too.
This template hold it alive till the last
reference is gone. Further all operations
on this reference are threadsafe. Only
calls directly to the internal object (which modify
its state) must be made threadsafe by the object itself
or from outside.
The only chance to supress such strange constellations is a lazy-init mechanism.
Note further that this singleton pattern can work only, if all user of such singleton are located inside the same library! Because static values cant be exported - e.g. from windows libraries.
|
inline |
standard ctor.
The internal wrapped object is created only, if its ref count was 0. Otherwhise this method does nothing ... except increasing of the internal ref count!
|
inline |
standard dtor.
The internal wrapped object is removed only, if its ref count wil be 0. Otherwhise this method does nothing ... except decreasing of the internal ref count!
|
inline |
Allows (*rSingle).someBodyOp().
|
inline |
Allows rSingle->someBodyOp().
1.8.1.2