20 #ifndef INCLUDED_SALHELPER_SINGLETONREF_HXX 21 #define INCLUDED_SALHELPER_SINGLETONREF_HXX 68 template<
class SingletonClass >
77 static SingletonClass* m_pInstance;
80 static sal_Int32 m_nRef;
104 m_pInstance =
new SingletonClass();
106 OSL_ENSURE(m_nRef>0 && m_pInstance,
"Race? Ref count of singleton >0, but instance is NULL!");
134 #if defined LIBO_INTERNAL_ONLY 171 struct SingletonLockInit
175 static ::osl::Mutex aInstance;
189 template<
class SingletonClass >
192 template<
class SingletonClass >
197 #endif // INCLUDED_SALHELPER_SINGLETONREF_HXX A helper functor for the rtl_Instance template.
Definition: getglobalmutex.hxx:31
A mutual exclusion synchronization object.
Definition: mutex.hxx:30
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:396
SingletonRef()
standard ctor.
Definition: singletonref.hxx:95
#define OSL_ENSURE(c, m)
If cond is false, reports an error with message msg.
Definition: diagnose.h:84
template for implementing singleton classes.
Definition: singletonref.hxx:69
Guard< Mutex > MutexGuard
Definition: mutex.hxx:224
Provides simple diagnostic support.
Definition: condition.hxx:30
SingletonClass & operator*() const
Allows (*rSingle).someBodyOp().
Definition: singletonref.hxx:151
~SingletonRef()
standard dtor.
Definition: singletonref.hxx:118
SingletonClass * operator->() const
Allows rSingle->someBodyOp().
Definition: singletonref.hxx:140
A helper class for mutex objects and interfaces.
Definition: mutex.hxx:108