#include <SaveB4TrimAesSvc.h>
Inheritance diagram for SaveB4TrimAesSvc:
Public Types | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
Public Member Functions | |
SaveB4TrimAesSvc (const std::string &name, ISvcLocator *svc) | |
Standard Service Constructor. | |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
virtual StatusCode | store (const std::string ®SeqLocation, IDybStorageSvc *dybStorageSvc, IDataManagerSvc *aes, IArchiveTrimSvc *archiveTrimSvc, const TimeStamp &now) |
ISaveB4TrimAesSvc methods. | |
virtual StatusCode | queryInterface (const InterfaceID &id, void **interface) |
Methods required by ServiceManager. | |
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 |
virtual unsigned long | addRef ()=0 |
virtual unsigned long | release ()=0 |
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 |
Friends | |
friend class | ServiceManager |
Definition at line 18 of file SaveB4TrimAesSvc.h.
SaveB4TrimAesSvc::SaveB4TrimAesSvc | ( | const std::string & | name, | |
ISvcLocator * | svc | |||
) |
StatusCode SaveB4TrimAesSvc::initialize | ( | ) | [virtual] |
Reimplemented from Service.
Definition at line 34 of file SaveB4TrimAesSvc.cpp.
00035 { 00036 return Service::initialize(); 00037 }
StatusCode SaveB4TrimAesSvc::finalize | ( | ) | [virtual] |
Reimplemented from Service.
Definition at line 39 of file SaveB4TrimAesSvc.cpp.
00040 { 00041 return Service::finalize(); 00042 }
StatusCode SaveB4TrimAesSvc::store | ( | const std::string & | regSeqLocation, | |
IDybStorageSvc * | dybStorageSvc, | |||
IDataManagerSvc * | aes, | |||
IArchiveTrimSvc * | archiveTrimSvc, | |||
const TimeStamp & | now | |||
) | [virtual] |
ISaveB4TrimAesSvc methods.
Implements ISaveB4TrimAesSvc.
Definition at line 44 of file SaveB4TrimAesSvc.cpp.
00049 { 00050 MsgStream log(msgSvc(), name()); 00051 00052 log<<MSG::DEBUG<<"SaveB4TrimAes::store()"<<endreq; 00053 00054 // get window for RegistrationSequence 00055 double window = archiveTrimSvc->window(regSeqLocation); 00056 00057 // Threshold 00058 TimeStamp thres = now; 00059 thres.Add(-1.0 * window); 00060 log << MSG::DEBUG 00061 << " store() now @ t=\"" << now << "\" threshold @ t=\"" << thres << "\"" 00062 << " window=" << window 00063 << endreq; 00064 00065 // Get DataObject 00066 DataObject* pObj=0; 00067 //log<<MSG::DEBUG<<regSeqLocation<<endreq; 00068 //log<<MSG::DEBUG<<aes<<endreq; 00069 00070 // Cast to pAes 00071 DataSvc* pAes=0; 00072 try{ 00073 pAes=dynamic_cast<DataSvc*>(aes); 00074 } 00075 catch(...) { 00076 log<<MSG::ERROR<<"Failed to AES"<<endreq; 00077 return StatusCode::FAILURE; 00078 } 00079 00080 log<<MSG::DEBUG<<aes<<endreq; 00081 StatusCode sc = pAes->retrieveObject(regSeqLocation,pObj); 00082 if(sc.isFailure()) { 00083 log<<MSG::ERROR<<"Failed to get data object"<<endreq; 00084 return StatusCode::FAILURE; 00085 } 00086 // Get RegSeqList 00087 DybArchiveList* pRegSeqList=0; 00088 try{ 00089 pRegSeqList=dynamic_cast<DybArchiveList*>(pObj); 00090 } 00091 catch (...) { 00092 log<<MSG::ERROR<<"Failed to get DybArchiveList"<<endreq; 00093 return StatusCode::FAILURE; 00094 } 00095 00096 00097 // Traverse AES /Event/RegistrationSequence 00098 DybArchiveList::reverse_iterator iter; 00099 DayaBay::RegistrationSequence* pRS=0; 00100 00101 for(iter=pRegSeqList->rbegin();iter!=pRegSeqList->rend();++iter) { 00102 00103 pObj=*iter; 00104 try{ 00105 pRS=dynamic_cast<DayaBay::RegistrationSequence*>(pObj); 00106 } 00107 catch (...) { 00108 log<<MSG::ERROR<<"Failed to get RegistrationSequence"<<endreq; 00109 return StatusCode::FAILURE; 00110 } 00111 00112 log << MSG::DEBUG 00113 << "Checking RegSeq @ t=\"" << pRS->earliest() << "\"... "; 00114 // no endreq here! 00115 00116 // This must be consistent with TrimmingAgent 00117 if(pRS->earliest()<=thres) { 00118 // time to save 00119 sc = dybStorageSvc->store(*pRS); 00120 log << "stored." << endreq; 00121 } 00122 else { 00123 log << "not yet." << endreq; 00124 } 00125 } 00126 00127 return StatusCode::SUCCESS; 00128 }
StatusCode SaveB4TrimAesSvc::queryInterface | ( | const InterfaceID & | id, | |
void ** | interface | |||
) | [virtual] |
Methods required by ServiceManager.
Reimplemented from Service.
Definition at line 15 of file SaveB4TrimAesSvc.cpp.
00017 { 00018 MsgStream log(msgSvc(), name()); 00019 00020 if (ISaveB4TrimAesSvc::interfaceID().versionMatch(id)) { 00021 // If good enough match return this object. 00022 *interface = (ISaveB4TrimAesSvc*)this; 00023 addRef(); 00024 // log<<MSG::DEBUG<<"match"<<endreq; 00025 } else { 00026 // Interface is not directly available: try out a base class. 00027 // log<<MSG::DEBUG<<"no match"<<endreq; 00028 return Service::queryInterface(id,interface); 00029 } 00030 00031 return StatusCode::SUCCESS; 00032 }