| LibreOffice
    LibreOffice 25.2 SDK C/C++ API Reference | 
template for implementing singleton classes. More...
#include <singletonref.hxx>
| 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 instantiated every time they
    are needed. But the internal wrapped object will
    be created one times only. Of course it's 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 suppress 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 can't be exported - e.g. from windows libraries.
| 
 | inline | 
standard ctor.
    The internal wrapped object is created only,
    if its ref count was 0. Otherwise 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 will be 0. Otherwise this method
    does nothing ... except decreasing of the internal
    ref count!
 
| 
 | inline | 
Allows (*rSingle).someBodyOp().
| 
 | inline | 
Allows rSingle->someBodyOp().