Package rosetta :: Package basic :: Package datacache :: Module _basic_datacache_ :: Class SingletonBase_T_basic_datacache_WriteableCacheableDataFactory_T
[hide private]
[frames] | no frames]

Class SingletonBase_T_basic_datacache_WriteableCacheableDataFactory_T

 object --+    
          |    
??.instance --+
              |
             SingletonBase_T_basic_datacache_WriteableCacheableDataFactory_T
Known Subclasses:

SingletonBase is meant to serve as a base class for singleton classes in Rosetta handling the initialization of the singleton in a thread-safe way. The derived class must a) implement a private, static function: T * create_singleton_instance() so that the SingletonBase class can invoke this function, and b) declare the SingletonBase class to be a friend, so that it can invoke this function The .cc file in which the derived singleton must be put will need to include the definitions for the two static data members, instance_ and singleton_mutex_.

Instance Methods [hide private]
 
__init__(...)
__init__( (object)arg1) -> None :
 
__reduce__(...)
helper for pickle

Inherited from unreachable.instance: __new__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
WriteableCacheableDataFactory :
get_instance()
Safely instantiate a singleton class in a (possibly) multithreaded context.
Class Variables [hide private]
  __instance_size__ = 32
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(...)
(Constructor)

 

__init__( (object)arg1) -> None :

    C++ signature :
        void __init__(_object*)

Overrides: object.__init__

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

get_instance()
Static Method

 
    Safely instantiate a singleton class in a (possibly)
    multithreaded context.
    In the non-multithreaded case, this simply checks the
    singleton's instance member; in the multithreaded case, it
    checks the instance member, then it obtains the singleton's
    instance-creation mutex, then it checks the instance member
    again, to ensure that no other thread has already created the
    instance, it creates the instance, and then it releases the mutex.
    

    C++ signature :
        basic::datacache::WriteableCacheableDataFactory* get_instance()

Returns: WriteableCacheableDataFactory :