24 #ifndef INCLUDED_SALHELPER_SINGLETONREF_HXX 25 #define INCLUDED_SALHELPER_SINGLETONREF_HXX 72 template<
class SingletonClass >
81 static SingletonClass* m_pInstance;
84 static sal_Int32 m_nRef;
108 m_pInstance =
new SingletonClass();
110 OSL_ENSURE(m_nRef>0 && m_pInstance,
"Race? Ref count of singleton >0, but instance is NULL!");
138 #if defined LIBO_INTERNAL_ONLY 175 struct SingletonLockInit
179 static ::osl::Mutex aInstance;
193 template<
class SingletonClass >
194 SingletonClass* SingletonRef< SingletonClass >::m_pInstance = NULL;
196 template<
class SingletonClass >
197 sal_Int32 SingletonRef< SingletonClass >::m_nRef = 0;
201 #endif // INCLUDED_SALHELPER_SINGLETONREF_HXX ~SingletonRef()
standard dtor.
Definition: singletonref.hxx:122
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:378
Object lifetime scoped mutex object or interface lock.
Definition: mutex.hxx:123
Provides simple diagnostic support.
A helper functor for the rtl_Instance template.
Definition: getglobalmutex.hxx:35
Guard< Mutex > MutexGuard
Definition: mutex.hxx:255
SingletonClass * operator->() const
Allows rSingle->someBodyOp().
Definition: singletonref.hxx:144
template for implementing singleton classes.
Definition: singletonref.hxx:73
A mutual exclusion synchronization object.
Definition: mutex.hxx:35
SingletonClass & operator*() const
Allows (*rSingle).someBodyOp().
Definition: singletonref.hxx:155
Definition: condition.hxx:33
#define OSL_ENSURE(c, m)
If cond is false, reports an error with message msg.
Definition: diagnose.h:87
SingletonRef()
standard ctor.
Definition: singletonref.hxx:99