class emcObjectManager: public emcNamed

ABC of an Object Manager.

Inheritance:


Public Methods

[more] emcObjectManager(const char* name="", const char* title="")
Default ctor
[more]virtual bool CanCollect(const emcManageable& object)
Can we collect such object ?
[more]virtual bool CanHandle(const emcManageable& object)
Can we handle (read or write or collect) a given object type ?
[more]virtual bool CanWrite(const emcManageable& object)
Can we write a given object type ?
[more]virtual bool CanRead(const emcManageable& object)
Can we read a given object type ?
[more]virtual emcManageable* Collect(const emcManageable& object, const PHTimeStamp& when)
Collect a manageable from the DB.
[more]virtual bool Read(emcManageable& object, const PHTimeStamp& time_stamp, int id)
Read a manageable object from the DB.
[more]virtual void Reset(void)
Reset the OM.
[more]virtual bool Write(const emcManageable& object, const PHTimeStamp& tStart, int id=-1)
Write a manageable object to the DB.


Inherited from emcNamed:

Public Methods

ovirtual const char* GetClassName(void) const
ovirtual const char* GetName(void) const
ovirtual const char* GetTitle(void) const
ovirtual void SetClassName(const char*)
ovirtual void SetTitle(const char*)
ovirtual void SetName(const char*)


Documentation

ABC of an Object Manager.

An Object Manager manages objects of type emcManageable.

Object Manager typically is responsible for reading/writing objects to 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 make a call to the EMCALDM_REGISTER_OBJECTMANAGER macro. Like this:

EMCALDM_REGISTER_OBJECTMANAGER(classname,name,title)

where in this example classname=emcOMNut , name="a name", title="Manager for Nut objects"

Please note that there is no quote around the classname and that there is no ; at the end of the macro call.

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 classes emcOMGains and emcOMPedestals to see how it was done for emcGains and emcPedestals classes.

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!).
Note: this is the same mechanism as the one used to register Checkers in the EmCal Troubleshooter, or to register persistent classes in PHENIX PdbCal.

o emcObjectManager(const char* name="", const char* title="")
Default ctor

ovirtual bool CanCollect(const emcManageable& object)
Can we collect such object ?

ovirtual bool CanHandle(const emcManageable& object)
Can we handle (read or write or collect) a given object type ?

ovirtual bool CanWrite(const emcManageable& object)
Can we write a given object type ?

ovirtual bool CanRead(const emcManageable& object)
Can we read a given object type ?

ovirtual emcManageable* Collect(const emcManageable& object, const PHTimeStamp& when)
Collect a manageable from the DB.
See the DM interface for parameters.
Unless allowed explicitely by a particular Object Manager,
in general the returned pointer should not be deleted by
the receiver !

ovirtual bool Read(emcManageable& object, const PHTimeStamp& time_stamp, int id)
Read a manageable object from the DB.
See the DM interface for parameters.

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

ovirtual bool Write(const emcManageable& object, const PHTimeStamp& tStart, int id=-1)
Write a manageable object to the DB. See the DM interface for parameters.


Direct child classes:
emcObjyObjectManager
Author:
L. Aphecetche

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.