| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 2012

Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends

# Service Class Reference

Base class for all services. More...

`#include <Service.h>`

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

List of all members.

## 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.
## Protected Member Functions
virtual | ~Service ()
| Standard Destructor.
int | outputLevel () const
| get the `Service's` output level
## Protected Attributes
IntegerProperty | m_outputLevel
| Service output level.
Gaudi::StateMachine::State | m_state
| Service state.
Gaudi::StateMachine::State | m_targetState
| Service state.
## 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 34 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 46 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 fro property #1" ) ;

         // declare the property and attach the handler  to it
         declareProperty( "Property2" , m_property2 , "Doc for property #2" )
            -> declareUpdateHandler( &MyAlg::handler_2 ) ;

       }

See also:
  PropertyMgr
  PropertyMgr::declareProperty

Parameters:

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

Returns:
  the actual property objects

Definition at line 207 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 223 of file Service.h.

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

StatusCode Service::finalize | ( | void | ) | `[virtual]`

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

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 52 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 | ( | void | ) | `[virtual]`

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

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

Reimplemented in MessageSvc.

Definition at line 246 of file Service.h.

    { return m_outputLevel.value(); }

StatusCode Service::reinitialize | ( | ) | `[virtual]`

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

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 & | 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 172 of file Service.h.

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

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 138 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 154 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;
      }

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;
    }

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 convinient 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 ibelyaev@physics.syr.edu

Date:
  2007-05-13

Definition at line 121 of file Service.h.

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

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);
    }

void Service::setServiceManager | ( | ISvcManager * | ism ) | `[private]`

Definition at line 455 of file Service.cpp.

                                               {
      m_svcManager = ism;
    }

StatusCode Service::start | ( | ) | `[virtual]`

Reimplemented in AppMgrRunable, ToolSvc, MinimalEventLoopMgr, and StalledEventMonitor.

Definition at line 158 of file Service.cpp.

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

StatusCode Service::stop | ( | ) | `[virtual]`

Reimplemented in AppMgrRunable, EventLoopMgr, ToolSvc, MinimalEventLoopMgr, HistorySvc, and StalledEventMonitor.

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 53 of file Service.h.

    { return m_targetState; }

virtual StatusCode Service::terminate | ( | ) | `[inline, virtual]`

Definition at line 51 of file Service.h.

    { return StatusCode::SUCCESS; }

## Friends And Related Function Documentation

friend class ServiceManager`[friend]`

Definition at line 36 of file Service.h.

## Member Data Documentation

BooleanProperty Service::m_auditInit`[private]`

Definition at line 261 of file Service.h.

bool Service::m_auditorFinalize`[private]`

Definition at line 265 of file Service.h.

bool Service::m_auditorInitialize`[private]`

Definition at line 262 of file Service.h.

bool Service::m_auditorReinitialize`[private]`

Definition at line 266 of file Service.h.

bool Service::m_auditorRestart`[private]`

Definition at line 267 of file Service.h.

bool Service::m_auditorStart`[private]`

Definition at line 263 of file Service.h.

bool Service::m_auditorStop`[private]`

Definition at line 264 of file Service.h.

std::string Service::m_name`[private]`

Service Name.

Definition at line 250 of file Service.h.

IntegerProperty Service::m_outputLevel`[protected]`

Service output level.

Definition at line 239 of file Service.h.

SmartIF<IAuditorSvc> Service::m_pAuditorSvc`[mutable, private]`

Auditor Service.

Definition at line 260 of file Service.h.

PropertyMgr* Service::m_propertyMgr`[private]`

Property Manager.

Definition at line 255 of file Service.h.

Gaudi::StateMachine::State Service::m_state`[protected]`

Service state.

Reimplemented in MinimalEventLoopMgr.

Definition at line 241 of file Service.h.

SmartIF<ISvcLocator> Service::m_svcLocator`[mutable, private]`

Service Locator reference.

Definition at line 252 of file Service.h.

SmartIF<ISvcManager> Service::m_svcManager`[private]`

Definition at line 253 of file Service.h.

Gaudi::StateMachine::State Service::m_targetState`[protected]`

Service state.

Definition at line 243 of file Service.h.

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines