Diana Software
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
GlobalHandle< Q > Class Template Reference

template class to handle diana global QObject with QGlobalDataManager More...

Public Member Functions

 GlobalHandle (const std::string &name, const std::string &defaultOwner="")
 ctor More...
 
 GlobalHandle (const GlobalHandle< Q > &other)
 copy ctor More...
 
virtual ~GlobalHandle ()
 dtor More...
 
const QGlobalLabelGetLabel () const
 Get label. More...
 
const std::string & GetName () const
 Get object name. More...
 
const std::string & GetOwner () const
 Get object owner. More...
 
const std::string & GetDefaultOwner () const
 Get default owner (may be set by inheriting classes) More...
 
int GetChannel () const
 Get Channel associated to the object. More...
 
int GetChannel2 () const
 Get Second Channel associated to the object. More...
 
int GetBeginRun () const
 Get first run of validity. More...
 
int GetEndRun () const
 Get last run of validity. More...
 
int GetRun () const
 Get run of validity. More...
 
int GetBeginDataset () const
 Get first dataset of validity. More...
 
int GetEndDataset () const
 Get last dataset of validity. More...
 
int GetDataset () const
 Get dataset of validity. More...
 
void GetValidityInterval (int &beginRun, int &endRun) const
 Get run validity interval. More...
 
void SetChannel (const int chan)
 Set Channel. More...
 
void SetChannel2 (const int chan)
 Set Channel2. More...
 
void SetRunInterval (const int start, const int end)
 Set Validity Interval. More...
 
void SetRun (const int run)
 Set BeginRun = EndRun = run. More...
 
void SetDatasetInterval (const int start, const int end)
 Set Dataset Validity Interval. More...
 
void SetDataset (const int ds)
 Set dataset of validity. More...
 
void AddKey (const std::string &key, const int digits)
 Add an extra integer key to the label. More...
 
void SetKey (const std::string &key, const int value)
 Set extra integer key to value. More...
 
int GetKey (const std::string &key) const
 Get extra integer key. More...
 
bool HaveKey (const std::string &key) const
 
void Set (const Q &obj)
 set the QObject More...
 
const Q & Get () const
 get the QObject More...
 
bool IsValid () const
 check QObject validity More...
 
const QErrorGetError () const
 Get I/O error. More...
 
void SetDescription (const std::string &descr)
 set object description (experimental) More...
 
virtual QError FillFromFile (const std::string &fname)
 fill QObject from file fname More...
 
virtual QError StoreOnFile (const std::string &fname) const
 store object on file fname More...
 
virtual QError FillFromDB ()
 fill object from DB More...
 
virtual QError StoreOnDB () const
 store object on DB More...
 
virtual QError StoreOnDB ()
 store object on DB, non const version More...
 
std::string GetVersion () const
 Get version tag of the object, if any. More...
 

Protected Member Functions

Q ** GetAddress ()
 get object address More...
 
Q **const GetAddress () const
 get object address (const) More...
 
void CreateObject ()
 instantiate object of type Q More...
 

Private Member Functions

void SetOwner (const std::string &owner)
 set object owner More...
 
 GlobalHandle ()
 default ctor. Needed to compile on gcc3 More...
 
const GlobalHandle< Q > & operator= (const GlobalHandle< Q > &other)
 operator= must not be used, use copy ctor More...
 
void SetVersion (const std::string &tag)
 set version tag of the object to be read (used by QGlobalDataManager) More...
 

Private Attributes

Q * fObject
 Object. More...
 
Q * fMyObject
 Object created by this class. More...
 
QGlobalLabel fLabel
 unique identifier of the object More...
 
std::string fVersion
 Version of the QObject to be read / written. More...
 
std::string fDefaultOwner
 Default owner of the QObject. More...
 
QError fGlobalDataManagerError
 I/O error from the QGlobalDataManager. More...
 
std::string fDescription
 Object description. More...
 

Friends

class QGlobalDataManager
 

Detailed Description

template<class Q>
class GlobalHandle< Q >

template class to handle diana global QObject with QGlobalDataManager

Author
Marco Vignati

GlobalHandle is the access class to the QObject's handled by the QGlobalDataManger. It stores all the ancillary data necessary to save or get a global QObject. Each global QObject can be retrived or stored only if handled by this class. A GlobalHandle<Type> object stores only one object, and can be passed to the QGlobalDataManager only once. Ancillary data are all optional and can be:

File I/O is provided by this class, using the QGlobalReaderDispatcher / QGlobalWriterDispatcher classes. Inheriting classes implement DB I/O interfaces for specific QObject s. Examples of inheriting classes are QAveragePulseHandle, or QRunDataHandle in pkg/dianaglobalhandle. When adding new handles remember to update the LinkDef.hh file and RootCintIncludes.hh files in the pkg/dianaglobalhandle package.

Examples
GlobalDataManagerExample.C, MTutorialAveragePulse.cc, and MTutorialPulseShape.cc.

Definition at line 40 of file QGlobalHandle.hh.

Constructor & Destructor Documentation

◆ GlobalHandle() [1/3]

template<class Q >
GlobalHandle< Q >::GlobalHandle ( const std::string &  name,
const std::string &  defaultOwner = "" 
)
inline

◆ GlobalHandle() [2/3]

template<class Q >
GlobalHandle< Q >::GlobalHandle ( const GlobalHandle< Q > &  other)
inline

◆ ~GlobalHandle()

template<class Q >
virtual GlobalHandle< Q >::~GlobalHandle ( )
inlinevirtual

dtor

Definition at line 78 of file QGlobalHandle.hh.

References GlobalHandle< Q >::fMyObject.

◆ GlobalHandle() [3/3]

template<class Q >
GlobalHandle< Q >::GlobalHandle ( )
inlineprivate

default ctor. Needed to compile on gcc3

Definition at line 337 of file QGlobalHandle.hh.

Member Function Documentation

◆ AddKey()

template<class Q >
void GlobalHandle< Q >::AddKey ( const std::string &  key,
const int  digits 
)
inline

Add an extra integer key to the label.

Definition at line 128 of file QGlobalHandle.hh.

References QGlobalLabel::ExtraKey::Clear(), QGlobalLabel::ExtraKey::fDigits, QGlobalLabel::fExtraKeys, and GlobalHandle< Q >::fLabel.

◆ CreateObject()

template<class Q >
void GlobalHandle< Q >::CreateObject ( )
inlineprotected

◆ FillFromDB()

template<class Q >
virtual QError GlobalHandle< Q >::FillFromDB ( )
inlinevirtual

◆ FillFromFile()

template<class Q >
virtual QError GlobalHandle< Q >::FillFromFile ( const std::string &  fname)
inlinevirtual

◆ Get()

template<class Q >
const Q& GlobalHandle< Q >::Get ( ) const
inline

◆ GetAddress() [1/2]

template<class Q >
Q** GlobalHandle< Q >::GetAddress ( )
inlineprotected

get object address

Definition at line 310 of file QGlobalHandle.hh.

References GlobalHandle< Q >::fObject.

Referenced by QGlobalDataManager::Get(), and QGlobalDataManager::Set().

◆ GetAddress() [2/2]

template<class Q >
Q** const GlobalHandle< Q >::GetAddress ( ) const
inlineprotected

get object address (const)

Definition at line 313 of file QGlobalHandle.hh.

References GlobalHandle< Q >::fObject.

◆ GetBeginDataset()

template<class Q >
int GlobalHandle< Q >::GetBeginDataset ( ) const
inline

Get first dataset of validity.

Definition at line 102 of file QGlobalHandle.hh.

References QGlobalLabel::fBeginDataset, and GlobalHandle< Q >::fLabel.

◆ GetBeginRun()

template<class Q >
int GlobalHandle< Q >::GetBeginRun ( ) const
inline

Get first run of validity.

Definition at line 96 of file QGlobalHandle.hh.

References QGlobalLabel::fBeginRun, and GlobalHandle< Q >::fLabel.

◆ GetChannel()

template<class Q >
int GlobalHandle< Q >::GetChannel ( ) const
inline

Get Channel associated to the object.

Definition at line 92 of file QGlobalHandle.hh.

References QGlobalLabel::fChannel, and GlobalHandle< Q >::fLabel.

◆ GetChannel2()

template<class Q >
int GlobalHandle< Q >::GetChannel2 ( ) const
inline

Get Second Channel associated to the object.

Definition at line 94 of file QGlobalHandle.hh.

References QGlobalLabel::fChannel2, and GlobalHandle< Q >::fLabel.

◆ GetDataset()

template<class Q >
int GlobalHandle< Q >::GetDataset ( ) const
inline

Get dataset of validity.

Definition at line 106 of file QGlobalHandle.hh.

References QGlobalLabel::fBeginDataset, and GlobalHandle< Q >::fLabel.

◆ GetDefaultOwner()

template<class Q >
const std::string& GlobalHandle< Q >::GetDefaultOwner ( ) const
inline

Get default owner (may be set by inheriting classes)

Definition at line 90 of file QGlobalHandle.hh.

References GlobalHandle< Q >::fDefaultOwner.

Referenced by QGlobalDataManager::Get().

◆ GetEndDataset()

template<class Q >
int GlobalHandle< Q >::GetEndDataset ( ) const
inline

Get last dataset of validity.

Definition at line 104 of file QGlobalHandle.hh.

References QGlobalLabel::fEndDataset, and GlobalHandle< Q >::fLabel.

◆ GetEndRun()

template<class Q >
int GlobalHandle< Q >::GetEndRun ( ) const
inline

Get last run of validity.

Definition at line 98 of file QGlobalHandle.hh.

References QGlobalLabel::fEndRun, and GlobalHandle< Q >::fLabel.

◆ GetError()

template<class Q >
const QError& GlobalHandle< Q >::GetError ( ) const
inline

Get I/O error.

Definition at line 196 of file QGlobalHandle.hh.

References GlobalHandle< Q >::fGlobalDataManagerError.

Referenced by QSequence::SaveConfig().

◆ GetKey()

template<class Q >
int GlobalHandle< Q >::GetKey ( const std::string &  key) const
inline

◆ GetLabel()

template<class Q >
const QGlobalLabel& GlobalHandle< Q >::GetLabel ( ) const
inline

Get label.

Definition at line 84 of file QGlobalHandle.hh.

References GlobalHandle< Q >::fLabel.

Referenced by QGlobalDataManager::Get(), and QGlobalDataManager::Set().

◆ GetName()

template<class Q >
const std::string& GlobalHandle< Q >::GetName ( ) const
inline

◆ GetOwner()

template<class Q >
const std::string& GlobalHandle< Q >::GetOwner ( ) const
inline

◆ GetRun()

template<class Q >
int GlobalHandle< Q >::GetRun ( ) const
inline

Get run of validity.

Definition at line 100 of file QGlobalHandle.hh.

References QGlobalLabel::fBeginRun, and GlobalHandle< Q >::fLabel.

◆ GetValidityInterval()

template<class Q >
void GlobalHandle< Q >::GetValidityInterval ( int &  beginRun,
int &  endRun 
) const
inline

Get run validity interval.

Definition at line 108 of file QGlobalHandle.hh.

References QGlobalLabel::fBeginRun, QGlobalLabel::fEndRun, and GlobalHandle< Q >::fLabel.

◆ GetVersion()

template<class Q >
std::string GlobalHandle< Q >::GetVersion ( ) const
inline

Get version tag of the object, if any.

Definition at line 304 of file QGlobalHandle.hh.

References GlobalHandle< Q >::fVersion.

Referenced by QGlobalDataManager::Get(), and QGlobalDataManager::Set().

◆ HaveKey()

template<class Q >
bool GlobalHandle< Q >::HaveKey ( const std::string &  key) const
inline

Definition at line 163 of file QGlobalHandle.hh.

References QGlobalLabel::fExtraKeys, and GlobalHandle< Q >::fLabel.

◆ IsValid()

template<class Q >
bool GlobalHandle< Q >::IsValid ( ) const
inline

◆ operator=()

template<class Q >
const GlobalHandle<Q>& GlobalHandle< Q >::operator= ( const GlobalHandle< Q > &  other)
inlineprivate

operator= must not be used, use copy ctor

Definition at line 339 of file QGlobalHandle.hh.

◆ Set()

template<class Q >
void GlobalHandle< Q >::Set ( const Q &  obj)
inline

◆ SetChannel()

template<class Q >
void GlobalHandle< Q >::SetChannel ( const int  chan)
inline

Set Channel.

Definition at line 114 of file QGlobalHandle.hh.

References QGlobalLabel::fChannel, and GlobalHandle< Q >::fLabel.

◆ SetChannel2()

template<class Q >
void GlobalHandle< Q >::SetChannel2 ( const int  chan)
inline

Set Channel2.

Definition at line 116 of file QGlobalHandle.hh.

References QGlobalLabel::fChannel2, and GlobalHandle< Q >::fLabel.

◆ SetDataset()

template<class Q >
void GlobalHandle< Q >::SetDataset ( const int  ds)
inline

Set dataset of validity.

Definition at line 125 of file QGlobalHandle.hh.

References QGlobalLabel::fBeginDataset, QGlobalLabel::fEndDataset, and GlobalHandle< Q >::fLabel.

◆ SetDatasetInterval()

template<class Q >
void GlobalHandle< Q >::SetDatasetInterval ( const int  start,
const int  end 
)
inline

Set Dataset Validity Interval.

Definition at line 123 of file QGlobalHandle.hh.

References QGlobalLabel::fBeginDataset, QGlobalLabel::fEndDataset, and GlobalHandle< Q >::fLabel.

◆ SetDescription()

template<class Q >
void GlobalHandle< Q >::SetDescription ( const std::string &  descr)
inline

set object description (experimental)

Definition at line 199 of file QGlobalHandle.hh.

References GlobalHandle< Q >::fDescription.

◆ SetKey()

template<class Q >
void GlobalHandle< Q >::SetKey ( const std::string &  key,
const int  value 
)
inline

Set extra integer key to value.

Definition at line 135 of file QGlobalHandle.hh.

References Demangle(), DianaThrow, QGlobalLabel::fExtraKeys, GlobalHandle< Q >::fLabel, GlobalHandle< Q >::fObject, and QERR_GLOBAL_HANDLE.

◆ SetOwner()

template<class Q >
void GlobalHandle< Q >::SetOwner ( const std::string &  owner)
inlineprivate

set object owner

Definition at line 335 of file QGlobalHandle.hh.

References GlobalHandle< Q >::fLabel, and QGlobalLabel::fOwner.

Referenced by QGlobalDataManager::Get(), and QGlobalDataManager::Set().

◆ SetRun()

template<class Q >
void GlobalHandle< Q >::SetRun ( const int  run)
inline

Set BeginRun = EndRun = run.

Definition at line 120 of file QGlobalHandle.hh.

References QGlobalLabel::fBeginRun, QGlobalLabel::fEndRun, and GlobalHandle< Q >::fLabel.

◆ SetRunInterval()

template<class Q >
void GlobalHandle< Q >::SetRunInterval ( const int  start,
const int  end 
)
inline

Set Validity Interval.

Definition at line 118 of file QGlobalHandle.hh.

References QGlobalLabel::fBeginRun, QGlobalLabel::fEndRun, and GlobalHandle< Q >::fLabel.

◆ SetVersion()

template<class Q >
void GlobalHandle< Q >::SetVersion ( const std::string &  tag)
inlineprivate

set version tag of the object to be read (used by QGlobalDataManager)

Definition at line 342 of file QGlobalHandle.hh.

References GlobalHandle< Q >::fVersion.

Referenced by QGlobalDataManager::Get(), and QGlobalDataManager::Set().

◆ StoreOnDB() [1/2]

template<class Q >
virtual QError GlobalHandle< Q >::StoreOnDB ( )
inlinevirtual

store object on DB, non const version

Definition at line 298 of file QGlobalHandle.hh.

References GlobalHandle< Q >::StoreOnDB().

◆ StoreOnDB() [2/2]

template<class Q >
virtual QError GlobalHandle< Q >::StoreOnDB ( ) const
inlinevirtual

◆ StoreOnFile()

template<class Q >
virtual QError GlobalHandle< Q >::StoreOnFile ( const std::string &  fname) const
inlinevirtual

Friends And Related Function Documentation

◆ QGlobalDataManager

template<class Q >
friend class QGlobalDataManager
friend

Definition at line 360 of file QGlobalHandle.hh.

Member Data Documentation

◆ fDefaultOwner

template<class Q >
std::string GlobalHandle< Q >::fDefaultOwner
private

Default owner of the QObject.

Definition at line 354 of file QGlobalHandle.hh.

Referenced by GlobalHandle< Q >::GetDefaultOwner(), and GlobalHandle< Q >::GlobalHandle().

◆ fDescription

template<class Q >
std::string GlobalHandle< Q >::fDescription
private

◆ fGlobalDataManagerError

template<class Q >
QError GlobalHandle< Q >::fGlobalDataManagerError
private

◆ fLabel

template<class Q >
QGlobalLabel GlobalHandle< Q >::fLabel
private

◆ fMyObject

template<class Q >
Q* GlobalHandle< Q >::fMyObject
private

Object created by this class.

Definition at line 346 of file QGlobalHandle.hh.

Referenced by GlobalHandle< Q >::CreateObject(), GlobalHandle< Q >::GlobalHandle(), and GlobalHandle< Q >::~GlobalHandle().

◆ fObject

template<class Q >
Q* GlobalHandle< Q >::fObject
private

◆ fVersion

template<class Q >
std::string GlobalHandle< Q >::fVersion
private

Version of the QObject to be read / written.

Definition at line 352 of file QGlobalHandle.hh.

Referenced by GlobalHandle< Q >::GetVersion(), GlobalHandle< Q >::GlobalHandle(), and GlobalHandle< Q >::SetVersion().


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