20 #ifndef INCLUDED_SALHELPER_SINGLETONREF_HXX
21 #define INCLUDED_SALHELPER_SINGLETONREF_HXX
64 template<
class SingletonClass >
73 static SingletonClass* m_pInstance;
76 static sal_Int32 m_nRef;
101 m_pInstance =
new SingletonClass();
103 OSL_ENSURE(m_nRef>0 && m_pInstance,
"Race? Ref count of singleton >0, but instance is NULL!");
169 struct SingletonLockInit
173 static ::osl::Mutex aInstance;
187 template<
class SingletonClass >
188 SingletonClass* SingletonRef< SingletonClass >::m_pInstance = 0;
190 template<
class SingletonClass >
191 sal_Int32 SingletonRef< SingletonClass >::m_nRef = 0;
195 #endif // INCLUDED_SALHELPER_SINGLETONREF_HXX
SingletonClass & operator*() const
Allows (*rSingle).someBodyOp().
Definition: singletonref.hxx:148
A helper class for mutex objects and interfaces.
Definition: mutex.hxx:123
SingletonRef()
standard ctor.
Definition: singletonref.hxx:92
#define OSL_ENSURE(c, m)
Definition: diagnose.h:154
template for implementing singleton classes.
Definition: singletonref.hxx:65
A helper functor for the rtl_Instance template.
Definition: getglobalmutex.hxx:31
A mutual exclusion synchronization object.
Definition: mutex.hxx:32
~SingletonRef()
standard dtor.
Definition: singletonref.hxx:116
SingletonClass * operator->() const
Allows rSingle->someBodyOp().
Definition: singletonref.hxx:136
Guard< Mutex > MutexGuard
Definition: mutex.hxx:238