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

#include <G4ThreadLocalSingleton.hh>

+ Inheritance diagram for G4ThreadLocalSingleton< T >:

Public Member Functions

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

Friends

void G4AutoDelete::Register (T *)
 

Detailed Description

template<class T>
class G4ThreadLocalSingleton< T >

Definition at line 145 of file G4ThreadLocalSingleton.hh.

Constructor & Destructor Documentation

◆ G4ThreadLocalSingleton() [1/3]

Definition at line 178 of file G4ThreadLocalSingleton.hh.

179 : G4Cache<T*>()
180{
181 G4MUTEXINIT(listm);
182 G4Cache<T*>::Put(nullptr);
183 // Uncomment below to find the origin of where instantiation happened
184 /*
185 auto bt = G4Backtrace::GetDemangled<4, 1>(
186 [](const char* cstr) { return std::string{ cstr }; });
187 std::cout << "Backtrace to G4ThreadLocalSingleton<"
188 << G4Demangle<T>().c_str() << ">:\n";
189 for(auto& itr : bt)
190 {
191 if(!itr.empty())
192 std::cout << "\t" << itr << "\n";
193 }
194 */
196 // printf("Deleting G4ThreadLocalSingletons for type %s ...\n",
197 // G4Demangle<T>().c_str());
198 this->Clear();
199 });
200}
#define G4MUTEXINIT(mutex)
void Put(const value_type &val) const
Definition G4Cache.hh:321

◆ ~G4ThreadLocalSingleton()

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

Definition at line 203 of file G4ThreadLocalSingleton.hh.

204{
205 Clear();
206 G4MUTEXDESTROY(listm);
207}
#define G4MUTEXDESTROY(mutex)

◆ G4ThreadLocalSingleton() [2/3]

template<class T >
G4ThreadLocalSingleton< T >::G4ThreadLocalSingleton ( const G4ThreadLocalSingleton< T > & )
delete

◆ G4ThreadLocalSingleton() [3/3]

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

Member Function Documentation

◆ Instance()

◆ operator=() [1/2]

template<class T >
G4ThreadLocalSingleton & G4ThreadLocalSingleton< T >::operator= ( const G4ThreadLocalSingleton< T > & )
delete

◆ operator=() [2/2]

template<class T >
G4ThreadLocalSingleton & G4ThreadLocalSingleton< T >::operator= ( G4ThreadLocalSingleton< T > && )
default

Friends And Related Symbol Documentation

◆ G4AutoDelete::Register

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

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