GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TSingleton< T > Class Template Reference

Detailed Description

template<class T>
class TSingleton< T >

This class is intended as a base class for singletons, especially those that are written to file. The Get() function is written such that it reads the class from file if needed. This is the case if it hasn't been read yet, or if the gDirectory has been changed. This means in a loop over different input files, Get() will always return the info of the current file.

Definition at line 31 of file TSingleton.h.

Static Public Member Functions

static T * AddCurrent ()
 
static T * Get (bool verbose=false)
 
static T * GetAll ()
 
static void PrintDirectory ()
 
static void Set (T *val)
 

Protected Member Functions

 TSingleton ()=default
 
 TSingleton (const TSingleton &)=default
 
 TSingleton (TSingleton &&) noexcept=default
 
 ~TSingleton ()=default
 
TSingletonoperator= (const TSingleton &)=default
 
TSingletonoperator= (TSingleton &&) noexcept=default
 

Static Private Attributes

static TDirectory * fDir = nullptr
 
static T * fSingleton = nullptr
 
+ Inheritance diagram for TSingleton< T >:
+ Collaboration diagram for TSingleton< T >:

Constructor & Destructor Documentation

◆ TSingleton() [1/3]

template<class T >
TSingleton< T >::TSingleton ( )
protecteddefault

◆ TSingleton() [2/3]

template<class T >
TSingleton< T >::TSingleton ( const TSingleton< T > & )
protecteddefault

◆ TSingleton() [3/3]

template<class T >
TSingleton< T >::TSingleton ( TSingleton< T > && )
protecteddefaultnoexcept

◆ ~TSingleton()

template<class T >
TSingleton< T >::~TSingleton ( )
protecteddefault

Member Function Documentation

◆ AddCurrent()

template<class T >
static T * TSingleton< T >::AddCurrent ( )
inlinestatic

◆ Get()

template<class T >
static T * TSingleton< T >::Get ( bool verbose = false)
inlinestatic

◆ GetAll()

template<class T >
static T * TSingleton< T >::GetAll ( )
inlinestatic

◆ operator=() [1/2]

template<class T >
TSingleton & TSingleton< T >::operator= ( const TSingleton< T > & )
protecteddefault

◆ operator=() [2/2]

template<class T >
TSingleton & TSingleton< T >::operator= ( TSingleton< T > && )
protecteddefaultnoexcept

◆ PrintDirectory()

template<class T >
static void TSingleton< T >::PrintDirectory ( )
inlinestatic

Definition at line 171 of file TSingleton.h.

References TSingleton< T >::fDir, and TSingleton< T >::fSingleton.

Referenced by TRunInfo::Print().

◆ Set()

template<class T >
static void TSingleton< T >::Set ( T * val)
inlinestatic

Definition at line 133 of file TSingleton.h.

References TSingleton< T >::fSingleton.

Referenced by TSingleton< T >::Get().