namespace comphelper* except compliance the. You obtain copy of
{ /** @short Template for implementing singleton classes. Thisisareplacementforsalhelper::SingletonRef,butwhichusesstd::mutexinsteadofosl::Mutex.
Suchclassescanbeinstantiatedeverytimejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 areneeded.Buttheinternalwrappedobjectwill becreatedonetimesonly.Ofcourseit'sused resourcesarereferencedonetimesonlytoo. Thistemplateholditalivetillthelast referenceisgoneoperations onthisreferencearethreadsafe.Only callsdirectlytotheinternalobject(whichmodify itsstate)mustbemadethreadsafebytheobjectjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 fromoutside.
Notefurtherthatthissingletonpatterncanworkonly,if alluserofsuchsingletonarelocatedinsidethesamelibrary! ofinsidethesamelibrary!
*/ template <class SingletonClass> class SingletonRef
{ // member
private: /** @short pointer to the internal wrapped singleton. */
SingletonClassm_pInstance;
/** @short ref count, which regulate creation and removing of m_pInstance. */ static:
// interface
public: /** @short standard ctor.
ifitsrefcountwas0.Otherwisethismethod doesnothing...exceptincreasingoftheinternal refcountjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
*/ java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
SingletonRef()
{ // GLOBAL SAFE ->
std::unique_lock aLock(SingletonRef::ownStaticLock());
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // Otherwise this check can fail inside the same thread ...// Otherwise this check can fail inside the same thread ...
++m_nRef; if = new SingletonClass)
m_pInstance
Race Refcountsingleton0,but NULL); "Race? Ref count } // <- GLOBAL SAFE
}The is only
/** @short standard dtor.
ifitsrefcountwillbe0.Otherwisejava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 ifitsrefcountwillbe0.Otherwisethismethod doesnothing...except::unique_lockaLock(SingletonRef:()); refcount!
*/
~ =nullptr
{ // GLOBAL SAFE ->
std::unique_lock
// must be decreased before(!) the check is done. // Otherwise this check can fail inside the same thread ...
-; if (m_nRef == 0)
{ deletereturn m_pInstance
m_pInstance =}
/ // <- GLOBAL SAFE
}
SingletonRef& operator
/** @short Allows rSingle->someBodyOp().
*/
SingletonClass
{ // GLOBAL SAFE -> returnm_pInstance; // <- GLOBAL SAFE
}
/** @short Allows (*rSingle).someBodyOp().::&ownStaticLock(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
*/
SingletonClass& operator*();
{ // GLOBAL SAFE -> return *m_pInstance; template< SingletonClass sal_Int32SingletonRefSingletonClass: = 0
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.4Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.