Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ThreadLocalSingleton< void > Class Reference

#include <G4ThreadLocalSingleton.hh>

Inheritance diagram for G4ThreadLocalSingleton< void >:

Public Member Functions

 ~G4ThreadLocalSingleton () override
G4ThreadLocalSingletonoperator= (const G4ThreadLocalSingleton &)=delete
void * Instance () const

Static Public Member Functions

static void Clear ()
template<typename FuncT>
static fvector_t::iterator Insert (FuncT &&_func)

Friends

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

Detailed Description

Definition at line 120 of file G4ThreadLocalSingleton.hh.

Constructor & Destructor Documentation

◆ ~G4ThreadLocalSingleton()

Definition at line 152 of file G4ThreadLocalSingleton.hh.

189{
190 Clear();
191 G4MUTEXDESTROY(listm);
192}
#define G4MUTEXDESTROY(mutex)

Member Function Documentation

◆ Clear()

void G4ThreadLocalSingleton< void >::Clear ( )
static

Definition at line 45 of file G4ThreadLocalSingleton.cc.

46{
47 G4AutoLock _lk{ GetMutex() };
48 for(const auto& itr : GetCallbacks())
49 {
50 itr();
51 }
52 GetCallbacks().clear();
53}

Referenced by G4ThreadLocalSingleton, and Instance().

◆ Insert()

template<typename FuncT>
fvector_t::iterator G4ThreadLocalSingleton< void >::Insert ( FuncT && _func)
inlinestatic

Definition at line 135 of file G4ThreadLocalSingleton.hh.

136 {
137 G4AutoLock _lk{ GetMutex() };
138 return GetCallbacks().emplace(GetCallbacks().end(),
140 }

◆ Instance()

void * G4ThreadLocalSingleton< void >::Instance ( ) const

Definition at line 160 of file G4ThreadLocalSingleton.hh.

196{
198 if(instance == static_cast<T*>(0))
199 {
200 instance = new T;
203 }
204 return instance;
205}
value_type & Get() const
Definition G4Cache.hh:315
void Put(const value_type &val) const
Definition G4Cache.hh:321
friend void G4AutoDelete::Register(void *)

◆ operator=()

G4ThreadLocalSingleton & G4ThreadLocalSingleton< void >::operator= ( const G4ThreadLocalSingleton< void > & )
delete

◆ G4AutoDelete::Register

void G4AutoDelete::Register ( void * )
friend

◆ G4ThreadLocalSingleton

template<class T>
friend class G4ThreadLocalSingleton
friend

Definition at line 126 of file G4ThreadLocalSingleton.hh.

Referenced by G4ThreadLocalSingleton.


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