#include <StageDataManager.h>
Inheritance diagram for StageDataManager:
Public Types | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
Public Member Functions | |
StageDataManager (const std::string &name, ISvcLocator *svc) | |
virtual | ~StageDataManager () |
virtual StatusCode | initialize () |
Service interface:. | |
virtual StatusCode | finalize () |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppint) |
StatusCode | registerData (const std::string &location, IStageData &sd) |
StageProcess calls this to register data to be at a given location. | |
StatusCode | consumeData (IStageData &sd) |
Stage notifies the manager when data is consumed. | |
virtual unsigned long | addRef () |
virtual unsigned long | release () |
virtual const std::string & | name () const |
virtual const InterfaceID & | type () const |
virtual StatusCode | configure () |
virtual StatusCode | start () |
virtual StatusCode | stop () |
virtual StatusCode | terminate () |
virtual Gaudi::StateMachine::State | FSMState () const |
virtual Gaudi::StateMachine::State | targetFSMState () const |
virtual StatusCode | reinitialize () |
virtual StatusCode | restart () |
virtual StatusCode | sysInitialize () |
virtual StatusCode | sysStart () |
virtual StatusCode | sysStop () |
virtual StatusCode | sysFinalize () |
virtual StatusCode | sysReinitialize () |
virtual StatusCode | sysRestart () |
virtual StatusCode | setProperty (const Property &p) |
virtual StatusCode | setProperty (const std::string &s) |
virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
StatusCode | setProperty (const std::string &name, const TYPE &value) |
virtual StatusCode | getProperty (Property *p) const |
virtual const Property & | getProperty (const std::string &name) const |
virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
virtual const std::vector< Property * > & | getProperties () const |
ISvcLocator * | serviceLocator () const |
IMessageSvc * | msgSvc () |
IMessageSvc * | msgSvc () const |
IMessageSvc * | messageService () |
IMessageSvc * | messageService () const |
StatusCode | setProperties () |
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const |
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const |
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
IAuditorSvc * | auditorSvc () const |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
Public Attributes | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
Protected Member Functions | |
int | outputLevel () const |
Protected Attributes | |
IntegerProperty | m_outputLevel |
Gaudi::StateMachine::State | m_state |
Gaudi::StateMachine::State | m_targetState |
IMessageSvc * | m_messageSvc |
Private Types | |
typedef std::map< std::string, IStageDataList > | LocDataListMap |
Private Member Functions | |
void | find_and_flush (const DayaBay::HeaderObject *ho) |
Private Attributes | |
LocDataListMap | m_cache |
IDataProviderSvc * | m_evtsvc |
Friends | |
friend class | ServiceManager |
Brett Viren <bv@bnl.gov> Thu Mar 24 09:43:52 2011
Definition at line 25 of file StageDataManager.h.
typedef std::map<std::string, IStageDataList> StageDataManager::LocDataListMap [private] |
Definition at line 52 of file StageDataManager.h.
StageDataManager::StageDataManager | ( | const std::string & | name, | |
ISvcLocator * | svc | |||
) |
StageDataManager::~StageDataManager | ( | ) | [virtual] |
StatusCode StageDataManager::initialize | ( | ) | [virtual] |
Service interface:.
Reimplemented from Service.
Definition at line 23 of file StageDataManager.cc.
00024 { 00025 StatusCode sc = this->Service::initialize(); 00026 if (sc.isFailure()) return sc; 00027 00028 sc = this->service("EventDataSvc",m_evtsvc); 00029 if (sc.isFailure()) return sc; 00030 00031 MsgStream log(msgSvc(), "StageDataManager"); 00032 log << MSG::DEBUG << "Initialized" << endreq; 00033 00034 return sc; 00035 }
StatusCode StageDataManager::finalize | ( | ) | [virtual] |
Reimplemented from Service.
Definition at line 37 of file StageDataManager.cc.
00038 { 00039 MsgStream log(msgSvc(), "StageDataManager"); 00040 log << MSG::DEBUG << "Finalizing" << endreq; 00041 00042 return this->Service::finalize(); 00043 }
StatusCode StageDataManager::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppint | |||
) | [virtual] |
Reimplemented from Service.
Definition at line 45 of file StageDataManager.cc.
00046 { 00047 if (IID_IStageDataManager.versionMatch(riid)) { 00048 *ppint = (IStageDataManager*)this; 00049 } 00050 else { 00051 return this->Service::queryInterface(riid,ppint); 00052 } 00053 addRef(); 00054 return StatusCode::SUCCESS; 00055 }
StatusCode StageDataManager::registerData | ( | const std::string & | location, | |
IStageData & | sd | |||
) | [virtual] |
StageProcess calls this to register data to be at a given location.
Implements IStageDataManager.
Definition at line 57 of file StageDataManager.cc.
00058 { 00059 MsgStream log(msgSvc(), "StageDataManager"); 00060 00061 HeaderObject& ho = sd.header(); 00062 00063 log << MSG::DEBUG << "Registering data at " << location 00064 << " id#" << ho.clID() << " @ " << ho.context().AsString() 00065 << endreq; 00066 00067 HeaderStageData<HeaderObject>* hsd = new HeaderStageData<HeaderObject>(ho); 00068 ho.addRef(); 00069 m_cache[location].insert(IStageDataListPair(hsd->time(),hsd)); 00070 return StatusCode::SUCCESS; 00071 }
StatusCode StageDataManager::consumeData | ( | IStageData & | sd | ) | [virtual] |
Stage notifies the manager when data is consumed.
Implements IStageDataManager.
Definition at line 170 of file StageDataManager.cc.
00171 { 00172 MsgStream log(msgSvc(), "StageDataManager"); 00173 log << MSG::DEBUG << "consumeData()" << endreq; 00174 00175 // need to: 00176 // 00177 // 3. add sd->header() to TES, if not yet already added 00178 // 00179 // 2. add all input headers to TES, inyaa 00180 // 00181 // 1. add all cached headers to TES, inyaa and if earlier than any 00182 // in the category above on a per-location basis 00183 00184 const HeaderObject& ho = sd.header(); 00185 00186 if (1) { // some debugging 00187 log << MSG::DEBUG << "Consuming with " << m_cache.size() << " locations cached" 00188 << endreq; 00189 LocDataListMap::iterator it, done = m_cache.end(); 00190 for (it = m_cache.begin(); it != done; ++it) { 00191 IStageDataList& sdlist = it->second; 00192 log << MSG::DEBUG << "\t" << it->first 00193 << " with " << sdlist.size() 00194 << ":" << endreq; 00195 IStageDataList::iterator lit, ldone = sdlist.end(); 00196 for (lit = sdlist.begin(); lit != ldone; ++lit) { 00197 HeaderObject& ho = lit->second->header(); 00198 log << MSG::DEBUG << "\t\t id#" 00199 << ho.clID() << " at \"" 00200 << ho.defLoc() << "\" @ " 00201 << ho.context().AsString() 00202 << endreq; 00203 } 00204 } 00205 } 00206 vector<const HeaderObject*> hos; 00207 bool ok = find_hos(&ho,hos); 00208 if (!ok) { 00209 log << MSG::ERROR << "Got IHeader that isn't a HeaderObject! WTF?" << endreq; 00210 return StatusCode::FAILURE; 00211 } 00212 00213 size_t nhos = hos.size(); 00214 00215 log << MSG::DEBUG << "Consuming id#" << ho.clID() 00216 << " \"" << ho.defLoc() << "\" @ " 00217 << ho.context().AsString() 00218 << " along with " << nhos << " other HeaderObjects" << endreq; 00219 00220 for (size_t ind=0; ind<nhos; ++ind) { 00221 log << MSG::DEBUG << "\t" << ind << ": id#" << hos[ind]->clID() 00222 << " \"" << hos[ind]->defLoc() << "\" @ " 00223 << hos[ind]->context().AsString() << endreq; 00224 this->find_and_flush(hos[ind]); 00225 } 00226 00227 return StatusCode::SUCCESS; 00228 }
void StageDataManager::find_and_flush | ( | const DayaBay::HeaderObject * | ho | ) | [private] |
Definition at line 128 of file StageDataManager.cc.
00129 { 00130 MsgStream log(msgSvc(), "StageDataManager"); 00131 00132 LocDataListMap::iterator it, done = m_cache.end(); 00133 for (it = m_cache.begin(); it != done; ++it) { 00134 00135 const string& loc = it->first; 00136 IStageDataList& sdlist = it->second; 00137 00138 IStageDataList::iterator sdit = find_ho(sdlist,ho); 00139 if (sdit == sdlist.end()) continue; 00140 00141 ++sdit; // always up-to-but-not-including 00142 size_t before = sdlist.size(); 00143 vector<const HeaderObject*> dead_hos = strip_sdlist(sdlist, sdit); 00144 size_t after = sdlist.size(); 00145 00146 size_t siz = dead_hos.size(); 00147 log << MSG::DEBUG << "Loading " << siz << " HeaderObjects into TES, stripped from " 00148 << before << " to " << after 00149 << endreq; 00150 00151 for (size_t ind=0; ind<siz; ++ind) { 00152 // gotta break const'ness here because the TES must call 00153 // addRef/release. This const-incorectness is ultimately 00154 // because HeaderObject::inputHeaders() forces constness 00155 // on us, even thought the original HO isn't const. This 00156 // is probably a deficiency of HeaderObject. 00157 HeaderObject* malleable_ho = const_cast<HeaderObject*>(dead_hos[ind]); 00158 m_evtsvc->registerObject(loc,malleable_ho); 00159 00160 log << MSG::DEBUG << "Releasing HeaderObject clID: " << malleable_ho->clID() << endreq; 00161 malleable_ho->release(); 00162 } 00163 00164 // in principle, we could bail from the function at this point 00165 // as no one would ever think to put a HO in more than one 00166 // spot. But, lets be paranoid and keep checking. 00167 } 00168 }
static const InterfaceID& IStageDataManager::interfaceID | ( | ) | [inline, static, inherited] |
Reimplemented from IInterface.
Definition at line 28 of file IStageDataManager.h.
00028 { return IID_IStageDataManager; }
LocDataListMap StageDataManager::m_cache [private] |
Definition at line 53 of file StageDataManager.h.
IDataProviderSvc* StageDataManager::m_evtsvc [private] |
Definition at line 55 of file StageDataManager.h.