LCCD  1.3.1
ConditionsHandlerBase.hh
1 #ifndef ConditionsHandlerBase_h
2 #define ConditionsHandlerBase_h
3 
4 #include "lccd.h"
5 
6 #include "IConditionsHandler.hh"
7 
8 #include <vector>
9 
10 
11 //using namespace lcio ;
12 
13 namespace lccd {
14 
28 
29  public:
30 
33  ConditionsHandlerBase(const std::string& name) :
34  _col(NULL),
35  _name( name),
36  _validSince( LCCDPlusInf ) , // initially we don't have a valid time range
38  }
39 
40  virtual ~ConditionsHandlerBase() {}
41 
42 
47  virtual void updateEvent( lcio::LCEvent* evt ) ;
48 
49 
54  virtual void update( LCCDTimeStamp timestamp ) = 0 ;
55 
56 
59  virtual lcio::LCCollection* currentCollection() { return _col ; }
60 
61 
66 
67 
71 
72 
76 
77 
81  virtual void registerDefaultCollection( lcio::LCCollection* col) = 0 ;
82 
85  virtual lcio::LCCollection* defaultCollection() = 0;
86 
89  virtual lcio::LCCollection* lastValidCollection() = 0;
90 
96  virtual const std::string name() { return _name ; }
97 
100  virtual LCCDTimeStamp validSince() { return _validSince ; }
101 
104  virtual LCCDTimeStamp validTill() { return _validTill ; }
105 
106 
107  protected :
108 
110 
113  virtual void notifyListeners() ;
114 
115 
116  // ---- data members ------
117 
119  lcio::LCCollection* _col ;
120 
122  std::string _name ;
123 
126 
129 
131  std::vector< IConditionsChangeListener* > _changeListeners ;
132 
133 
134 
135  };
136 } //end namespace
137 
138 #endif // ConditionsHandlerBase_h
lcio::LCCollection * _col
The current collection of conditions data.
Definition: ConditionsHandlerBase.hh:119
virtual LCCDTimeStamp validSince()
First timestamp for which the current conditions data is valid.
Definition: ConditionsHandlerBase.hh:100
LCCDTimeStamp LCCDPlusInf
The largest possible time stamp.
Definition: lccd.cc:18
Simple interface that allows notification of implementation classes if a conditions data set has chan...
Definition: IConditionsChangeListener.hh:22
Base implementation of IConditionsHandler.
Definition: ConditionsHandlerBase.hh:27
virtual void registerChangeListener(IConditionsChangeListener *cl)
Every IConditionsChangeListener will be notified if the conditions data of this instance has changed...
Definition: ConditionsHandlerBase.cc:25
virtual bool isChangeListenerRegistered(IConditionsChangeListener *cl)
checks if the changeListner is Registered
Definition: ConditionsHandlerBase.cc:31
virtual LCCDTimeStamp validTill()
Last timestamp for which the current conditions data is valid.
Definition: ConditionsHandlerBase.hh:104
Abstract handler for conditions data.
Definition: IConditionsHandler.hh:26
std::vector< IConditionsChangeListener * > _changeListeners
The registered change listeners.
Definition: ConditionsHandlerBase.hh:131
LCCDTimeStamp _validSince
First timestamp for which the current data is valid.
Definition: ConditionsHandlerBase.hh:125
std::string _name
Name assigned with conditions data.
Definition: ConditionsHandlerBase.hh:122
LCCDTimeStamp _validTill
Last timestamp for which the current data is valid.
Definition: ConditionsHandlerBase.hh:128
LCCDTimeStamp LCCDMinusInf
The smallest possible time stamp.
Definition: lccd.cc:16
virtual void removeChangeListener(IConditionsChangeListener *cl)
Remove the specified listener from list of registered listeners ;.
Definition: ConditionsHandlerBase.cc:42
lcio::long64 LCCDTimeStamp
The timestamp in LCCD is a 64bit int as defined in LCIO.
Definition: lccd.h:24
virtual void updateEvent(lcio::LCEvent *evt)
Retrieves the new conditions data if required by evt->getTimestamp() and adds a collection to event w...
Definition: ConditionsHandlerBase.cc:12
virtual lcio::LCCollection * defaultCollection()=0
The default collection registered with the handler.
ConditionsHandlerBase(const std::string &name)
Default c'tor - need a name for the conditions data set.
Definition: ConditionsHandlerBase.hh:33
virtual void notifyListeners()
Tell all registered listeners that the conditions data has changed.
Definition: ConditionsHandlerBase.cc:54
virtual const std::string name()
The name of this conditions handler - used, e.g.
Definition: ConditionsHandlerBase.hh:96
virtual lcio::LCCollection * currentCollection()
Returns the current collection of conditions data.
Definition: ConditionsHandlerBase.hh:59
virtual void registerDefaultCollection(lcio::LCCollection *col)=0
Register a pointer to a default collection which will be passed to the IConditionsChangeListener if n...
virtual lcio::LCCollection * lastValidCollection()=0
The last valid collection held by the handler.
virtual void update(LCCDTimeStamp timestamp)=0
Retrieves the new conditions data if required by timestamp.