emcObjectManager Class Reference
[DataManagerInterfaces]

#include <emcObjectManager.h>

Inherits emcNamed.

Inherited by emcOMAsciiT< T >, emcOMCalFEM, emcOMCalibrationDataIniCal, emcOMCalibrationDataT< BM >, emcOMCalibrationDataTofSectorOffset, emcOMFEMtupleT< BM, FT >, emcOMGeometryT< BM >, emcOMIniCalConstruction, emcOMRejectList, emcOMRejectListT< BM >, and emcOMTimeStamp.

Inheritance diagram for emcObjectManager:

Inheritance graph
[legend]
List of all members.

Detailed Description

(ABC) An object manager is an emcDataManager plug-in.

An Object Manager handles objects of type emcManageable.

Object Manager typically is responsible for reading/writing objects to a database (filesystem, i.e. ascii files can sometimes be considered as a database).

How to write a plugin ?

Let's assume you are writing a plugin to handle objects of type Nut (Nut must be a subclass of emcManageable). You can of course add to an existing plugin the possibility to handle this new object type. But here, we will consider that you are writing a brand new object manager from scratch.

1. You create a new class, say emcOMNut, which must have in its hierarchy an emcObjectManager. If you want your OM to access Objy, let's derive from emcObjyObjectManager.

2. Somewhere in the source file emcOMNut.C, you must declare a (static) object of class emcOMNut, e.g. in the beginning of your .C file :

emcOMNut gMyGlobalemcOMNutObject("name","title");

3. Your emcOMNut class must announce which services it provides. If it can Read Nut objects from the DB, you must override the emcObjectManager method CanRead(emcManageable& obj) method to return true in case obj is of type Nut. Then you must override the Read method to do the actual job. Same story with Write and Collect if you need them. Even if you do nothing with them, you must override them as they are pure virtual member functions of emcObjectManager. Also the Reset method is supposed to put the plugin in the same state as if it was newly created : you must override this one also. Nothing is better than examples : have a look at the class emcOMCalFEM to see how it was done for emcCalFEM objects.

4. You make a library with your emcOMNut and Nut classes.

Whenever your library will be loaded, the DM will be aware of your ObjectManager automatically (that's the plugin mechanism!).

Author:
L. Aphecetche

Definition at line 64 of file emcObjectManager.h.

Public Member Functions

 emcObjectManager (const char *name="", const char *title="")
 default ctor.
virtual ~emcObjectManager ()
 dtor.
virtual bool CanCollect (const emcManageable &) const
virtual bool CanHandle (const emcManageable &object) const
 Can we handle (read or write or collect) a given object type ?
virtual bool CanWrite (const emcManageable &) const
 Can we write a given object type ?
virtual bool CanRead (const emcManageable &) const
 Can we read a given object type ?
virtual emcManageableCollect (const emcManageable &, const PHTimeStamp &)
virtual bool Read (emcManageable &object, const PHTimeStamp &time_stamp, int id)=0
 Read a manageable object from the DB.
virtual bool Read (emcManageable &, int)
 Read a manageable object from the DB.
virtual bool ReadPreviousVersion (emcManageable &object, const PHTimeStamp &time_stamp, int id, int=0)
 Special read method to retrieve shadowed banks.
virtual void Reset (void)=0
 Reset the OM.
virtual bool Write (const emcManageable &object, const PHTimeStamp &tStart, int id=-1)=0
 Write a manageable object to the DB.

Static Public Member Functions

static emcDataManagerDataManager (void)
 Get the DataManager instance.
static emcDataManagerDM (void)
 as above.


Constructor & Destructor Documentation

emcObjectManager::emcObjectManager const char *  name = "",
const char *  title = ""
 

default ctor.

Definition at line 9 of file emcObjectManager.C.

References emcObjectManagerRegister::AddObjectManager(), and emcObjectManagerRegister::GetInstance().

emcObjectManager::~emcObjectManager  )  [virtual]
 

dtor.

Definition at line 16 of file emcObjectManager.C.

References emcObjectManagerRegister::GetInstance(), and emcObjectManagerRegister::RemoveObjectManager().


Member Function Documentation

virtual bool emcObjectManager::CanCollect const emcManageable  )  const [inline, virtual]
 

Deprecated:
Can we collect such object ?
Returns:
false by default.

Reimplemented in emcOMCalibrationDataT< BM >, emcOMFEMtupleT< BM, FT >, emcOMGeometryT< BM >, emcOMTimeStamp, emcOMCalibrationDataIniCal, emcOMCalibrationDataTofSectorOffset, and emcOMIniCalConstruction.

Definition at line 78 of file emcObjectManager.h.

Referenced by CanHandle().

bool emcObjectManager::CanHandle const emcManageable object  )  const [virtual]
 

Can we handle (read or write or collect) a given object type ?

Definition at line 23 of file emcObjectManager.C.

References CanCollect(), CanRead(), and CanWrite().

virtual bool emcObjectManager::CanRead const emcManageable  )  const [inline, virtual]
 

Can we read a given object type ?

Returns:
false by default.

Reimplemented in emcOMCalibrationDataT< BM >, emcOMFEMtupleT< BM, FT >, emcOMGeometryT< BM >, emcOMHLRatioFEMT< T >, emcOMLCTofFEMT< T >, emcOMPedestal5FEMT< T >, emcOMPedestalFEMT< T >, emcOMQAFEMT< T >, emcOMRejectListT< BM >, emcOMTracedFEMT< T, emcTofT0FEM >, emcOMTracedFEMT< T, B >, emcOMWalkTofFEMT< T >, emcOMTimeStamp, emcOMAsciiT< T >, emcOMCalibrationDataIniCal, emcOMCalibrationDataTofSectorOffset, emcOMIniCalConstruction, and emcOMRejectList.

Definition at line 97 of file emcObjectManager.h.

Referenced by CanHandle().

virtual bool emcObjectManager::CanWrite const emcManageable  )  const [inline, virtual]
 

Can we write a given object type ?

Returns:
false by default.

Reimplemented in emcOMCalibrationDataT< BM >, emcOMFEMtupleT< BM, FT >, emcOMGeometryT< BM >, emcOMHLRatioFEMT< T >, emcOMLCTofFEMT< T >, emcOMPedestal5FEMT< T >, emcOMPedestalFEMT< T >, emcOMQAFEMT< T >, emcOMRejectListT< BM >, emcOMTracedFEMT< T, emcTofT0FEM >, emcOMTracedFEMT< T, B >, emcOMWalkTofFEMT< T >, emcOMTimeStamp, emcOMAsciiT< T >, emcOMCalibrationDataIniCal, emcOMCalibrationDataTofSectorOffset, emcOMIniCalConstruction, and emcOMRejectList.

Definition at line 89 of file emcObjectManager.h.

Referenced by CanHandle().

emcDataManager * emcObjectManager::DataManager void   )  [static]
 

Get the DataManager instance.

Definition at line 33 of file emcObjectManager.C.

References emcDataManager::GetInstance().

Referenced by DM().

static emcDataManager* emcObjectManager::DM void   )  [inline, static]
 

as above.

Definition at line 121 of file emcObjectManager.h.

References DataManager().

Referenced by emcOMRejectListT< BM >::Read(), emcOMRejectList::Read(), emcOMFEMtupleT< BM, FT >::Read(), emcOMRejectListT< BM >::Write(), emcOMRejectList::Write(), emcOMGeometryT< BM >::Write(), emcOMFEMtupleT< BM, FT >::Write(), emcOMCalibrationDataT< BM >::Write(), and emcOMCalFEMT< BM >::Write().

virtual bool emcObjectManager::Read emcManageable ,
int 
[inline, virtual]
 

Read a manageable object from the DB.

See the DM interface for parameters.

Reimplemented in emcOMTimeStamp, and emcOMCalibrationDataTofSectorOffset.

Definition at line 137 of file emcObjectManager.h.

virtual bool emcObjectManager::Read emcManageable object,
const PHTimeStamp &  time_stamp,
int  id
[pure virtual]
 

Read a manageable object from the DB.

See the DM interface for parameters.

Implemented in emcOMCalFEMT< BM >, emcOMCalibrationDataT< BM >, emcOMFEMtupleT< BM, FT >, emcOMGeometryT< BM >, emcOMRejectListT< BM >, emcOMTimeStamp, emcOMAsciiT< T >, emcOMCalibrationDataIniCal, emcOMCalibrationDataTofSectorOffset, emcOMIniCalConstruction, emcOMRejectList, and emcOMCalFEMT< T >.

Referenced by ReadPreviousVersion().

virtual bool emcObjectManager::ReadPreviousVersion emcManageable object,
const PHTimeStamp &  time_stamp,
int  id,
int  = 0
[inline, virtual]
 

Special read method to retrieve shadowed banks.

Reimplemented in emcOMCalFEMT< BM >, and emcOMCalFEMT< T >.

Definition at line 143 of file emcObjectManager.h.

References Read().

virtual void emcObjectManager::Reset void   )  [pure virtual]
 

Reset the OM.

After a call to Reset, the OM must behave as if it was newly created.

Implemented in emcOMCalFEMT< BM >, emcOMCalibrationDataT< BM >, emcOMFEMtupleT< BM, FT >, emcOMGeometryT< BM >, emcOMRejectListT< BM >, emcOMTimeStamp, emcOMAsciiT< T >, emcOMCalibrationDataIniCal, emcOMCalibrationDataTofSectorOffset, emcOMIniCalConstruction, emcOMRejectList, and emcOMCalFEMT< T >.

virtual bool emcObjectManager::Write const emcManageable object,
const PHTimeStamp &  tStart,
int  id = -1
[pure virtual]
 

Write a manageable object to the DB.

See the DM interface for parameters.

Implemented in emcOMCalFEMT< BM >, emcOMCalibrationDataT< BM >, emcOMFEMtupleT< BM, FT >, emcOMGeometryT< BM >, emcOMRejectListT< BM >, emcOMTimeStamp, emcOMAsciiT< T >, emcOMCalibrationDataIniCal, emcOMCalibrationDataTofSectorOffset, emcOMIniCalConstruction, emcOMRejectList, and emcOMCalFEMT< T >.


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