24 #ifndef INCLUDED_RTL_INSTANCE_HXX 25 #define INCLUDED_RTL_INSTANCE_HXX 269 template<
typename Inst,
typename InstCtor,
270 typename Guard,
typename GuardCtor,
271 typename Data = int,
typename DataCtor =
int >
275 static Inst * create(InstCtor aInstCtor, GuardCtor aGuardCtor)
278 static Inst * m_pInstance = NULL;
280 Inst * p = m_pInstance;
283 Guard aGuard(aGuardCtor());
299 static Inst * create(InstCtor aInstCtor, GuardCtor aGuardCtor,
303 static Inst * m_pInstance = NULL;
305 Inst * p = m_pInstance;
308 Data aData(aDataCtor());
309 Guard aGuard(aGuardCtor());
313 p = aInstCtor(aData);
325 static Inst * create(InstCtor aInstCtor, GuardCtor aGuardCtor,
329 static Inst * m_pInstance = 0;
331 Inst * p = m_pInstance;
334 Guard aGuard(aGuardCtor());
338 p = aInstCtor(rData);
351 #if !defined _MSC_VER 352 static Inst * m_pInstance;
356 #if !defined _MSC_VER 357 template<
typename Inst,
typename InstCtor,
358 typename Guard,
typename GuardCtor,
359 typename Data,
typename DataCtor >
361 rtl_Instance< Inst, InstCtor, Guard, GuardCtor, Data, DataCtor >::m_pInstance
388 #if defined LIBO_INTERNAL_ONLY 389 template<
typename T,
typename Unique>
404 template<
typename T,
typename Unique>
414 return *rtl_Instance<
420 struct StaticInstance {
448 #if defined LIBO_INTERNAL_ONLY 449 template<
typename T,
typename Data,
typename Unique>
450 class StaticWithArg {
458 static T &
get(
const Data& rData) {
459 static T instance(rData);
469 static T &
get(Data& rData) {
470 static T instance(rData);
475 template<
typename T,
typename Data,
typename Unique>
484 static T &
get(
const Data& rData) {
485 return *rtl_Instance<
486 T, StaticInstanceWithArg,
488 Data >::create( StaticInstanceWithArg(),
499 static T &
get(Data& rData) {
500 return *rtl_Instance<
501 T, StaticInstanceWithArg,
503 Data >::create( StaticInstanceWithArg(),
508 struct StaticInstanceWithArg {
509 T * operator () (
const Data& rData) {
510 static T instance(rData);
514 T * operator () (Data& rData) {
515 static T instance(rData);
530 #if defined LIBO_INTERNAL_ONLY 531 template<
typename T,
typename InitAggregate>
532 class StaticAggregate {
542 static T *instance = InitAggregate()();
547 template<
typename T,
typename InitAggregate>
595 #if defined LIBO_INTERNAL_ONLY 596 template<
typename T,
typename InitData,
597 typename Unique = InitData,
typename Data = T>
598 class StaticWithInit {
607 static T instance = InitData()();
612 template<
typename T,
typename InitData,
613 typename Unique = InitData,
typename Data = T>
623 return *rtl_Instance<
624 T, StaticInstanceWithInit,
626 Data, InitData >::create( StaticInstanceWithInit(),
631 struct StaticInstanceWithInit {
632 T * operator () ( Data d ) {
633 static T instance(d);
641 #endif // INCLUDED_RTL_INSTANCE_HXX Helper base class for a late-initialized (default-constructed) static variable, implementing the doub...
Definition: instance.hxx:405
#define OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER()
A platform specific macro needed to make double-checked locking work.
Definition: doublecheckedlocking.h:73
Helper base class for a late-initialized static variable, implementing the double-checked locking pat...
Definition: instance.hxx:614
Helper base class for a late-initialized (default-constructed) static variable, implementing the doub...
Definition: instance.hxx:476
A helper functor for the rtl_Instance template.
Definition: getglobalmutex.hxx:35
Guard< Mutex > MutexGuard
Definition: mutex.hxx:255
Helper class for a late-initialized static aggregate, e.g.
Definition: instance.hxx:548
Definition: bootstrap.hxx:33