2 #include "GaudiKernel/Service.h"
3 #include "GaudiKernel/PropertyMgr.h"
4 #include "GaudiKernel/IMessageSvc.h"
5 #include "GaudiKernel/MsgStream.h"
6 #include "GaudiKernel/ISvcLocator.h"
7 #include "GaudiKernel/ISvcManager.h"
8 #include "GaudiKernel/IAuditorSvc.h"
9 #include "GaudiKernel/IJobOptionsSvc.h"
10 #include "GaudiKernel/GaudiException.h"
11 #include "GaudiKernel/ServiceLocatorHelper.h"
12 #include "GaudiKernel/ThreadGaudi.h"
13 #include "GaudiKernel/Guards.h"
17 #define ON_DEBUG if (UNLIKELY(outputLevel() <= MSG::DEBUG))
18 #define ON_VERBOSE if (UNLIKELY(outputLevel() <= MSG::VERBOSE))
42 fatal() <<
"in sysInitialize(): exception with tag=" << Exception.
tag()
47 catch(
const std::exception& Exception ) {
48 fatal() <<
"in sysInitialize(): standard std::exception is caught" <<
endmsg;
53 fatal() <<
"in sysInitialize(): UNKNOWN Exception is caught" <<
endmsg;
86 fatal() <<
"in sysStart(): exception with tag=" << Exception.
tag()
91 catch(
const std::exception& Exception ) {
92 fatal() <<
"in sysStart(): standard std::exception is caught" <<
endmsg;
97 fatal() <<
"in sysStart(): UNKNOWN Exception is caught" <<
endmsg;
120 fatal() <<
"in sysStop(): exception with tag=" << Exception.
tag()
121 <<
" is caught" <<
endmsg;
125 catch(
const std::exception& Exception ) {
126 fatal() <<
"in sysStop(): standard std::exception is caught" <<
endmsg;
131 fatal() <<
"in sysStop(): UNKNOWN Exception is caught" <<
endmsg;
167 fatal() <<
" Exception with tag=" << Exception.
tag()
168 <<
" is caught " <<
endmsg;
172 catch(
const std::exception& Exception ) {
173 fatal() <<
" Standard std::exception is caught " <<
endmsg;
178 fatal() <<
"UNKNOWN Exception is caught " <<
endmsg;
202 <<
"sysReinitialize(): cannot reinitialize service not initialized"
218 fatal() <<
" Exception with tag=" << Exception.
tag()
219 <<
" is caught " <<
endmsg;
223 catch(
const std::exception& Exception ) {
225 fatal() <<
" Standard std::exception is caught " <<
endmsg;
231 fatal() <<
"UNKNOWN Exception is caught " <<
endmsg;
247 <<
"sysRestart(): cannot restart service in state " <<
FSMState()
248 <<
" -- must be RUNNING "
263 fatal() <<
" Exception with tag=" << Exception.
tag()
264 <<
" is caught " <<
endmsg;
268 catch(
const std::exception& Exception ) {
269 fatal() <<
" Standard std::exception is caught " <<
endmsg;
274 fatal() <<
"UNKNOWN Exception is caught " <<
endmsg;
307 error() <<
"restart(): cannot be stopped" <<
endmsg;
312 error() <<
"restart(): cannot be started" <<
endmsg;
364 const bool CREATEIF(
true);
375 if (jos->setMyProperties(
name(),
this ).isFailure()) {
386 m_name(
std::move(name) ),
387 m_svcLocator( svcloc ),
391 if ( (name !=
"MessageSvc") &&
msgSvc() ) {
405 if (
m_name !=
"IncidentSvc") {
BooleanProperty m_auditInit
Gaudi::StateMachine::State m_targetState
Service state.
SmartIF< ISvcManager > m_svcManager
Definition of the MsgStream class used to transmit messages.
StatusCode initialize() override
IntegerProperty m_outputLevel
Service output level.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Gaudi::StateMachine::State m_state
Service state.
StatusCode finalize() override
Gaudi::StateMachine::State FSMState() const override
SmartIF< IAuditorSvc > & auditorSvc() const
The standard auditor service.May not be invoked before sysInitialize() has been invoked.
StatusCode setProperty(const Property &p) override
set the property form another property
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode start() override
GAUDI_API bool isGaudiThreaded(const std::string &name)
test if current Gaudi object is running /will run in a thread
The ISvcManager is the interface implemented by the Service Factory in the Application Manager to sup...
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
StatusCode sysRestart() override
Re-initialize the Service.
State GAUDI_API ChangeState(const Transition transition, const State state)
Function to get the new state according to the required transition, checking if the transition is all...
StatusCode sysStart() override
Initialize Service.
StatusCode setProperty(const Property &p) override
std::string m_name
Service Name.
GAUDI_API std::string getGaudiThreadGenericName(const std::string &name)
helper function to extract Gaudi instance name from thread copy name
Property manager helper class.
bool isFailure() const
Test for a status code of FAILURE.
StatusCode getProperty(Property *p) const override
get the property
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
const std::string & name() const override
Retrieve name of the service.
const std::vector< Property * > & getProperties() const override
virtual int outputLevel() const =0
Retrieve the current output level threshold.
StatusCode sysStop() override
Initialize Service.
Main interface for the JobOptions service.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
~Service() override
Standard Destructor.
This class is used for returning status codes from appropriate routines.
const std::vector< Property * > & getProperties() const override
get all properties
virtual const std::string & tag() const
name tag for the exception, or exception type
StatusCode reinitialize() override
bool m_auditorReinitialize
StatusCode stop() override
StatusCode sysFinalize() override
Finalize Service.
const TYPE & value() const
explicit conversion
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
SmartIF< PropertyMgr > m_propertyMgr
Property Manager.
Property base class allowing Property* collections to be "homogeneous".
SmartIF< ISvcLocator > m_svcLocator
Service Locator reference.
StatusCode sysReinitialize() override
Re-initialize the Service.
bool hasProperty(const std::string &name) const override
StatusCode getProperty(Property *p) const override
void initOutputLevel(Property &prop)
callback for output level property
Service(std::string name, ISvcLocator *svcloc)
Standard Constructor.
bool hasProperty(const std::string &name) const override
Return true if we have a property with the given name.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
virtual void declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
void setServiceManager(ISvcManager *ism) override
The IProperty is the basic interface for all components which have properties that can be set or get...
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
StatusCode restart() override
virtual StatusCode removeService(IService *svc)=0
Remove a service from the "active" list of services of the factory.
SmartIF< IAuditorSvc > m_pAuditorSvc
Auditor Service.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual void setOutputLevel(int new_level)=0
Set new global output level threshold.
StatusCode sysInitialize() override
Initialize Service.