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))
43 fatal() <<
"in sysInitialize(): exception with tag=" << Exception.
tag()
48 catch(
const std::exception& Exception ) {
49 fatal() <<
"in sysInitialize(): standard std::exception is caught" <<
endmsg;
54 fatal() <<
"in sysInitialize(): UNKNOWN Exception is caught" <<
endmsg;
87 fatal() <<
"in sysStart(): exception with tag=" << Exception.
tag()
92 catch(
const std::exception& Exception ) {
93 fatal() <<
"in sysStart(): standard std::exception is caught" <<
endmsg;
98 fatal() <<
"in sysStart(): UNKNOWN Exception is caught" <<
endmsg;
121 fatal() <<
"in sysStop(): exception with tag=" << Exception.
tag()
122 <<
" is caught" <<
endmsg;
126 catch(
const std::exception& Exception ) {
127 fatal() <<
"in sysStop(): standard std::exception is caught" <<
endmsg;
132 fatal() <<
"in sysStop(): UNKNOWN Exception is caught" <<
endmsg;
168 fatal() <<
" Exception with tag=" << Exception.
tag()
169 <<
" is caught " <<
endmsg;
173 catch(
const std::exception& Exception ) {
174 fatal() <<
" Standard std::exception is caught " <<
endmsg;
179 fatal() <<
"UNKNOWN Exception is caught " <<
endmsg;
203 <<
"sysReinitialize(): cannot reinitialize service not initialized"
219 fatal() <<
" Exception with tag=" << Exception.
tag()
220 <<
" is caught " <<
endmsg;
224 catch(
const std::exception& Exception ) {
226 fatal() <<
" Standard std::exception is caught " <<
endmsg;
232 fatal() <<
"UNKNOWN Exception is caught " <<
endmsg;
248 <<
"sysRestart(): cannot restart service in state " <<
FSMState()
249 <<
" -- must be RUNNING "
264 fatal() <<
" Exception with tag=" << Exception.
tag()
265 <<
" is caught " <<
endmsg;
269 catch(
const std::exception& Exception ) {
270 fatal() <<
" Standard std::exception is caught " <<
endmsg;
275 fatal() <<
"UNKNOWN Exception is caught " <<
endmsg;
308 error() <<
"restart(): cannot be stopped" <<
endmsg;
313 error() <<
"restart(): cannot be started" <<
endmsg;
365 const bool CREATEIF(
true);
376 if (jos->setMyProperties(
name(),
this ).isFailure()) {
387 m_name(
std::move(name) ),
388 m_svcLocator( svcloc ),
392 if ( (name !=
"MessageSvc") &&
msgSvc() ) {
406 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...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Gaudi::StateMachine::State m_state
Service state.
StatusCode finalize() override
Gaudi::StateMachine::State FSMState() const override
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
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
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)
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.