LibreOffice
LibreOffice 6.4 SDK C/C++ API Reference
|
Go to the documentation of this file.
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 >
190 SingletonClass* SingletonRef< SingletonClass >::m_pInstance = NULL;
192 template<
class SingletonClass >
193 sal_Int32 SingletonRef< SingletonClass >::m_nRef = 0;
197 #endif // INCLUDED_SALHELPER_SINGLETONREF_HXX
SingletonClass * operator->() const
Allows rSingle->someBodyOp().
Definition: singletonref.hxx:140
Definition: condition.hxx:31
Guard< Mutex > MutexGuard
Definition: mutex.hxx:246
SingletonClass & operator*() const
Allows (*rSingle).someBodyOp().
Definition: singletonref.hxx:151
Object lifetime scoped mutex object or interface lock.
Definition: mutex.hxx:115
A mutual exclusion synchronization object.
Definition: mutex.hxx:31
template for implementing singleton classes.
Definition: singletonref.hxx:70
A helper functor for the rtl_Instance template.
Definition: getglobalmutex.hxx:32
#define OSL_ENSURE(c, m)
If cond is false, reports an error with message msg.
Definition: diagnose.h:84
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:396
~SingletonRef()
standard dtor.
Definition: singletonref.hxx:118
SingletonRef()
standard ctor.
Definition: singletonref.hxx:95