#include <EventClockSvc.h>
Inheritance diagram for EventClockSvc:
Public Types | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
Public Member Functions | |
EventClockSvc (const std::string &name, ISvcLocator *svcloc) | |
Standard constructor. | |
virtual | ~EventClockSvc () |
Destructor. | |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvUnknown) |
Query interfaces (. | |
virtual StatusCode | initialize () |
Initialize Service. | |
virtual StatusCode | finalize () |
Finalize Service. | |
virtual void | handle (const Incident &inc) |
Handle BeginEvent incident. | |
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 |
Private Attributes | |
std::string | m_detDataSvcName |
Name of the Data Provider (set by the option DetDataSvc, by default "DetectorDataSvc"). | |
std::string | m_eventTimeDecoderName |
Name of the Event Time Decoder (set by the option EventTimeDecoder, by default "FakeEventTime"). | |
IIncidentSvc * | m_incidentSvc |
Pointer to the incident service;. | |
IDetDataSvc * | m_detDataSvc |
Handle to the IDetDataSvc interface (to propagate the event time). | |
IToolSvc * | m_toolSvc |
Handle to the Tool Service. | |
IEventTimeDecoder * | m_eventTimeDecoder |
Pointer to the EventTimeDecoder tool. | |
long long | m_initialTime |
Time to use before reading the first event (set by the option InitialTime, by default 0). | |
Friends | |
class | SvcFactory< EventClockSvc > |
Allow SvcFactory to instantiate the service. | |
friend class | ServiceManager |
Definition at line 19 of file EventClockSvc.h.
EventClockSvc::EventClockSvc | ( | const std::string & | name, | |
ISvcLocator * | svcloc | |||
) |
Standard constructor.
Definition at line 25 of file EventClockSvc.cpp.
00025 : 00026 Service(name,svcloc),m_incidentSvc(NULL),m_detDataSvc(NULL),m_toolSvc(NULL), 00027 m_eventTimeDecoder(NULL) 00028 { 00029 // service name 00030 declareProperty("DetectorDataSvc", m_detDataSvcName = "DetectorDataSvc" ); 00031 00032 // tool name 00033 declareProperty("EventTimeDecoder", m_eventTimeDecoderName = "FakeEventTime" ); 00034 00035 declareProperty("InitialTime", m_initialTime = 0 ); 00036 00037 } //=============================================================================
EventClockSvc::~EventClockSvc | ( | ) | [virtual] |
StatusCode EventClockSvc::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvUnknown | |||
) | [virtual] |
Query interfaces (.
riid | ID of Interface to be retrieved | |
ppvUnknown | Pointer to Location for interface pointer |
Implements IIncidentListener.
Definition at line 46 of file EventClockSvc.cpp.
00046 { 00047 if ( IIncidentListener::interfaceID().versionMatch(riid) ) { 00048 *ppvUnknown = (IIncidentListener*)this; 00049 addRef(); 00050 return StatusCode::SUCCESS; 00051 } 00052 return Service::queryInterface(riid,ppvUnknown); 00053 }
StatusCode EventClockSvc::initialize | ( | ) | [virtual] |
Initialize Service.
Reimplemented from Service.
Definition at line 57 of file EventClockSvc.cpp.
00057 { 00058 // base class initialization 00059 StatusCode sc = Service::initialize(); 00060 if (!sc.isSuccess()) return sc; 00061 00062 // local initialization 00063 MsgStream log(msgSvc(),name()); 00064 log << MSG::DEBUG << "--- initialize ---" << endmsg; 00065 00066 // find the detector data svc 00067 sc = service(m_detDataSvcName,m_detDataSvc,true); 00068 if (!sc.isSuccess()) { 00069 log << MSG::ERROR << "Unable to get a handle to the detector data service" << endmsg; 00070 return sc; 00071 } else { 00072 log << MSG::DEBUG << "Got pointer to IDetDataSvc \"" << m_detDataSvcName << '"' << endmsg; 00073 } 00074 00075 // get a pointer to the tool service 00076 sc = service( "ToolSvc", m_toolSvc, true ); 00077 if (!sc.isSuccess()) { 00078 log << MSG::ERROR << "Unable to get a handle to the tool service" << endmsg; 00079 return sc; 00080 } else { 00081 log << MSG::DEBUG << "Got pointer to ToolSvc " << endmsg; 00082 } 00083 00084 sc = m_toolSvc->retrieveTool(m_eventTimeDecoderName, m_eventTimeDecoder, this); 00085 if (!sc.isSuccess()) { 00086 log << MSG::ERROR << "Unable to get a handle to the IEventTimeDecoder \"" << m_eventTimeDecoderName << '"' << endmsg; 00087 return sc; 00088 } else { 00089 log << MSG::DEBUG << "Got pointer to " << m_eventTimeDecoderName << endmsg; 00090 } 00091 00092 // Set the first event time at initialization. 00093 Gaudi::Time initTime; 00094 if (m_initialTime) 00095 initTime = Gaudi::Time(m_initialTime); 00096 else 00097 initTime = Gaudi::Time::current(); 00098 log << MSG::DEBUG << "Initialize event time to " << initTime << endmsg; 00099 m_detDataSvc->setEventTime(initTime); 00100 00101 // register to the incident service for BeginEvent incidents 00102 sc = service("IncidentSvc", m_incidentSvc, false); 00103 if ( sc.isSuccess() ) { 00104 m_incidentSvc->addListener(this,IncidentType::BeginEvent); 00105 log << MSG::DEBUG << "Got pointer to IncidentSvc" << endmsg; 00106 } else { 00107 log << MSG::WARNING << "Unable to register to the incident service." << endmsg; 00108 m_incidentSvc = NULL; 00109 } 00110 return StatusCode::SUCCESS; 00111 }
StatusCode EventClockSvc::finalize | ( | ) | [virtual] |
Finalize Service.
Reimplemented from Service.
Definition at line 116 of file EventClockSvc.cpp.
00116 { 00117 // local finalization 00118 MsgStream log(msgSvc(),name()); 00119 log << MSG::DEBUG << "--- finalize ---" << endmsg; 00120 00121 // release the interfaces used 00122 if (m_toolSvc != NULL) { 00123 if ( m_eventTimeDecoder != NULL ) 00124 m_toolSvc->releaseTool(m_eventTimeDecoder).ignore(); 00125 m_toolSvc->release(); 00126 } 00127 if (m_detDataSvc != NULL) m_detDataSvc->release(); 00128 if (m_incidentSvc != NULL) { 00129 // unregister from the incident svc 00130 m_incidentSvc->removeListener(this,IncidentType::BeginEvent); 00131 m_incidentSvc->release(); 00132 } 00133 00134 return Service::finalize(); 00135 }
void EventClockSvc::handle | ( | const Incident & | inc | ) | [virtual] |
Handle BeginEvent incident.
Implements IIncidentListener.
Definition at line 139 of file EventClockSvc.cpp.
00139 { 00140 MsgStream log( msgSvc(), name() ); 00141 if ( inc.type() == IncidentType::BeginEvent ) { 00142 log << MSG::DEBUG << "New BeginEvent incident received" << endmsg; 00143 m_detDataSvc->setEventTime(m_eventTimeDecoder->getTime()); 00144 log << MSG::DEBUG << "DetDataSvc::eventTime() -> " << m_detDataSvc->eventTime() << endmsg; 00145 } else { 00146 log << MSG::WARNING << inc.type() << " incident ignored" << endmsg; 00147 } 00148 }
friend class SvcFactory< EventClockSvc > [friend] |
std::string EventClockSvc::m_detDataSvcName [private] |
Name of the Data Provider (set by the option DetDataSvc, by default "DetectorDataSvc").
Definition at line 52 of file EventClockSvc.h.
std::string EventClockSvc::m_eventTimeDecoderName [private] |
Name of the Event Time Decoder (set by the option EventTimeDecoder, by default "FakeEventTime").
Definition at line 54 of file EventClockSvc.h.
IIncidentSvc* EventClockSvc::m_incidentSvc [private] |
IDetDataSvc* EventClockSvc::m_detDataSvc [private] |
Handle to the IDetDataSvc interface (to propagate the event time).
Definition at line 60 of file EventClockSvc.h.
IToolSvc* EventClockSvc::m_toolSvc [private] |
long long EventClockSvc::m_initialTime [private] |
Time to use before reading the first event (set by the option InitialTime, by default 0).
Definition at line 71 of file EventClockSvc.h.