| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
Service Class Reference

Base class for all services. More...

`#include <Service.h>`

Inheritance diagram for Service:
[legend]
Collaboration diagram for Service:
[legend]

## Public Types
typedef Gaudi::PluginService::Factory2 < IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging | base_class
Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 | base_class
| Typedef to this class.
typedef extend_interfaces3 < IService, IProperty, IStateful > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Public Types inherited from extend_interfaces3< I1, I2, I3 >
typedef mpl::fold< typename I1::iid::iids::type, typename mpl::fold< typename I2::iid::iids::type, typename I3::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type, mpl::insert< mpl::_1, mpl::_2 > >::type | ext_iids
| MPL set of interfaces extended by this one.

## Public Member Functions
virtual unsigned long | release ()
| Release Interface instance.
virtual const std::string & | name () const
| Retrieve name of the service.
virtual StatusCode | configure ()
virtual StatusCode | initialize ()
virtual StatusCode | start ()
virtual StatusCode | stop ()
virtual StatusCode | finalize ()
virtual StatusCode | terminate ()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | reinitialize ()
virtual StatusCode | restart ()
virtual StatusCode | sysInitialize ()
| Initialize Service.
virtual StatusCode | sysStart ()
| Initialize Service.
virtual StatusCode | sysStop ()
| Initialize Service.
virtual StatusCode | sysFinalize ()
| Finalize Service.
virtual StatusCode | sysReinitialize ()
| Re-initialize the Service.
virtual StatusCode | sysRestart ()
| Re-initialize the Service.
virtual StatusCode | setProperty (const Property &p)
virtual StatusCode | setProperty (const std::string &s)
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
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
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
| Service (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor.
SmartIF< ISvcLocator > & | serviceLocator () const
| Retrieve pointer to service locator.
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job.
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist.
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
| CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
| Templated constructor with 3 arguments.
| CommonMessaging (const A1 &a1, const A2 &a2)
| Templated constructor with 2 arguments.
| CommonMessaging (const A1 &a1)
| Templated constructor with 1 argument.
| CommonMessaging ()
| Default constructor.
virtual | ~CommonMessaging ()
| Virtual destructor.
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
MsgStream & | msgStream () const
| Return an uninitialized MsgStream.
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts.
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL)
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING)
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO)
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG)
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO)
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream

## Protected Member Functions
virtual | ~Service ()
| Standard Destructor.
int | outputLevel () const
| get the `Service's` output level
Protected Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream.

## Protected Attributes
IntegerProperty | m_outputLevel
| Service output level.
Gaudi::StateMachine::State | m_state
| Service state.
Gaudi::StateMachine::State | m_targetState
| Service state.
Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvc > | m_msgsvc
| Pointer to the message service;.
std::auto_ptr< MsgStream > | m_msgStream
| The predefined message stream.
bool | m_streamWithService
| Flag to create a new MsgStream if it was created without the message service.

## Private Member Functions
void | setServiceManager (ISvcManager *ism)
void | initOutputLevel (Property &prop)
| callback for output level property

## Private Attributes
std::string | m_name
| Service Name.
SmartIF< ISvcLocator > | m_svcLocator
| Service Locator reference.
SmartIF< ISvcManager > | m_svcManager
PropertyMgr * | m_propertyMgr
| Property Manager.
SmartIF< IAuditorSvc > | m_pAuditorSvc
| Auditor Service.
BooleanProperty | m_auditInit
bool | m_auditorInitialize
bool | m_auditorStart
bool | m_auditorStop
bool | m_auditorFinalize
bool | m_auditorReinitialize
bool | m_auditorRestart

## Friends
class | ServiceManager

## Detailed Description

Base class for all services.

It implements the IService and IProperty interfaces.

Author
  Pere Mato
  Marco Clemencic

Definition at line 33 of file Service.h.

## Member Typedef Documentation

typedef Gaudi::PluginService::Factory2<IService*, const std::string&, ISvcLocator*> Service::Factory

Definition at line 37 of file Service.h.

## Constructor & Destructor Documentation

Service::Service | ( | const std::string & | name,
|  | ISvcLocator * | svcloc
| ) |  |

Standard Constructor.

Definition at line 393 of file Service.cpp.

{
m_name = name;
m_svcLocator = svcloc;
m_state = Gaudi::StateMachine::OFFLINE;
m_targetState = Gaudi::StateMachine::OFFLINE;
m_propertyMgr = new PropertyMgr();
m_outputLevel = MSG::NIL;
// Declare common Service properties with their defaults
if ( (name != "MessageSvc") && msgSvc().isValid() ) {
// In genconf a service is instantiated without the ApplicationMgr
m_outputLevel = msgSvc()->outputLevel();
}
declareProperty("OutputLevel", m_outputLevel);
m_outputLevel.declareUpdateHandler(&Service::initOutputLevel, this);
// Get the default setting for service auditing from the AppMgr
declareProperty("AuditServices", m_auditInit = true);
bool audit(false);
SmartIF<IProperty> appMgr(serviceLocator()->service("ApplicationMgr"));
if (appMgr.isValid()) {
const Property& prop = appMgr->getProperty("AuditServices");
if (m_name != "IncidentSvc") {
setProperty(prop).ignore();
audit = m_auditInit.value();
} else {
audit = false;
}
}
declareProperty( "AuditInitialize" , m_auditorInitialize = audit );
declareProperty( "AuditStart" , m_auditorStart = audit );
declareProperty( "AuditStop" , m_auditorStop = audit );
declareProperty( "AuditFinalize" , m_auditorFinalize = audit );
declareProperty( "AuditReInitialize" , m_auditorReinitialize = audit );
declareProperty( "AuditReStart" , m_auditorRestart = audit );
}

Service::~Service | ( |  | ) |
| protected virtual

Standard Destructor.

Definition at line 440 of file Service.cpp.

{
delete m_propertyMgr;
}

## Member Function Documentation

SmartIF< IAuditorSvc > & Service::auditorSvc | ( |  | ) | const

The standard auditor service.May not be invoked before sysInitialize() has been invoked.

Definition at line 444 of file Service.cpp.

{
if ( !m_pAuditorSvc.isValid() ) {
m_pAuditorSvc = serviceLocator()->service("AuditorSvc");
if( !m_pAuditorSvc.isValid() ) {
throw GaudiException("Service [AuditorSvc] not found", name(), StatusCode::FAILURE);
}
}
return m_pAuditorSvc;
}

virtual StatusCode Service::configure | ( |  | ) |
| inline virtual

Definition at line 48 of file Service.h.

{ return StatusCode::SUCCESS; }
template<class T >

Property* Service::declareProperty | ( | const std::string & | name,
|  | T & | property,
|  | const std::string & | doc = `"none"`
| ) |  | const
| inline

Declare the named property.

MySvc ( const std::string& name ,
ISvcLocator* pSvc )
: Service ( name , pSvc )
, m_property1 ( ... )
, m_property2 ( ... )
{
// declare the property
declareProperty( "Property1" , m_property1 , "Doc for property #1" ) ;
// declare the property and attach the handler to it
declareProperty( "Property2" , m_property2 , "Doc for property #2" )
-> declareUpdateHandler( &MySvc::handler_2 ) ;
}

See Also
  PropertyMgr
  PropertyMgr::declareProperty

Parameters

  name | the property name
  property | the property itself,
  doc | the documentation string

Returns
  the actual property objects

Definition at line 209 of file Service.h.

{
return m_propertyMgr -> declareProperty ( name , property , doc ) ;
}

Property* Service::declareRemoteProperty | ( | const std::string & | name,
|  | IProperty * | rsvc,
|  | const std::string & | rname = `""`
| ) |  | const
| inline

Declare remote named properties.

This is used to declare as a local property a property of another services or algorithm. The only needed information is IProperty interface of the remote service and the its property name if different of the current one.

Parameters

  name | Local property name
  rsvc | Remote IProperty interface
  rname | Name of the property at remote service

Definition at line 225 of file Service.h.

{
return m_propertyMgr -> declareRemoteProperty ( name , rsvc , rname ) ;
}

StatusCode Service::finalize | ( |  | ) |
| virtual

Reimplemented in MultiStoreSvc, Gaudi::Utils::StopSignalHandler, DataSvc, PersistencySvc, HistogramSvc, DataOnDemandSvc, Gaudi::RootCnvSvc, GslSvc, EventCollectionSelector, EventSelector, ConversionSvc, Gaudi::RootPerfMonSvc, Gaudi::ParticlePropertySvc, MinimalEventLoopMgr, Gaudi::IODataManager, EventLoopMgr, RndmGenSvc, Gaudi::MultiFileCatalog, CounterSvc, RndmEngine, IncidentSvc, HistogramPersistencySvc, Gaudi::RootEvtSelector, StalledEventMonitor, AppMgrRunable, IoComponentMgr, MessageSvc, HistorySvc, AlgContextSvc, ChronoStatSvc, NTupleSvc, EvtPersistencySvc, DetDataSvc, ExceptionSvc, HepRndm::Engine< TYPE >, FileMgr, ToolSvc, JobOptionsSvc, TagCollectionSvc, AuditorSvc, THistSvc, RecordDataSvc, VFSSvc, PartPropSvc, PythonScriptingSvc, RootHistCnv::PersSvc, IssueLogger, EvtDataSvc, StatusCodeSvc, and DetPersistencySvc.

Definition at line 199 of file Service.cpp.

{
//MsgStream log(msgSvc(),name());
//m_state = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::TERMINATE,m_state);
return StatusCode::SUCCESS;
}

virtual Gaudi::StateMachine::State Service::FSMState | ( |  | ) | const
| inline virtual

Definition at line 54 of file Service.h.

{ return m_state; }

const std::vector< Property * > & Service::getProperties | ( |  | ) | const
| virtual

Definition at line 366 of file Service.cpp.

{
return m_propertyMgr->getProperties();
}

StatusCode Service::getProperty | ( | Property * | p | ) | const
| virtual

Reimplemented in JobOptionsSvc.

Definition at line 354 of file Service.cpp.

{
return m_propertyMgr->getProperty(p);
}

const Property & Service::getProperty | ( | const std::string & | name | ) | const
| virtual

Definition at line 358 of file Service.cpp.

{
return m_propertyMgr->getProperty(n);
}

StatusCode Service::getProperty | ( | const std::string & | n,
|  | std::string & | v
| ) |  | const
| virtual

Definition at line 362 of file Service.cpp.

{
return m_propertyMgr->getProperty(n,v);
}

StatusCode Service::initialize | ( |  | ) |
| virtual

Reimplemented in MultiStoreSvc, DataSvc, Gaudi::Utils::StopSignalHandler, PersistencySvc, HistogramSvc, DataOnDemandSvc, Gaudi::RootCnvSvc, GslSvc, EventCollectionSelector, EventSelector, ConversionSvc, Gaudi::RootPerfMonSvc, Gaudi::ParticlePropertySvc, Gaudi::IODataManager, MinimalEventLoopMgr, EventLoopMgr, RndmGenSvc, Gaudi::MultiFileCatalog, IncidentSvc, RndmEngine, HistogramPersistencySvc, Gaudi::RootEvtSelector, IoComponentMgr, MessageSvc, HistorySvc, AlgContextSvc, ChronoStatSvc, AppMgrRunable, EvtPersistencySvc, NTupleSvc, StalledEventMonitor, ExceptionSvc, FileMgr, HepRndm::Engine< TYPE >, DetDataSvc, JobOptionsSvc, TagCollectionSvc, ToolSvc, THistSvc, AuditorSvc, RecordDataSvc, VFSSvc, PartPropSvc, PythonScriptingSvc, RootHistCnv::PersSvc, IssueLogger, EvtDataSvc, StatusCodeSvc, and DetPersistencySvc.

Definition at line 74 of file Service.cpp.

{
// Set the Algorithm's properties
StatusCode sc = setProperties();
ON_DEBUG debug() << "Service base class initialized successfully" << endmsg;
m_state = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::CONFIGURE,m_state);
return sc ;
}

void Service::initOutputLevel | ( | Property & | prop | ) |
| private

callback for output level property

Definition at line 432 of file Service.cpp.

{
if ( (name() != "MessageSvc") && msgSvc().isValid() ) {
msgSvc()->setOutputLevel( name(), m_outputLevel );
}
updateMsgStreamOutputLevel(m_outputLevel);
}

const std::string & Service::name | ( |  | ) | const
| virtual

Retrieve name of the service.

Implements CommonMessaging< implements3< IService, IProperty, IStateful > >.

Definition at line 331 of file Service.cpp.

{
return m_name;
}

int Service::outputLevel | ( |  | ) | const
| inline protected

get the `Service's` output level

Definition at line 248 of file Service.h.

{ return m_outputLevel.value(); }

StatusCode Service::reinitialize | ( |  | ) |
| virtual

Reimplemented in MultiStoreSvc, DataSvc, HistogramSvc, DataOnDemandSvc, EventSelector, MinimalEventLoopMgr, EventLoopMgr, HistogramPersistencySvc, HistorySvc, MessageSvc, NTupleSvc, DetDataSvc, THistSvc, RecordDataSvc, PartPropSvc, IssueLogger, EvtDataSvc, and StatusCodeSvc.

Definition at line 294 of file Service.cpp.

{
/* @TODO
* MCl 2008-10-23: the implementation of reinitialize as finalize+initialize
* is causing too many problems
*
// Default implementation is finalize+initialize
StatusCode sc = finalize();
if (sc.isFailure()) {
error() << "reinitialize(): cannot be finalized" << endmsg;
return sc;
}
sc = initialize();
if (sc.isFailure()) {
error() << "reinitialize(): cannot be initialized" << endmsg;
return sc;
}
*/
return StatusCode::SUCCESS;
}

unsigned long Service::release | ( |  | ) |
| virtual

Release Interface instance.

Specialized implementation because the default one is not enough.

Definition at line 24 of file Service.cpp.

{
// Avoid to decrement 0
const unsigned long count = (m_refCount) ? --m_refCount : m_refCount;
if( count == 0) {
if (m_svcManager!=0) {
m_svcManager->removeService(this).ignore();
}
delete this;
}
return count;
}

StatusCode Service::restart | ( |  | ) |
| virtual

Reimplemented in MinimalEventLoopMgr.

Definition at line 315 of file Service.cpp.

{
// Default implementation is stop+start
StatusCode sc = stop();
if (sc.isFailure()) {
error() << "restart(): cannot be stopped" << endmsg;
return sc;
}
sc = start();
if (sc.isFailure()) {
error() << "restart(): cannot be started" << endmsg;
return sc;
}
return StatusCode::SUCCESS;
}
template<class T >

StatusCode Service::service | ( | const std::string & | name,
|  | const T *& | psvc,
|  | bool | createIf = `true`
| ) |  | const
| inline

Access a service by name, creating it if it doesn't already exist.

Definition at line 140 of file Service.h.

{
ISvcLocator& svcLoc = *serviceLocator();
SmartIF<T> ptr(
ServiceLocatorHelper(svcLoc, *this).service(name, !createIf, // quiet
createIf));
if (ptr.isValid()) {
psvc = ptr.get();
const_cast<T*>(psvc)->addRef();
return StatusCode::SUCCESS;
}
// else
psvc = 0;
return StatusCode::FAILURE;
}
template<class T >

StatusCode Service::service | ( | const std::string & | name,
|  | T *& | psvc,
|  | bool | createIf = `true`
| ) |  | const
| inline

Definition at line 156 of file Service.h.

{
ISvcLocator& svcLoc = *serviceLocator();
SmartIF<T> ptr(
ServiceLocatorHelper(svcLoc, *this).service(name, !createIf, // quiet
createIf));
if (ptr.isValid()) {
psvc = ptr.get();
psvc->addRef();
return StatusCode::SUCCESS;
}
// else
psvc = 0;
return StatusCode::FAILURE;
}
template<class T >

StatusCode Service::service | ( | const std::string & | svcType,
|  | const std::string & | svcName,
|  | T *& | psvc
| ) |  | const
| inline

Access a service by name and type, creating it if it doesn't already exist.

Definition at line 174 of file Service.h.

{
return service(svcType + "/" + svcName, psvc);
}

SmartIF< ISvcLocator > & Service::serviceLocator | ( |  | ) | const
| virtual

Retrieve pointer to service locator.

Implements CommonMessaging< implements3< IService, IProperty, IStateful > >.

Definition at line 336 of file Service.cpp.

{
return m_svcLocator;
}

StatusCode Service::setProperties | ( |  | ) |

Method for setting declared properties to the values specified for the job.

Definition at line 371 of file Service.cpp.

{
const bool CREATEIF(true);
SmartIF<IJobOptionsSvc> jos(serviceLocator()->service("JobOptionsSvc", CREATEIF));
if( !jos.isValid() ) {
throw GaudiException("Service [JobOptionsSvc] not found", name(), StatusCode::FAILURE);
}
// set first generic Properties
StatusCode sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this );
if( sc.isFailure() ) return sc;
// set specific Properties
if (isGaudiThreaded(name())) {
if (jos->setMyProperties( name(), this ).isFailure()) {
return StatusCode::FAILURE;
}
}
return StatusCode::SUCCESS;
}

StatusCode Service::setProperty | ( | const Property & | p | ) |
| virtual

Reimplemented in JobOptionsSvc.

Definition at line 342 of file Service.cpp.

{
return m_propertyMgr->setProperty(p);
}

StatusCode Service::setProperty | ( | const std::string & | s | ) |
| virtual

Definition at line 346 of file Service.cpp.

{
return m_propertyMgr->setProperty(s);
}

StatusCode Service::setProperty | ( | const std::string & | n,
|  | const std::string & | v
| ) |  |
| virtual

Definition at line 350 of file Service.cpp.

{
return m_propertyMgr->setProperty(n,v);
}
template<class TYPE >

StatusCode Service::setProperty | ( | const std::string & | name,
|  | const TYPE & | value
| ) |  |
| inline

set the property form the value

std::vector<double> data = ... ;
setProperty( "Data" , data ) ;
std::map<std::string,double> cuts = ... ;
setProperty( "Cuts" , cuts ) ;
std::map<std::string,std::string> dict = ... ;
setProperty( "Dictionary" , dict ) ;

Note: the interface IProperty allows setting of the properties either directly from other properties or from strings only

This is very convenient in resetting of the default properties in the derived classes. E.g. without this method one needs to convert everything into strings to use IProperty::setProperty

setProperty ( "OutputLevel" , "1" ) ;
setProperty ( "Enable" , "True" ) ;
setProperty ( "ErrorMax" , "10" ) ;

For simple cases it is more or less ok, but for complicated properties it is just ugly..

Parameters

  name | name of the property
  value | value of the property

See Also
  Gaudi::Utils::setProperty

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2007-05-13

Definition at line 123 of file Service.h.

{ return Gaudi::Utils::setProperty ( m_propertyMgr , name , value ) ; }

void Service::setServiceManager | ( | ISvcManager * | ism | ) |
| private

Definition at line 455 of file Service.cpp.

{
m_svcManager = ism;
}

StatusCode Service::start | ( |  | ) |
| virtual

Reimplemented in MinimalEventLoopMgr, AppMgrRunable, StalledEventMonitor, and ToolSvc.

Definition at line 158 of file Service.cpp.

{
// stub implementation
return StatusCode::SUCCESS;
}

StatusCode Service::stop | ( |  | ) |
| virtual

Reimplemented in Gaudi::RootPerfMonSvc, MinimalEventLoopMgr, EventLoopMgr, HistorySvc, StalledEventMonitor, AppMgrRunable, and ToolSvc.

Definition at line 152 of file Service.cpp.

{
// stub implementation
return StatusCode::SUCCESS;
}

StatusCode Service::sysFinalize | ( |  | ) |
| virtual

Finalize Service.

Reimplemented in AuditorSvc.

Definition at line 164 of file Service.cpp.

{
StatusCode sc(StatusCode::FAILURE);
try {
m_targetState = Gaudi::StateMachine::OFFLINE;
Gaudi::Guards::AuditorGuard guard(this,
// check if we want to audit the initialize
(m_auditorFinalize) ? auditorSvc().get() : 0,
IAuditor::Finalize);
sc = finalize();
if (sc.isSuccess())
m_state = m_targetState;
}
catch( const GaudiException& Exception ) {
fatal() << " Exception with tag=" << Exception.tag()
<< " is caught " << endmsg;
error() << Exception << endmsg;
// Stat stat( chronoSvc() , Exception.tag() ) ;
}
catch( const std::exception& Exception ) {
fatal() << " Standard std::exception is caught " << endmsg;
error() << Exception.what() << endmsg;
// Stat stat( chronoSvc() , "*std::exception*" ) ;
}
catch( ... ) {
fatal() << "UNKNOWN Exception is caught " << endmsg;
// Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
}
m_pAuditorSvc = 0;
return sc;
}

StatusCode Service::sysInitialize | ( |  | ) |
| virtual

Initialize Service.

Reimplemented in AuditorSvc.

Definition at line 37 of file Service.cpp.

{
StatusCode sc;
try {
m_targetState = Gaudi::StateMachine::INITIALIZED;
Gaudi::Guards::AuditorGuard guard(this,
// check if we want to audit the initialize
(m_auditorInitialize) ? auditorSvc().get() : 0,
IAuditor::Initialize);
if ((name() != "MessageSvc") && msgSvc().isValid()) // pre-set the outputLevel from the MessageSvc value
m_outputLevel = msgSvc()->outputLevel(name());
sc = initialize(); // This should change the state to Gaudi::StateMachine::CONFIGURED
if (sc.isSuccess())
m_state = m_targetState;
return sc;
}
catch ( const GaudiException& Exception ) {
fatal() << "in sysInitialize(): exception with tag=" << Exception.tag()
<< " is caught" << endmsg;
error() << Exception << endmsg;
// Stat stat( chronoSvc() , Exception.tag() );
}
catch( const std::exception& Exception ) {
fatal() << "in sysInitialize(): standard std::exception is caught" << endmsg;
error() << Exception.what() << endmsg;
// Stat stat( chronoSvc() , "*std::exception*" );
}
catch(...) {
fatal() << "in sysInitialize(): UNKNOWN Exception is caught" << endmsg;
// Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
}
return StatusCode::FAILURE;
}

StatusCode Service::sysReinitialize | ( |  | ) |
| virtual

Re-initialize the Service.

Definition at line 206 of file Service.cpp.

{
StatusCode sc;
// Check that the current status is the correct one.
if ( Gaudi::StateMachine::INITIALIZED != FSMState() ) {
MsgStream log ( msgSvc() , name() );
error()
<< "sysReinitialize(): cannot reinitialize service not initialized"
<< endmsg;
return StatusCode::FAILURE;
}
try {
Gaudi::Guards::AuditorGuard guard(this,
// check if we want to audit the initialize
(m_auditorReinitialize) ? auditorSvc().get() : 0,
IAuditor::ReInitialize);
sc = reinitialize();
return sc;
}
catch( const GaudiException& Exception ) {
MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
fatal() << " Exception with tag=" << Exception.tag()
<< " is caught " << endmsg;
error() << Exception << endmsg;
// Stat stat( chronoSvc() , Exception.tag() ) ;
}
catch( const std::exception& Exception ) {
MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
fatal() << " Standard std::exception is caught " << endmsg;
error() << Exception.what() << endmsg;
// Stat stat( chronoSvc() , "*std::exception*" ) ;
}
catch( ... ) {
MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
fatal() << "UNKNOWN Exception is caught " << endmsg;
// Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
}
return StatusCode::FAILURE ;
}

StatusCode Service::sysRestart | ( |  | ) |
| virtual

Re-initialize the Service.

Definition at line 251 of file Service.cpp.

{
StatusCode sc;
// Check that the current status is the correct one.
if ( Gaudi::StateMachine::RUNNING != FSMState() ) {
MsgStream log ( msgSvc() , name() );
error()
<< "sysRestart(): cannot restart service in state " << FSMState()
<< " -- must be RUNNING "
<< endmsg;
return StatusCode::FAILURE;
}
try {
Gaudi::Guards::AuditorGuard guard(this,
// check if we want to audit the initialize
(m_auditorRestart) ? auditorSvc().get() : 0,
IAuditor::ReStart);
sc = restart();
return sc;
}
catch( const GaudiException& Exception ) {
fatal() << " Exception with tag=" << Exception.tag()
<< " is caught " << endmsg;
error() << Exception << endmsg;
// Stat stat( chronoSvc() , Exception.tag() ) ;
}
catch( const std::exception& Exception ) {
fatal() << " Standard std::exception is caught " << endmsg;
error() << Exception.what() << endmsg;
// Stat stat( chronoSvc() , "*std::exception*" ) ;
}
catch( ... ) {
fatal() << "UNKNOWN Exception is caught " << endmsg;
// Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
}
return StatusCode::FAILURE ;
}

StatusCode Service::sysStart | ( |  | ) |
| virtual

Initialize Service.

Definition at line 83 of file Service.cpp.

{
StatusCode sc;
try {
m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state);
Gaudi::Guards::AuditorGuard guard(this,
// check if we want to audit the initialize
(m_auditorStart) ? auditorSvc().get() : 0,
IAuditor::Start);
sc = start();
if (sc.isSuccess())
m_state = m_targetState;
return sc;
}
catch ( const GaudiException& Exception ) {
fatal() << "in sysStart(): exception with tag=" << Exception.tag()
<< " is caught" << endmsg;
error() << Exception << endmsg;
// Stat stat( chronoSvc() , Exception.tag() );
}
catch( const std::exception& Exception ) {
fatal() << "in sysStart(): standard std::exception is caught" << endmsg;
fatal() << Exception.what() << endmsg;
// Stat stat( chronoSvc() , "*std::exception*" );
}
catch(...) {
fatal() << "in sysStart(): UNKNOWN Exception is caught" << endmsg;
// Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
}
return StatusCode::FAILURE;
}

StatusCode Service::sysStop | ( |  | ) |
| virtual

Initialize Service.

Definition at line 117 of file Service.cpp.

{
StatusCode sc;
try {
m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::STOP,m_state);
Gaudi::Guards::AuditorGuard guard(this,
// check if we want to audit the initialize
(m_auditorStop) ? auditorSvc().get() : 0,
IAuditor::Stop);
sc = stop();
if (sc.isSuccess())
m_state = m_targetState;
return sc;
}
catch ( const GaudiException& Exception ) {
fatal() << "in sysStop(): exception with tag=" << Exception.tag()
<< " is caught" << endmsg;
error() << Exception << endmsg;
// Stat stat( chronoSvc() , Exception.tag() );
}
catch( const std::exception& Exception ) {
fatal() << "in sysStop(): standard std::exception is caught" << endmsg;
error() << Exception.what() << endmsg;
// Stat stat( chronoSvc() , "*std::exception*" );
}
catch(...) {
fatal() << "in sysStop(): UNKNOWN Exception is caught" << endmsg;
// Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
}
return StatusCode::FAILURE;
}

virtual Gaudi::StateMachine::State Service::targetFSMState | ( |  | ) | const
| inline virtual

Definition at line 55 of file Service.h.

{ return m_targetState; }

virtual StatusCode Service::terminate | ( |  | ) |
| inline virtual

Definition at line 53 of file Service.h.

{ return StatusCode::SUCCESS; }

## Friends And Related Function Documentation

friend class ServiceManager
| friend

Definition at line 38 of file Service.h.

## Member Data Documentation

BooleanProperty Service::m_auditInit
| private

Definition at line 263 of file Service.h.

bool Service::m_auditorFinalize
| private

Definition at line 267 of file Service.h.

bool Service::m_auditorInitialize
| private

Definition at line 264 of file Service.h.

bool Service::m_auditorReinitialize
| private

Definition at line 268 of file Service.h.

bool Service::m_auditorRestart
| private

Definition at line 269 of file Service.h.

bool Service::m_auditorStart
| private

Definition at line 265 of file Service.h.

bool Service::m_auditorStop
| private

Definition at line 266 of file Service.h.

std::string Service::m_name
| private

Service Name.

Definition at line 252 of file Service.h.

IntegerProperty Service::m_outputLevel
| protected

Service output level.

Definition at line 241 of file Service.h.

SmartIF<IAuditorSvc> Service::m_pAuditorSvc
| mutable private

Auditor Service.

Definition at line 262 of file Service.h.

PropertyMgr* Service::m_propertyMgr
| private

Property Manager.

Definition at line 257 of file Service.h.

Gaudi::StateMachine::State Service::m_state
| protected

Service state.

Definition at line 243 of file Service.h.

SmartIF<ISvcLocator> Service::m_svcLocator
| mutable private

Service Locator reference.

Definition at line 254 of file Service.h.

SmartIF<ISvcManager> Service::m_svcManager
| private

Definition at line 255 of file Service.h.

Gaudi::StateMachine::State Service::m_targetState
| protected

Service state.

Definition at line 245 of file Service.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiKernel/GaudiKernel/Service.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiKernel/src/Lib/Service.cpp