LCCD  1.5.0
LCConditionsMgr.hh
1 #ifndef LCConditionsMgr_h
2 #define LCConditionsMgr_h
3 
4 //
5 #include "lccd.h"
6 #include "lccd/IConditionsHandler.hh"
7 
8 // -- lcio headers
9 // #include "lcio.h"
10 // #include "EVENT/LCCollection.h"
11 
12 // -- C++ headers
13 #include <map>
14 
15 namespace lccd {
16 
17  typedef std::map< std::string, IConditionsHandler* > HandlerMap ;
18 
19 
32 
33  protected:
34 
35  LCConditionsMgr() ;
36 
37  public:
38 
39  ~LCConditionsMgr() {} ;
40 
43  static LCConditionsMgr* instance() ;
44 
45 
50  void registerChangeListener( IConditionsChangeListener* cl, const std::string& name) ;
51 
52 
55  void registerHandler(const std::string& name, IConditionsHandler* handler ) ;
56 
57 
60  void removeHandler(const std::string& name ) ;
61 
62 
66  IConditionsHandler* getHandler( const std::string& name) ;
67 
70  void updateEvent( lcio::LCEvent* evt ) ;
71 
74  void update( LCCDTimeStamp timestamp ) ;
75 
77  void clear() ;
78 
79 
80  private:
81  HandlerMap _map{} ;
82 
83  static LCConditionsMgr* _me ;
84 
85  };
86 
87 } //end namespace
88 
89 #endif // LCConditionsMgr_h
Manager for IConditionsHandler objects.
Definition: LCConditionsMgr.hh:31
void registerHandler(const std::string &name, IConditionsHandler *handler)
Register a handler with the given type name.
Definition: LCConditionsMgr.cc:74
void registerChangeListener(IConditionsChangeListener *cl, const std::string &name)
Register a change listener with the conditions handler &#39;name&#39;.
Definition: LCConditionsMgr.cc:21
void removeHandler(const std::string &name)
Remove the handler with the given name.
Definition: LCConditionsMgr.cc:33
Simple interface that allows notification of implementation classes if a conditions data set has chan...
Definition: IConditionsChangeListener.hh:22
IConditionsHandler * getHandler(const std::string &name)
Returns the handler for the given name - Null if not registered.
Definition: LCConditionsMgr.cc:62
void updateEvent(lcio::LCEvent *evt)
Call IConditionsHandler::updateEvent() for all registered handlers.
Definition: LCConditionsMgr.cc:43
Abstract handler for conditions data.
Definition: IConditionsHandler.hh:26
void update(LCCDTimeStamp timestamp)
Call IConditionsHandler::update() for all registered handlers.
Definition: LCConditionsMgr.cc:52
static LCConditionsMgr * instance()
The instance of this manager class.
Definition: LCConditionsMgr.cc:11
lcio::long64 LCCDTimeStamp
The timestamp in LCCD is a 64bit int as defined in LCIO.
Definition: lccd.h:24
void clear()
Clear the map and delete all handlers.
Definition: LCConditionsMgr.cc:88