Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ThreadLocalSingleton< T > Class Template Reference

#include <G4ThreadLocalSingleton.hh>

Inheritance diagram for G4ThreadLocalSingleton< T >:
Collaboration diagram for G4ThreadLocalSingleton< T >:

Public Member Functions

 G4ThreadLocalSingleton ()
 
 ~G4ThreadLocalSingleton ()
 
T * Instance () const
 

Friends

void G4AutoDelete::Register (T *)
 

Detailed Description

template<class T>
class G4ThreadLocalSingleton< T >

Definition at line 108 of file G4ThreadLocalSingleton.hh.

Constructor & Destructor Documentation

template<class T >
G4ThreadLocalSingleton< T >::G4ThreadLocalSingleton ( )

Definition at line 135 of file G4ThreadLocalSingleton.hh.

135  : G4Cache<T*>() {
136  G4MUTEXINIT(listm);
137  G4Cache<T*>::Put(static_cast<T*>(0));
138 }
#define G4MUTEXINIT(mutex)
Definition: G4Threading.hh:177
void Put(const value_type &val) const
Definition: G4Cache.hh:286

Here is the call graph for this function:

template<class T >
G4ThreadLocalSingleton< T >::~G4ThreadLocalSingleton ( )

Definition at line 141 of file G4ThreadLocalSingleton.hh.

141  {
142  G4MUTEXDESTROY(listm);
143  Clear();
144 }
#define G4MUTEXDESTROY(mutex)
Definition: G4Threading.hh:178

Here is the call graph for this function:

Member Function Documentation

template<class T >
T * G4ThreadLocalSingleton< T >::Instance ( void  ) const

Definition at line 147 of file G4ThreadLocalSingleton.hh.

147  {
148  T* instance = G4Cache<T*>::Get();
149  if ( instance == static_cast<T*>(0) ) {
150  instance = new T;
151  G4Cache<T*>::Put( instance );
152  Register(instance);
153  }
154  return instance;
155  }
value_type & Get() const
Definition: G4Cache.hh:282
static MCTruthManager * instance
void Put(const value_type &val) const
Definition: G4Cache.hh:286

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

template<class T>
void G4AutoDelete::Register ( T *  )
friend

The documentation for this class was generated from the following file: