24#ifndef INCLUDED_SALHELPER_SINGLETONREF_HXX
25#define INCLUDED_SALHELPER_SINGLETONREF_HXX
72template<
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;
184 ::osl::Mutex& ownStaticLock()
const
186 return *rtl_Instance< ::osl::Mutex,
189 ::osl::GetGlobalMutex >::create(SingletonLockInit(), ::osl::GetGlobalMutex());
193template<
class SingletonClass >
194SingletonClass* SingletonRef< SingletonClass >::m_pInstance = NULL;
196template<
class SingletonClass >
197sal_Int32 SingletonRef< SingletonClass >::m_nRef = 0;
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition types.h:396
Provides simple diagnostic support.
#define OSL_ENSURE(c, m)
If cond is false, reports an error with message msg.
Definition diagnose.h:87
Guard< Mutex > MutexGuard
Definition mutex.hxx:273
Definition condition.hxx:34
template for implementing singleton classes.
Definition singletonref.hxx:74
SingletonClass * operator->() const
Allows rSingle->someBodyOp().
Definition singletonref.hxx:144
~SingletonRef()
standard dtor.
Definition singletonref.hxx:122
SingletonRef()
standard ctor.
Definition singletonref.hxx:99
SingletonClass & operator*() const
Allows (*rSingle).someBodyOp().
Definition singletonref.hxx:155
A mutual exclusion synchronization object.
Definition mutex.hxx:35