Gaudi Framework, version v20r2

Generated: 18 Jul 2008

Service Class Reference

#include <Service.h>

Inheritance diagram for Service:

Inheritance graph
[legend]
Collaboration diagram for Service:

Collaboration graph
[legend]
List of all members.

Detailed Description

Base class for all services.

It implements the IService and IProperty interfaces.

Author:
Pere Mato

Definition at line 30 of file Service.h.

Public Member Functions

virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 Query interfaces of Interface.
virtual unsigned long addRef ()
 Reference Interface instance.
virtual unsigned long release ()
 Release Interface instance.
virtual const std::stringname () const
 Retrieve name of the service.
virtual const InterfaceIDtype () const
 Retrieve ID of the Service.
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED).
virtual StatusCode initialize ()
 Initialization (from CONFIGURED to INITIALIZED).
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING).
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED).
virtual StatusCode finalize ()
 Finalize (from INITIALIZED to CONFIGURED).
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE).
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state.
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us.
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED).
virtual StatusCode sysInitialize ()
 Initilize Service.
virtual StatusCode sysStart ()
 Initilize Service.
virtual StatusCode sysStop ()
 Initilize 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)
 Set the property by property.
virtual StatusCode setProperty (const std::string &s)
 Set the property by string.
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string.
virtual StatusCode getProperty (Property *p) const
 Get the property by property.
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name.
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string.
virtual const std::vector<
Property * > & 
getProperties () const
 Get list of properties.
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.
ISvcLocatorserviceLocator () const
 Retrieve pointer to service locator.
IMessageSvcmsgSvc ()
 Retrieve pointer to message service.
IMessageSvcmsgSvc () const
IMessageSvcmessageService ()
IMessageSvcmessageService () const
StatusCode setProperties ()
 Method for setting declared properties to the values specifed for the job.
template<class T>
StatusCode service (const std::string &name, 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 &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>
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties.
IAuditorSvcauditorSvc () 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.
IMessageSvcm_messageSvc
 MessageSvc reference.

Private Member Functions

StatusCode service_i (const std::string &svcName, bool createIf, const InterfaceID &iid, void **ppSvc) const
 implementation of service method
StatusCode service_i (const std::string &svcType, const std::string &svcName, const InterfaceID &iid, void **ppSvc) const
void setServiceManager (ISvcManager *)
void initOutputLevel (Property &prop)
 callback for output level property

Private Attributes

std::string m_name
 Service Name.
unsigned long m_refCount
 Reference counter.
ISvcLocatorm_svcLocator
 Service Locator reference.
ISvcManagerm_svcManager
PropertyMgrm_propertyMgr
 Property Manager.
IAuditorSvcm_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


Constructor & Destructor Documentation

Service::Service ( const std::string name,
ISvcLocator svcloc 
)

Standard Constructor.

Definition at line 477 of file Service.cpp.

References declareProperty(), Property::declareUpdateHandler(), IProperty::getProperty(), StatusCode::ignore(), initOutputLevel(), StatusCode::isSuccess(), m_auditInit, m_auditorFinalize, m_auditorInitialize, m_auditorReinitialize, m_auditorRestart, m_auditorStart, m_auditorStop, m_messageSvc, m_name, m_outputLevel, m_pAuditorSvc, m_propertyMgr, m_refCount, m_state, m_svcLocator, m_svcManager, m_targetState, msgSvc(), name(), MSG::NIL, Gaudi::StateMachine::OFFLINE, IMessageSvc::outputLevel(), ISvcLocator::service(), setProperty(), and PropertyWithValue< TYPE >::value().

00477                                                             {
00478   m_name       = name;
00479   m_refCount   = 0;
00480   m_svcLocator = svcloc;
00481   m_svcManager = 0;
00482   m_messageSvc = 0;
00483   m_state      = Gaudi::StateMachine::OFFLINE;
00484   m_targetState = Gaudi::StateMachine::OFFLINE;
00485   m_propertyMgr = new PropertyMgr();
00486   m_pAuditorSvc = 0;
00487   m_outputLevel = MSG::NIL;
00488   // Declare common Service properties with their defaults
00489   if ( name != "MessageSvc" )  {
00490     m_outputLevel = msgSvc()->outputLevel();
00491   }
00492   declareProperty( "OutputLevel", m_outputLevel);
00493   m_outputLevel.declareUpdateHandler(&Service::initOutputLevel, this);
00494 
00495   // Get the default setting for service auditing from the AppMgr
00496   declareProperty( "AuditServices", m_auditInit=true );
00497 
00498   IProperty *appMgr;
00499   bool audit(false);
00500   if (m_svcLocator->service("ApplicationMgr", appMgr, false).isSuccess()) {
00501     const Property& prop = appMgr->getProperty("AuditServices");
00502     Property &pr = const_cast<Property&>(prop);
00503     if (m_name != "IncidentSvc") {
00504       setProperty( pr ).ignore();
00505       audit = m_auditInit.value();
00506     } else {
00507       audit = false;
00508     }
00509   }
00510 
00511   declareProperty( "AuditInitialize"   , m_auditorInitialize   = audit );
00512   declareProperty( "AuditStart"        , m_auditorStart        = audit );
00513   declareProperty( "AuditStop"         , m_auditorStop         = audit );
00514   declareProperty( "AuditFinalize"     , m_auditorFinalize     = audit );
00515   declareProperty( "AuditReInitialize" , m_auditorReinitialize = audit );
00516   declareProperty( "AuditReStart"      , m_auditorRestart      = audit );
00517 
00518 }

Service::~Service (  )  [protected, virtual]

Standard Destructor.

Definition at line 528 of file Service.cpp.

References m_propertyMgr.

00528                   {
00529   delete m_propertyMgr;
00530 }


Member Function Documentation

StatusCode Service::queryInterface ( const InterfaceID riid,
void **  ppvUnknown 
) [virtual]

Query interfaces of Interface.

Parameters:
riid ID of Interface to be retrieved
ppvUnknown Pointer to Location for interface pointer

Implements IInterface.

Reimplemented in GslSvc, ConversionSvc, DataSvc, MinimalEventLoopMgr, DataListenerSvc, PoolDbCacheSvc, PoolDbCnvSvc, PoolDbEvtSelector, PythonScriptingSvc, AIDATupleSvc, AlgContextSvc, AppMgrRunable, AuditorSvc, ChronoStatSvc, CounterSvc, MultiStoreSvc, DetDataSvc, EventCollectionSelector, EventSelector, ExceptionSvc, FastContainersSvc, HistogramSvc, HistorySvc, DataOnDemandSvc, IncidentSvc, IssueLogger, JobOptionsSvc, MessageSvc, NTupleSvc, ParticlePropertySvc, PersistencySvc, RndmEngine, RndmGenSvc, StatusCodeSvc, THistSvc, ToolSvc, VFSSvc, Gaudi::IODataManager, Gaudi::MultiFileCatalog, and PartPropSvc.

Definition at line 39 of file Service.cpp.

References StatusCode::FAILURE, IInterface::interfaceID(), INamedInterface::interfaceID(), IStateful::interfaceID(), IProperty::interfaceID(), and IService::interfaceID().

Referenced by PartPropSvc::queryInterface(), Gaudi::IODataManager::queryInterface(), VFSSvc::queryInterface(), ToolSvc::queryInterface(), THistSvc::queryInterface(), StatusCodeSvc::queryInterface(), RndmGenSvc::queryInterface(), RndmEngine::queryInterface(), PersistencySvc::queryInterface(), ParticlePropertySvc::queryInterface(), MessageSvc::queryInterface(), JobOptionsSvc::queryInterface(), IssueLogger::queryInterface(), IncidentSvc::queryInterface(), DataOnDemandSvc::queryInterface(), HistorySvc::queryInterface(), ExceptionSvc::queryInterface(), EventSelector::queryInterface(), EventCollectionSelector::queryInterface(), MultiStoreSvc::queryInterface(), CounterSvc::queryInterface(), ChronoStatSvc::queryInterface(), AuditorSvc::queryInterface(), AppMgrRunable::queryInterface(), AlgContextSvc::queryInterface(), PythonScriptingSvc::queryInterface(), PoolDbEvtSelector::queryInterface(), PoolDbCacheSvc::queryInterface(), DataListenerSvc::queryInterface(), MinimalEventLoopMgr::queryInterface(), DataSvc::queryInterface(), ConversionSvc::queryInterface(), and GslSvc::queryInterface().

00041 {
00042   if ( 0 == ppvi ) { return StatusCode::FAILURE ; } // RETURN 
00043   //
00044   if      ( IService        ::interfaceID() . versionMatch ( riid ) )  
00045   { *ppvi = static_cast<IService*>        ( this ) ; }
00046   else if ( IProperty       ::interfaceID() . versionMatch ( riid ) )  
00047   { *ppvi = static_cast<IProperty*>       ( this ) ; }
00048   else if ( IStateful       ::interfaceID() . versionMatch ( riid ) )   
00049   { *ppvi = static_cast<IStateful*>       ( this ) ; }
00050   else if ( INamedInterface ::interfaceID() . versionMatch ( riid ) )   
00051   { *ppvi = static_cast<INamedInterface*> ( this ) ; }
00052   else if ( IInterface      ::interfaceID() . versionMatch ( riid ) )   
00053   { *ppvi = static_cast<IInterface*>      ( this ) ; }
00054   else { *ppvi = 0 ; return NO_INTERFACE ; } // RETURN 
00055   // increment reference counter 
00056   addRef();
00057   //
00058   return SUCCESS;
00059 }

unsigned long Service::addRef (  )  [virtual]

Reference Interface instance.

Implements IInterface.

Definition at line 20 of file Service.cpp.

References m_refCount.

Referenced by PartPropSvc::queryInterface(), Gaudi::IODataManager::queryInterface(), VFSSvc::queryInterface(), ToolSvc::queryInterface(), THistSvc::queryInterface(), StatusCodeSvc::queryInterface(), RndmGenSvc::queryInterface(), RndmEngine::queryInterface(), PersistencySvc::queryInterface(), MessageSvc::queryInterface(), JobOptionsSvc::queryInterface(), IssueLogger::queryInterface(), IncidentSvc::queryInterface(), HistorySvc::queryInterface(), EventSelector::queryInterface(), EventCollectionSelector::queryInterface(), MultiStoreSvc::queryInterface(), CounterSvc::queryInterface(), AuditorSvc::queryInterface(), AppMgrRunable::queryInterface(), AIDATupleSvc::queryInterface(), PythonScriptingSvc::queryInterface(), PoolDbEvtSelector::queryInterface(), PoolDbCacheSvc::queryInterface(), DataListenerSvc::queryInterface(), MinimalEventLoopMgr::queryInterface(), DataSvc::queryInterface(), and ConversionSvc::queryInterface().

00020                                 {
00021   m_refCount++;
00022   return m_refCount;
00023 }

unsigned long Service::release (  )  [virtual]

Release Interface instance.

Implements IInterface.

Definition at line 26 of file Service.cpp.

References count(), StatusCode::ignore(), m_refCount, m_svcManager, and ISvcManager::removeService().

Referenced by DataOnDemandSvc::finalize(), AlgContextSvc::finalize(), AlgContextSvc::initialize(), and DataOnDemandSvc::reinitialize().

00026                                  {
00027   unsigned long count = --m_refCount;
00028   if( count == 0) {
00029     if (m_svcManager!=0) {
00030       m_svcManager->removeService(this).ignore();
00031     }
00032     delete this;
00033   }
00034   return count;
00035 }

const std::string & Service::name (  )  const [virtual]

Retrieve name of the service.

Implements INamedInterface.

Definition at line 380 of file Service.cpp.

References m_name.

Referenced by NTupleSvc::access(), PersistencySvc::addCnvService(), IncidentSvc::addListener(), ParticlePropertySvc::addParticles(), AuditorSvc::after(), MultiStoreSvc::attachServices(), NTupleSvc::attachTuple(), auditorSvc(), AuditorSvc::before(), NTupleSvc::book(), THistSvc::browseTDir(), DetDataSvc::clearStore(), THistSvc::connect(), TagCollectionSvc::connect(), NTupleSvc::connect(), IssueLogger::connect(), AIDATupleSvc::connect(), Gaudi::IODataManager::connectDataIO(), EventCollectionSelector::connectDataSource(), HistogramSvc::connectInput(), EventCollectionSelector::connectTuple(), ToolSvc::create(), EventCollectionSelector::createAddress(), EventSelector::createContext(), EventCollectionSelector::createContext(), PoolDbCnvSvc::createConverter(), HistogramSvc::createDirectory(), AIDATupleSvc::createDirectory(), HistogramSvc::createHistogram1D(), HistogramSvc::createHistogram2D(), HistogramSvc::createHistogram3D(), HistogramSvc::createPath(), AIDATupleSvc::createPath(), HistogramSvc::createProfile1D(), HistogramSvc::createProfile2D(), RootHistCnv::PersSvc::createRep(), NTupleSvc::createService(), DataListenerSvc::declareInfo(), declareProperty(), declareRemoteProperty(), MinimalEventLoopMgr::decodeOutStreams(), MinimalEventLoopMgr::decodeTopAlgs(), THistSvc::deReg(), Gaudi::IODataManager::disconnect(), JobOptionsSvc::dump(), ParticlePropertySvc::erase(), Gaudi::IODataManager::error(), EventLoopMgr::executeEvent(), MinimalEventLoopMgr::executeEvent(), MinimalEventLoopMgr::executeRun(), PartPropSvc::finalize(), RootHistCnv::PersSvc::finalize(), ToolSvc::finalize(), THistSvc::finalize(), StatusCodeSvc::finalize(), ParticlePropertySvc::finalize(), IssueLogger::finalize(), HistogramSvc::finalize(), FastContainersSvc::finalize(), ExceptionSvc::finalize(), EventSelector::finalize(), DetDataSvc::finalize(), ChronoStatSvc::finalize(), EventLoopMgr::finalize(), AlgContextSvc::finalize(), AIDATupleSvc::finalize(), PoolDbEvtSelector::finalize(), PoolDbCnvSvc::finalize(), PoolDbCacheSvc::finalize(), MinimalEventLoopMgr::finalize(), ConversionSvc::finalize(), GslSvc::finalize(), ParticlePropertySvc::find(), AuditorSvc::findAuditor_(), IncidentSvc::fireIncident(), EventSelector::firstOfNextStream(), AuditorSvc::getAuditor(), EventLoopMgr::getEventRoot(), THistSvc::getTHists(), THistSvc::getTTrees(), DetDataSvc::handle(), AlgContextSvc::handle(), DataSvc::handleDataFault(), PartPropSvc::initialize(), RootHistCnv::PersSvc::initialize(), HbookCnv::PersSvc::initialize(), Gaudi::IODataManager::initialize(), VFSSvc::initialize(), ToolSvc::initialize(), THistSvc::initialize(), StatusCodeSvc::initialize(), RndmGenSvc::initialize(), HepRndm::Engine< TYPE >::initialize(), PersistencySvc::initialize(), ParticlePropertySvc::initialize(), IncidentSvc::initialize(), HistorySvc::initialize(), HistogramSvc::initialize(), FastContainersSvc::initialize(), ExceptionSvc::initialize(), EventSelector::initialize(), EventCollectionSelector::initialize(), MultiStoreSvc::initialize(), ChronoStatSvc::initialize(), EventLoopMgr::initialize(), AlgContextSvc::initialize(), AIDATupleSvc::initialize(), PythonScriptingSvc::initialize(), PoolDbEvtSelector::initialize(), PoolDbCnvSvc::initialize(), PoolDbCacheSvc::initialize(), DataListenerSvc::initialize(), initialize(), MinimalEventLoopMgr::initialize(), DataSvc::initialize(), GslSvc::initialize(), initOutputLevel(), MessageSvc::insertStream(), EventSelector::lastOfPreviousStream(), StatusCodeSvc::list(), PoolDbCnvSvc::loadConverter(), PoolDbCacheSvc::loadDictionary(), DataSvc::loadObject(), ConversionSvc::makeCall(), PoolDbCnvSvc::markUpdate(), THistSvc::MergeRootFile(), msgSvc(), ToolSvc::nameTool(), EventLoopMgr::nextEvent(), MinimalEventLoopMgr::nextEvent(), HistogramSvc::not_implemented(), ParticlePropertySvc::parse(), PoolDbEvtSelector::previous(), CounterSvc::print(), EventSelector::printEvtInfo(), HistogramSvc::projectionX(), HistogramSvc::projectionY(), JobOptionsSvc::readOptions(), Gaudi::IODataManager::reconnect(), StatusCodeSvc::regFnc(), THistSvc::regGraph(), DataSvc::registerObject(), THistSvc::reinitialize(), StatusCodeSvc::reinitialize(), HistogramPersistencySvc::reinitialize(), IssueLogger::reinitialize(), EventSelector::reinitialize(), DetDataSvc::reinitialize(), MultiStoreSvc::reinitialize(), EventLoopMgr::reinitialize(), reinitialize(), MinimalEventLoopMgr::reinitialize(), DataSvc::reinitialize(), ToolSvc::releaseTool(), IncidentSvc::removeListener(), PoolDbEvtSelector::resetCriteria(), restart(), MinimalEventLoopMgr::restart(), ToolSvc::retrieve(), AIDATupleSvc::retrieveObject(), EventSelector::rewind(), PythonScriptingSvc::run(), NTupleSvc::save(), ChronoStatSvc::saveStats(), RndmGenSvc::serialize(), PersistencySvc::service(), Service(), service(), service_i(), Converter::service_i(), ConversionSvc::setAddressCreator(), AlgContextSvc::setCurrentAlg(), ConversionSvc::setDataProvider(), DetDataSvc::setEventTime(), PoolDbCacheSvc::setMyOptions(), JobOptionsSvc::setMyProperties(), setProperties(), setProperty(), IssueLogger::setupDefaultLogger(), DetDataSvc::setupDetectorDescription(), THistSvc::setupInputFile(), IssueLogger::setupLevels(), THistSvc::setupOutputFile(), IssueLogger::setupStreams(), HistogramSvc::sliceX(), HistogramSvc::sliceY(), MinimalEventLoopMgr::start(), EventLoopMgr::stop(), MinimalEventLoopMgr::stop(), DataOnDemandSvc::stream(), PersistencySvc::svcNamesHandler(), AuditorSvc::syncAuditors_(), sysFinalize(), sysInitialize(), sysReinitialize(), sysRestart(), sysStart(), sysStop(), AlgContextSvc::unSetCurrentAlg(), NTupleSvc::updateDirectories(), THistSvc::updateFiles(), DetDataSvc::updateObject(), DataSvc::updateObject(), and THistSvc::write().

00380                                        {
00381   return m_name;
00382 }

const InterfaceID & Service::type (  )  const [virtual]

Retrieve ID of the Service.

Implements IService.

Reimplemented in ParticlePropertySvc, and PartPropSvc.

Definition at line 385 of file Service.cpp.

References IID_IService.

Referenced by PersistencySvc::addCnvService(), IncidentSvc::addListener(), and IncidentSvc::removeListener().

00385                                         {
00386   return IID_IService;
00387 }

virtual StatusCode Service::configure (  )  [inline, virtual]

Configuration (from OFFLINE to CONFIGURED).

Implements IService.

Definition at line 53 of file Service.h.

References StatusCode::SUCCESS.

00053 { return StatusCode::SUCCESS; }

StatusCode Service::initialize (  )  [virtual]

Initialization (from CONFIGURED to INITIALIZED).

Implements IService.

Reimplemented in GslSvc, ConversionSvc, DataSvc, MinimalEventLoopMgr, DataListenerSvc, PoolDbCacheSvc, PoolDbCnvSvc, PoolDbEvtSelector, PythonScriptingSvc, AIDATupleSvc, AlgContextSvc, AppMgrRunable, EventLoopMgr, AuditorSvc, ChronoStatSvc, EvtDataSvc, MultiStoreSvc, DetDataSvc, EventCollectionSelector, EventSelector, ExceptionSvc, FastContainersSvc, HistogramSvc, HistorySvc, DataOnDemandSvc, IncidentSvc, IssueLogger, JobOptionsSvc, MessageSvc, NTupleSvc, TagCollectionSvc, ParticlePropertySvc, DetPersistencySvc, EvtPersistencySvc, HistogramPersistencySvc, PersistencySvc, HepRndm::Engine< TYPE >, RndmEngine, RndmGenSvc, StatusCodeSvc, THistSvc, ToolSvc, VFSSvc, Gaudi::IODataManager, Gaudi::MultiFileCatalog, HbookCnv::PersSvc, PartPropSvc, and RootHistCnv::PersSvc.

Definition at line 100 of file Service.cpp.

References Gaudi::StateMachine::ChangeState(), Gaudi::StateMachine::CONFIGURE, MSG::DEBUG, endmsg(), m_state, msgSvc(), name(), and setProperties().

Referenced by PartPropSvc::initialize(), Gaudi::IODataManager::initialize(), VFSSvc::initialize(), ToolSvc::initialize(), THistSvc::initialize(), StatusCodeSvc::initialize(), RndmGenSvc::initialize(), RndmEngine::initialize(), PersistencySvc::initialize(), ParticlePropertySvc::initialize(), MessageSvc::initialize(), JobOptionsSvc::initialize(), IssueLogger::initialize(), IncidentSvc::initialize(), DataOnDemandSvc::initialize(), HistorySvc::initialize(), ExceptionSvc::initialize(), EventSelector::initialize(), EventCollectionSelector::initialize(), MultiStoreSvc::initialize(), ChronoStatSvc::initialize(), AuditorSvc::initialize(), AppMgrRunable::initialize(), AlgContextSvc::initialize(), PythonScriptingSvc::initialize(), PoolDbEvtSelector::initialize(), PoolDbCacheSvc::initialize(), DataListenerSvc::initialize(), MinimalEventLoopMgr::initialize(), DataSvc::initialize(), ConversionSvc::initialize(), GslSvc::initialize(), reinitialize(), and sysInitialize().

00100                                {
00101   MsgStream log(msgSvc(),name());
00102   
00103   // Set the Algorithm's properties
00104   StatusCode sc = setProperties();
00105   
00106   log << MSG::DEBUG <<  "Service base class initialized successfully" << endmsg;
00107   m_state = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::CONFIGURE,m_state);
00108   return sc ;
00109 }

StatusCode Service::start (  )  [virtual]

Start (from INITIALIZED to RUNNING).

Implements IService.

Reimplemented in MinimalEventLoopMgr, and AppMgrRunable.

Definition at line 193 of file Service.cpp.

References StatusCode::SUCCESS.

Referenced by ConversionSvc::removeConverter(), restart(), ConversionSvc::setAddressCreator(), ConversionSvc::setDataProvider(), AppMgrRunable::start(), MinimalEventLoopMgr::start(), and sysStart().

00193                           {
00194   // stub implementation
00195   return StatusCode::SUCCESS;
00196 }

StatusCode Service::stop (  )  [virtual]

Stop (from RUNNING to INITIALIZED).

Implements IService.

Reimplemented in MinimalEventLoopMgr, AppMgrRunable, and EventLoopMgr.

Definition at line 187 of file Service.cpp.

References StatusCode::SUCCESS.

Referenced by ConversionSvc::removeConverter(), restart(), ConversionSvc::setAddressCreator(), ConversionSvc::setDataProvider(), AppMgrRunable::stop(), MinimalEventLoopMgr::stop(), and sysStop().

00187                          {
00188   // stub implementation
00189   return StatusCode::SUCCESS;
00190 }

StatusCode Service::finalize (  )  [virtual]

Finalize (from INITIALIZED to CONFIGURED).

Implements IService.

Reimplemented in GslSvc, ConversionSvc, DataSvc, MinimalEventLoopMgr, DataListenerSvc, PoolDbCacheSvc, PoolDbCnvSvc, PoolDbEvtSelector, PythonScriptingSvc, AIDATupleSvc, AlgContextSvc, AppMgrRunable, EventLoopMgr, AuditorSvc, ChronoStatSvc, CounterSvc, EvtDataSvc, MultiStoreSvc, DetDataSvc, EventCollectionSelector, EventSelector, ExceptionSvc, FastContainersSvc, HistogramSvc, HistorySvc, DataOnDemandSvc, IncidentSvc, IssueLogger, JobOptionsSvc, MessageSvc, NTupleSvc, TagCollectionSvc, ParticlePropertySvc, DetPersistencySvc, EvtPersistencySvc, HistogramPersistencySvc, PersistencySvc, HepRndm::Engine< TYPE >, RndmEngine, RndmGenSvc, StatusCodeSvc, THistSvc, ToolSvc, VFSSvc, Gaudi::IODataManager, Gaudi::MultiFileCatalog, HbookCnv::PersSvc, PartPropSvc, and RootHistCnv::PersSvc.

Definition at line 246 of file Service.cpp.

References StatusCode::SUCCESS.

Referenced by PartPropSvc::finalize(), Gaudi::IODataManager::finalize(), VFSSvc::finalize(), ToolSvc::finalize(), THistSvc::finalize(), RndmGenSvc::finalize(), RndmEngine::finalize(), ParticlePropertySvc::finalize(), JobOptionsSvc::finalize(), IssueLogger::finalize(), IncidentSvc::finalize(), DataOnDemandSvc::finalize(), HistorySvc::finalize(), ExceptionSvc::finalize(), EventSelector::finalize(), EventCollectionSelector::finalize(), MultiStoreSvc::finalize(), CounterSvc::finalize(), ChronoStatSvc::finalize(), AuditorSvc::finalize(), AppMgrRunable::finalize(), AlgContextSvc::finalize(), PythonScriptingSvc::finalize(), PoolDbEvtSelector::finalize(), PoolDbCacheSvc::finalize(), DataListenerSvc::finalize(), MinimalEventLoopMgr::finalize(), DataSvc::finalize(), ConversionSvc::finalize(), GslSvc::finalize(), reinitialize(), and sysFinalize().

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

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

Initialization (from CONFIGURED to OFFLINE).

Implements IService.

Definition at line 58 of file Service.h.

References StatusCode::SUCCESS.

00058 { return StatusCode::SUCCESS; }

virtual Gaudi::StateMachine::State Service::FSMState (  )  const [inline, virtual]

Get the current state.

Implements IService.

Definition at line 59 of file Service.h.

References m_state.

Referenced by EventSelector::reinitialize(), sysReinitialize(), and sysRestart().

00059 { return m_state; }

virtual Gaudi::StateMachine::State Service::targetFSMState (  )  const [inline, virtual]

When we are in the middle of a transition, get the state where the transition is leading us.

Otherwise it returns the same state as state().

Implements IService.

Definition at line 60 of file Service.h.

References m_targetState.

00060 { return m_targetState; }

StatusCode Service::reinitialize (  )  [virtual]

Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).

Implements IService.

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

Definition at line 344 of file Service.cpp.

References endreq(), MSG::ERROR, finalize(), initialize(), StatusCode::isFailure(), msgSvc(), name(), and StatusCode::SUCCESS.

Referenced by DataOnDemandSvc::reinitialize(), MultiStoreSvc::reinitialize(), DataSvc::reinitialize(), and sysReinitialize().

00344                                  {
00345   // Default implementation is finalize+initialize
00346   StatusCode sc = finalize();
00347   if (sc.isFailure()) {
00348     MsgStream log ( msgSvc() , name() );
00349     log << MSG::ERROR << "reinitialize(): cannot be finalized" << endreq;
00350     return sc;
00351   }
00352   sc = initialize();
00353   if (sc.isFailure()) {
00354     MsgStream log ( msgSvc() , name() );
00355     log << MSG::ERROR << "reinitialize(): cannot be initialized" << endreq;
00356     return sc;
00357   }
00358   return StatusCode::SUCCESS;
00359 }

StatusCode Service::restart (  )  [virtual]

Initialization (from RUNNING to RUNNING, via INITIALIZED).

Implements IService.

Reimplemented in MinimalEventLoopMgr.

Definition at line 362 of file Service.cpp.

References endreq(), MSG::ERROR, StatusCode::isFailure(), msgSvc(), name(), start(), stop(), and StatusCode::SUCCESS.

Referenced by sysRestart().

00362                             {
00363   // Default implementation is stop+start
00364   StatusCode sc = stop();
00365   if (sc.isFailure()) {
00366     MsgStream log ( msgSvc() , name() );
00367     log << MSG::ERROR << "restart(): cannot be stopped" << endreq;
00368     return sc;
00369   }
00370   sc = start();
00371   if (sc.isFailure()) {
00372     MsgStream log ( msgSvc() , name() );
00373     log << MSG::ERROR << "restart(): cannot be started" << endreq;
00374     return sc;
00375   }
00376   return StatusCode::SUCCESS;
00377 }

StatusCode Service::sysInitialize (  )  [virtual]

Initilize Service.

Implements IService.

Reimplemented in AuditorSvc.

Definition at line 62 of file Service.cpp.

References auditorSvc(), endreq(), MSG::ERROR, StatusCode::FAILURE, MSG::FATAL, initialize(), IAuditor::Initialize, Gaudi::StateMachine::INITIALIZED, StatusCode::isSuccess(), m_auditorInitialize, m_state, m_targetState, msgSvc(), name(), GaudiException::tag(), and std::exception::what().

Referenced by AuditorSvc::sysInitialize().

00062                                   {
00063   StatusCode sc;
00064 
00065   try {
00066     m_targetState = Gaudi::StateMachine::INITIALIZED;
00067     Gaudi::Guards::AuditorGuard guard(this,
00068                                       // check if we want to audit the initialize
00069                                       (m_auditorInitialize) ? auditorSvc() : 0,
00070                                       IAuditor::Initialize);
00071     sc = initialize(); // This should change the state to Gaudi::StateMachine::CONFIGURED
00072     if (sc.isSuccess())
00073       m_state = m_targetState;
00074     return sc;
00075   }
00076   catch ( const GaudiException& Exception )  {
00077     MsgStream log ( msgSvc() , name() );
00078     log << MSG::FATAL << "in sysInitialize(): exception with tag=" << Exception.tag()
00079         << " is caught" << endreq;
00080     log << MSG::ERROR << Exception  << endreq;
00081     //    Stat stat( chronoSvc() , Exception.tag() );
00082   }
00083   catch( const std::exception& Exception ) {
00084     MsgStream log ( msgSvc() , name() );
00085     log << MSG::FATAL << "in sysInitialize(): standard std::exception is caught" << endreq;
00086     log << MSG::ERROR << Exception.what()  << endreq;
00087     //    Stat stat( chronoSvc() , "*std::exception*" );
00088   }
00089   catch(...) {
00090     MsgStream log ( msgSvc() , name() );
00091     log << MSG::FATAL << "in sysInitialize(): UNKNOWN Exception is caught" << endreq;
00092     //    Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
00093   }
00094   
00095   return StatusCode::FAILURE;
00096 }

StatusCode Service::sysStart (  )  [virtual]

Initilize Service.

Implements IService.

Definition at line 112 of file Service.cpp.

References auditorSvc(), Gaudi::StateMachine::ChangeState(), endreq(), MSG::ERROR, StatusCode::FAILURE, MSG::FATAL, StatusCode::isSuccess(), m_auditorStart, m_state, m_targetState, msgSvc(), name(), start(), IAuditor::Start, Gaudi::StateMachine::START, GaudiException::tag(), and std::exception::what().

00112                              {
00113   StatusCode sc;
00114 
00115   try {
00116     m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state);
00117     Gaudi::Guards::AuditorGuard guard(this,
00118                                       // check if we want to audit the initialize
00119                                       (m_auditorStart) ? auditorSvc() : 0,
00120                                       IAuditor::Start);
00121     sc = start();
00122     if (sc.isSuccess())
00123       m_state = m_targetState;
00124     return sc;
00125   }
00126   catch ( const GaudiException& Exception )  {
00127     MsgStream log ( msgSvc() , name() );
00128     log << MSG::FATAL << "in sysStart(): exception with tag=" << Exception.tag()
00129         << " is caught" << endreq;
00130     log << MSG::ERROR << Exception  << endreq;
00131     //    Stat stat( chronoSvc() , Exception.tag() );
00132   }
00133   catch( const std::exception& Exception ) {
00134     MsgStream log ( msgSvc() , name() );
00135     log << MSG::FATAL << "in sysStart(): standard std::exception is caught" << endreq;
00136     log << MSG::ERROR << Exception.what()  << endreq;
00137     //    Stat stat( chronoSvc() , "*std::exception*" );
00138   }
00139   catch(...) {
00140     MsgStream log ( msgSvc() , name() );
00141     log << MSG::FATAL << "in sysStart(): UNKNOWN Exception is caught" << endreq;
00142     //    Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
00143   }
00144   
00145   return StatusCode::FAILURE;
00146 }

StatusCode Service::sysStop (  )  [virtual]

Initilize Service.

Implements IService.

Definition at line 149 of file Service.cpp.

References auditorSvc(), Gaudi::StateMachine::ChangeState(), endreq(), MSG::ERROR, StatusCode::FAILURE, MSG::FATAL, StatusCode::isSuccess(), m_auditorStop, m_state, m_targetState, msgSvc(), name(), stop(), IAuditor::Stop, Gaudi::StateMachine::STOP, GaudiException::tag(), and std::exception::what().

00149                             {
00150   StatusCode sc;
00151 
00152   try {
00153     m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::STOP,m_state);
00154     Gaudi::Guards::AuditorGuard guard(this,
00155                                       // check if we want to audit the initialize
00156                                       (m_auditorStop) ? auditorSvc() : 0,
00157                                       IAuditor::Stop);
00158     sc = stop();
00159     if (sc.isSuccess())
00160       m_state = m_targetState;
00161     return sc;
00162   }
00163   catch ( const GaudiException& Exception )  {
00164     MsgStream log ( msgSvc() , name() );
00165     log << MSG::FATAL << "in sysStop(): exception with tag=" << Exception.tag()
00166         << " is caught" << endreq;
00167     log << MSG::ERROR << Exception  << endreq;
00168     //    Stat stat( chronoSvc() , Exception.tag() );
00169   }
00170   catch( const std::exception& Exception ) {
00171     MsgStream log ( msgSvc() , name() );
00172     log << MSG::FATAL << "in sysStop(): standard std::exception is caught" << endreq;
00173     log << MSG::ERROR << Exception.what()  << endreq;
00174     //    Stat stat( chronoSvc() , "*std::exception*" );
00175   }
00176   catch(...) {
00177     MsgStream log ( msgSvc() , name() );
00178     log << MSG::FATAL << "in sysStop(): UNKNOWN Exception is caught" << endreq;
00179     //    Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
00180   }
00181   
00182   return StatusCode::FAILURE;
00183 }

StatusCode Service::sysFinalize (  )  [virtual]

Finalize Service.

Implements IService.

Reimplemented in AuditorSvc.

Definition at line 199 of file Service.cpp.

References auditorSvc(), endreq(), MSG::ERROR, StatusCode::FAILURE, MSG::FATAL, finalize(), IAuditor::Finalize, StatusCode::isSuccess(), m_auditorFinalize, m_messageSvc, m_pAuditorSvc, m_state, m_targetState, msgSvc(), name(), Gaudi::StateMachine::OFFLINE, IInterface::release(), and std::exception::what().

Referenced by AuditorSvc::sysFinalize().

00199                                 {
00200   
00201   StatusCode sc(StatusCode::FAILURE);
00202 
00203   try {
00204     m_targetState = Gaudi::StateMachine::OFFLINE;
00205     Gaudi::Guards::AuditorGuard guard(this,
00206                                       // check if we want to audit the initialize
00207                                       (m_auditorFinalize) ? auditorSvc() : 0,
00208                                       IAuditor::Finalize);
00209     sc = finalize();
00210     if (sc.isSuccess())
00211       m_state = m_targetState;
00212   }
00213   catch( const GaudiException& Exception ) {
00214     MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
00215     log << MSG::FATAL << " Exception with tag=" << Exception.tag()
00216         << " is caught " << endreq;
00217     log << MSG::ERROR << Exception  << endreq;
00218     //    Stat stat( chronoSvc() , Exception.tag() ) ;
00219   }
00220   catch( const std::exception& Exception ) {
00221     MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
00222     log << MSG::FATAL << " Standard std::exception is caught " << endreq;
00223     log << MSG::ERROR << Exception.what()  << endreq;
00224     //    Stat stat( chronoSvc() , "*std::exception*" ) ;
00225   }
00226   catch( ... ) {
00227     MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
00228     log << MSG::FATAL << "UNKNOWN Exception is caught " << endreq;
00229     //    Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
00230   }
00231 
00232   if( m_messageSvc ) {
00233     m_messageSvc->release();
00234     m_messageSvc = 0;
00235   }
00236   if( m_pAuditorSvc ) {
00237     m_pAuditorSvc->release();
00238     m_pAuditorSvc = 0;
00239   }
00240   
00241   return sc ;
00242   
00243 }

StatusCode Service::sysReinitialize (  )  [virtual]

Re-initialize the Service.

Implements IService.

Definition at line 253 of file Service.cpp.

References auditorSvc(), endreq(), MSG::ERROR, StatusCode::FAILURE, MSG::FATAL, FSMState(), Gaudi::StateMachine::INITIALIZED, m_auditorReinitialize, msgSvc(), name(), reinitialize(), IAuditor::ReInitialize, GaudiException::tag(), and std::exception::what().

00253                                     {
00254   
00255   StatusCode sc;
00256 
00257   // Check that the current status is the correct one.
00258   if ( Gaudi::StateMachine::INITIALIZED != FSMState() ) {
00259     MsgStream log ( msgSvc() , name() );
00260     log << MSG::ERROR
00261         << "sysReinitialize(): cannot reinitialize service not initialized"
00262         << endreq;
00263     return StatusCode::FAILURE;
00264   }
00265   
00266   try {
00267 
00268     Gaudi::Guards::AuditorGuard guard(this,
00269                                       // check if we want to audit the initialize
00270                                       (m_auditorReinitialize) ? auditorSvc() : 0,
00271                                       IAuditor::ReInitialize);
00272     sc = reinitialize();
00273     return sc;
00274   }
00275   catch( const GaudiException& Exception ) {
00276     MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
00277     log << MSG::FATAL << " Exception with tag=" << Exception.tag()
00278         << " is caught " << endreq;
00279     log << MSG::ERROR << Exception  << endreq;
00280     //    Stat stat( chronoSvc() , Exception.tag() ) ;
00281   }
00282   catch( const std::exception& Exception ) {
00283     MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
00284     log << MSG::FATAL << " Standard std::exception is caught " << endreq;
00285     log << MSG::ERROR << Exception.what()  << endreq;
00286     //    Stat stat( chronoSvc() , "*std::exception*" ) ;
00287   }
00288   catch( ... ) {
00289     MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
00290     log << MSG::FATAL << "UNKNOWN Exception is caught " << endreq;
00291     //    Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
00292   }
00293   return StatusCode::FAILURE ;
00294   
00295 }

StatusCode Service::sysRestart (  )  [virtual]

Re-initialize the Service.

Implements IService.

Definition at line 298 of file Service.cpp.

References auditorSvc(), endreq(), MSG::ERROR, StatusCode::FAILURE, MSG::FATAL, FSMState(), m_auditorRestart, msgSvc(), name(), restart(), IAuditor::ReStart, Gaudi::StateMachine::RUNNING, GaudiException::tag(), and std::exception::what().

00298                                {
00299   
00300   StatusCode sc;
00301 
00302   // Check that the current status is the correct one.
00303   if ( Gaudi::StateMachine::RUNNING != FSMState() ) {
00304     MsgStream log ( msgSvc() , name() );
00305     log << MSG::ERROR
00306         << "sysRestart(): cannot restart service in state " << FSMState()
00307         << " -- must be RUNNING "
00308         << endreq;
00309     return StatusCode::FAILURE;
00310   }
00311 
00312   try {
00313 
00314     Gaudi::Guards::AuditorGuard guard(this,
00315                                       // check if we want to audit the initialize
00316                                       (m_auditorRestart) ? auditorSvc() : 0,
00317                                       IAuditor::ReStart);
00318     sc = restart();
00319     return sc;
00320   }
00321   catch( const GaudiException& Exception ) {
00322     MsgStream log ( msgSvc() , name() + ".sysRestart()" );
00323     log << MSG::FATAL << " Exception with tag=" << Exception.tag()
00324         << " is caught " << endreq;
00325     log << MSG::ERROR << Exception  << endreq;
00326     //    Stat stat( chronoSvc() , Exception.tag() ) ;
00327   }
00328   catch( const std::exception& Exception ) {
00329     MsgStream log ( msgSvc() , name() + ".sysRestart()" );
00330     log << MSG::FATAL << " Standard std::exception is caught " << endreq;
00331     log << MSG::ERROR << Exception.what()  << endreq;
00332     //    Stat stat( chronoSvc() , "*std::exception*" ) ;
00333   }
00334   catch( ... ) {
00335     MsgStream log ( msgSvc() , name() + ".sysRestart()" );
00336     log << MSG::FATAL << "UNKNOWN Exception is caught " << endreq;
00337     //    Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
00338   }
00339   return StatusCode::FAILURE ;
00340   
00341 }

StatusCode Service::setProperty ( const Property p  )  [virtual]

Set the property by property.

Implements IProperty.

Reimplemented in JobOptionsSvc.

Definition at line 424 of file Service.cpp.

References m_propertyMgr, and PropertyMgr::setProperty().

Referenced by EventLoopMgr::initialize(), AppMgrRunable::initialize(), MinimalEventLoopMgr::initialize(), HistogramPersistencySvc::reinitialize(), EventLoopMgr::reinitialize(), and Service().

00424                                                  {
00425   return m_propertyMgr->setProperty(p);
00426 }

StatusCode Service::setProperty ( const std::string s  )  [virtual]

Set the property by string.

Implements IProperty.

Definition at line 428 of file Service.cpp.

References m_propertyMgr, Gaudi::Units::s, and PropertyMgr::setProperty().

00428                                                   {
00429   return m_propertyMgr->setProperty(s);
00430 }

StatusCode Service::setProperty ( const std::string n,
const std::string v 
) [virtual]

Set the property by std::string.

Implements IProperty.

Definition at line 432 of file Service.cpp.

References m_propertyMgr, and PropertyMgr::setProperty().

00432                                                                       {
00433   return m_propertyMgr->setProperty(n,v);
00434 }

StatusCode Service::getProperty ( Property p  )  const [virtual]

Get the property by property.

Implements IProperty.

Reimplemented in JobOptionsSvc.

Definition at line 436 of file Service.cpp.

References PropertyMgr::getProperty(), and m_propertyMgr.

00436                                                  {
00437   return m_propertyMgr->getProperty(p);
00438 }

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

Get the property by name.

Implements IProperty.

Definition at line 440 of file Service.cpp.

References PropertyMgr::getProperty(), and m_propertyMgr.

00440                                                              {
00441   return m_propertyMgr->getProperty(n);
00442 }

StatusCode Service::getProperty ( const std::string n,
std::string v 
) const [virtual]

Get the property by std::string.

Implements IProperty.

Definition at line 444 of file Service.cpp.

References PropertyMgr::getProperty(), and m_propertyMgr.

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

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

Get list of properties.

Implements IProperty.

Definition at line 448 of file Service.cpp.

References PropertyMgr::getProperties(), and m_propertyMgr.

00448                                                          {
00449   return m_propertyMgr->getProperties();
00450 }

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

References m_propertyMgr, name(), and Gaudi::Utils::setProperty().

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

ISvcLocator * Service::serviceLocator (  )  const

Retrieve pointer to service locator.

Definition at line 390 of file Service.cpp.

References m_svcLocator.

Referenced by AIDATupleSvc::connect(), EventCollectionSelector::connectStatement(), MultiStoreSvc::create(), PoolDbCnvSvc::createConverter(), ConversionSvc::createConverter(), TagCollectionSvc::createService(), NTupleSvc::createService(), MinimalEventLoopMgr::decodeOutStreams(), MinimalEventLoopMgr::decodeTopAlgs(), MinimalEventLoopMgr::executeEvent(), MinimalEventLoopMgr::finalize(), Gaudi::IODataManager::initialize(), VFSSvc::initialize(), RndmGenSvc::initialize(), RndmEngine::initialize(), EventSelector::initialize(), EventCollectionSelector::initialize(), EventLoopMgr::initialize(), AppMgrRunable::initialize(), PythonScriptingSvc::initialize(), PoolDbEvtSelector::initialize(), MinimalEventLoopMgr::initialize(), GslSvc::initialize(), msgSvc(), HistogramPersistencySvc::reinitialize(), EventLoopMgr::reinitialize(), service_i(), setProperties(), and DataOnDemandSvc::setup().

00390                                            {
00391   return m_svcLocator;
00392 }

IMessageSvc * Service::msgSvc (  ) 

Retrieve pointer to message service.

Definition at line 395 of file Service.cpp.

References StatusCode::isFailure(), m_messageSvc, name(), ISvcLocator::service(), and serviceLocator().

Referenced by NTupleSvc::access(), PersistencySvc::addCnvService(), IncidentSvc::addListener(), ParticlePropertySvc::addParticles(), DataListenerSvc::apmSend(), MultiStoreSvc::attachServices(), NTupleSvc::attachTuple(), NTupleSvc::book(), THistSvc::browseTDir(), DetDataSvc::clearStore(), THistSvc::connect(), TagCollectionSvc::connect(), NTupleSvc::connect(), IssueLogger::connect(), AIDATupleSvc::connect(), Gaudi::IODataManager::connectDataIO(), HistogramSvc::connectInput(), EventCollectionSelector::connectTuple(), ToolSvc::create(), EventCollectionSelector::createAddress(), EventCollectionSelector::createContext(), PoolDbCnvSvc::createConverter(), HistogramSvc::createDirectory(), AIDATupleSvc::createDirectory(), HistogramSvc::createPath(), AIDATupleSvc::createPath(), HbookCnv::PersSvc::createRep(), NTupleSvc::createService(), DataListenerSvc::declareInfo(), MinimalEventLoopMgr::decodeOutStreams(), MinimalEventLoopMgr::decodeTopAlgs(), THistSvc::deReg(), Gaudi::IODataManager::disconnect(), JobOptionsSvc::dump(), Gaudi::IODataManager::error(), EventLoopMgr::executeEvent(), MinimalEventLoopMgr::executeEvent(), MinimalEventLoopMgr::executeRun(), PartPropSvc::finalize(), ToolSvc::finalize(), THistSvc::finalize(), StatusCodeSvc::finalize(), ParticlePropertySvc::finalize(), IssueLogger::finalize(), HistogramSvc::finalize(), FastContainersSvc::finalize(), ExceptionSvc::finalize(), EventSelector::finalize(), DetDataSvc::finalize(), ChronoStatSvc::finalize(), EventLoopMgr::finalize(), AlgContextSvc::finalize(), AIDATupleSvc::finalize(), DataListenerSvc::finalize(), MinimalEventLoopMgr::finalize(), ConversionSvc::finalize(), GslSvc::finalize(), IncidentSvc::fireIncident(), EventLoopMgr::getEventRoot(), THistSvc::getTHists(), THistSvc::getTTrees(), DetDataSvc::handle(), AlgContextSvc::handle(), DataListenerSvc::handle(), PartPropSvc::initialize(), Gaudi::IODataManager::initialize(), ToolSvc::initialize(), THistSvc::initialize(), StatusCodeSvc::initialize(), RndmGenSvc::initialize(), PersistencySvc::initialize(), ParticlePropertySvc::initialize(), IncidentSvc::initialize(), HistogramSvc::initialize(), FastContainersSvc::initialize(), ExceptionSvc::initialize(), MultiStoreSvc::initialize(), ChronoStatSvc::initialize(), EventLoopMgr::initialize(), AlgContextSvc::initialize(), AIDATupleSvc::initialize(), PythonScriptingSvc::initialize(), DataListenerSvc::initialize(), initialize(), MinimalEventLoopMgr::initialize(), DataSvc::initialize(), GslSvc::initialize(), initOutputLevel(), StatusCodeSvc::list(), PoolDbCnvSvc::loadConverter(), DataSvc::loadObject(), ConversionSvc::makeCall(), THistSvc::MergeRootFile(), messageService(), ToolSvc::nameTool(), EventLoopMgr::nextEvent(), MinimalEventLoopMgr::nextEvent(), HistogramSvc::not_implemented(), ParticlePropertySvc::parse(), PoolDbEvtSelector::previous(), CounterSvc::print(), ChronoStatSvc::printStats(), Gaudi::IODataManager::reconnect(), StatusCodeSvc::regFnc(), THistSvc::regGraph(), DataSvc::registerObject(), THistSvc::reinitialize(), StatusCodeSvc::reinitialize(), HistogramPersistencySvc::reinitialize(), IssueLogger::reinitialize(), DetDataSvc::reinitialize(), MultiStoreSvc::reinitialize(), EventLoopMgr::reinitialize(), reinitialize(), MinimalEventLoopMgr::reinitialize(), DataSvc::reinitialize(), ToolSvc::releaseTool(), IncidentSvc::removeListener(), restart(), MinimalEventLoopMgr::restart(), ToolSvc::retrieve(), AIDATupleSvc::retrieveObject(), PythonScriptingSvc::run(), NTupleSvc::save(), ChronoStatSvc::saveStats(), RndmGenSvc::serialize(), PersistencySvc::service(), Service(), service_i(), ConversionSvc::setAddressCreator(), AlgContextSvc::setCurrentAlg(), ConversionSvc::setDataProvider(), DetDataSvc::setEventTime(), IssueLogger::setupDefaultLogger(), DetDataSvc::setupDetectorDescription(), IssueLogger::setupLevels(), IssueLogger::setupStreams(), MinimalEventLoopMgr::start(), MinimalEventLoopMgr::stop(), DataOnDemandSvc::stream(), PersistencySvc::svcNamesHandler(), AuditorSvc::syncAuditors_(), sysFinalize(), sysInitialize(), sysReinitialize(), sysRestart(), sysStart(), sysStop(), AlgContextSvc::unSetCurrentAlg(), NTupleSvc::updateDirectories(), THistSvc::updateFiles(), DetDataSvc::updateObject(), THistSvc::write(), and DataListenerSvc::writeXML().

00395                                 {
00396   if ( 0 == m_messageSvc ) {
00397     StatusCode sc = serviceLocator()->service( "MessageSvc", m_messageSvc, true ); 
00398     if( sc.isFailure() ) {
00399       throw GaudiException("Service [MessageSvc] not found", name(), sc);
00400     }
00401   }
00402   return m_messageSvc;
00403 }

IMessageSvc * Service::msgSvc (  )  const

Definition at line 405 of file Service.cpp.

References StatusCode::isFailure(), m_messageSvc, name(), ISvcLocator::service(), and serviceLocator().

00405                                      {
00406   if ( 0 == m_messageSvc ) {
00407     StatusCode sc = serviceLocator()->service( "MessageSvc", m_messageSvc, true );
00408     if( sc.isFailure() ) {
00409       throw GaudiException("Service [MessageSvc] not found", name(), sc);
00410     }
00411   }
00412   return m_messageSvc;
00413 }

IMessageSvc * Service::messageService (  ) 

Definition at line 415 of file Service.cpp.

References msgSvc().

Referenced by EventSelector::createContext(), RootHistCnv::PersSvc::createRep(), RootHistCnv::PersSvc::finalize(), PoolDbEvtSelector::finalize(), PoolDbCnvSvc::finalize(), PoolDbCacheSvc::finalize(), EventSelector::firstOfNextStream(), RootHistCnv::PersSvc::initialize(), HbookCnv::PersSvc::initialize(), VFSSvc::initialize(), HepRndm::Engine< TYPE >::initialize(), EventSelector::initialize(), EventCollectionSelector::initialize(), PoolDbEvtSelector::initialize(), PoolDbCnvSvc::initialize(), PoolDbCacheSvc::initialize(), EventSelector::lastOfPreviousStream(), PoolDbCacheSvc::loadDictionary(), PoolDbCnvSvc::markUpdate(), EventSelector::printEvtInfo(), EventSelector::reinitialize(), PoolDbEvtSelector::resetCriteria(), and EventSelector::rewind().

00415                                         {
00416   return msgSvc();
00417 }

IMessageSvc * Service::messageService (  )  const

Definition at line 418 of file Service.cpp.

References msgSvc().

00418                                              {
00419   return msgSvc();
00420 }

StatusCode Service::setProperties (  ) 

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

Definition at line 453 of file Service.cpp.

References StatusCode::FAILURE, getGaudiThreadGenericName(), StatusCode::isFailure(), isGaudiThreaded(), name(), IInterface::release(), ISvcLocator::service(), serviceLocator(), IJobOptionsSvc::setMyProperties(), and StatusCode::SUCCESS.

Referenced by RootHistCnv::PersSvc::initialize(), ToolSvc::initialize(), RndmGenSvc::initialize(), RndmEngine::initialize(), ParticlePropertySvc::initialize(), NTupleSvc::initialize(), MessageSvc::initialize(), IncidentSvc::initialize(), ChronoStatSvc::initialize(), and initialize().

00453                                   {
00454   IJobOptionsSvc* jos;
00455   const bool CREATEIF(true);
00456   StatusCode sc = serviceLocator()->service( "JobOptionsSvc", jos, CREATEIF );
00457   if( sc.isFailure() ) {
00458     throw GaudiException("Service [JobOptionsSvc] not found", name(), sc);
00459   }
00460   // set first generic Properties
00461   sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this );
00462   if( sc.isFailure() ) return StatusCode::FAILURE;
00463  
00464   // set specific Properties
00465   if (isGaudiThreaded(name())) {
00466     if (jos->setMyProperties( name(), this ).isFailure()) {
00467       return StatusCode::FAILURE;
00468     }
00469   }
00470   jos->release();
00471   return StatusCode::SUCCESS;
00472 }

template<class T>
StatusCode Service::service ( const std::string name,
T *&  psvc,
bool  createIf = true 
) const [inline]

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

Definition at line 152 of file Service.h.

References name(), and service_i().

Referenced by MultiStoreSvc::attachServices(), auditorSvc(), HistorySvc::captureState(), ToolSvc::create(), RndmGenSvc::finalize(), RndmGenSvc::initialize(), ParticlePropertySvc::initialize(), HistorySvc::initialize(), HistogramSvc::initialize(), AlgContextSvc::initialize(), PoolDbCnvSvc::initialize(), DataListenerSvc::initialize(), DataSvc::initialize(), HistorySvc::registerAlgTool(), DataSvc::reinitialize(), PersistencySvc::service(), and DataOnDemandSvc::setup().

00152                                                                                     {
00153     return service_i(name, createIf, T::interfaceID(), (void**)&psvc);
00154   }

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

References service_i().

00160                                       {
00161     return service_i(svcType, svcName, T::interfaceID(), (void**)&psvc);
00162   }

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

References m_propertyMgr, and name().

Referenced by AIDATupleSvc::AIDATupleSvc(), AuditorSvc::AuditorSvc(), CounterSvc::CounterSvc(), DataListenerSvc::DataListenerSvc(), DataSvc::DataSvc(), DetDataSvc::DetDataSvc(), HepRndm::Engine< TYPE >::Engine(), EventCollectionSelector::EventCollectionSelector(), EventSelector::EventSelector(), HistogramSvc::HistogramSvc(), HistorySvc::HistorySvc(), Gaudi::IODataManager::IODataManager(), IssueLogger::IssueLogger(), MinimalEventLoopMgr::MinimalEventLoopMgr(), MultiStoreSvc::MultiStoreSvc(), PersistencySvc::PersistencySvc(), RootHistCnv::PersSvc::PersSvc(), HbookCnv::PersSvc::PersSvc(), PoolDbCacheSvc::PoolDbCacheSvc(), PoolDbEvtSelector::PoolDbEvtSelector(), Service(), and THistSvc::THistSvc().

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

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

References m_propertyMgr, and name().

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

IAuditorSvc * Service::auditorSvc (  )  const

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

Definition at line 552 of file Service.cpp.

References StatusCode::isFailure(), m_pAuditorSvc, name(), and service().

Referenced by sysFinalize(), sysInitialize(), sysReinitialize(), sysRestart(), sysStart(), and sysStop().

00552                                        {
00553   if ( 0 == m_pAuditorSvc ) {
00554     StatusCode sc = service( "AuditorSvc", m_pAuditorSvc, true );
00555     if( sc.isFailure() ) {
00556       throw GaudiException("Service [AuditorSvc] not found", name(), sc);
00557     }
00558   }
00559   return m_pAuditorSvc;
00560 }

int Service::outputLevel (  )  const [inline, protected]

get the Service's output level

Reimplemented in MessageSvc.

Definition at line 235 of file Service.h.

References m_outputLevel, and PropertyWithValue< TYPE >::value().

Referenced by CounterSvc::finalize(), and DetDataSvc::setEventTime().

00235 { return m_outputLevel.value(); }

StatusCode Service::service_i ( const std::string svcName,
bool  createIf,
const InterfaceID iid,
void **  ppSvc 
) const [private]

implementation of service method

Definition at line 534 of file Service.cpp.

References ServiceLocatorHelper::getService(), msgSvc(), name(), and serviceLocator().

Referenced by service().

00535                                                                {
00536   MsgStream log(msgSvc(), name());
00537   ServiceLocatorHelper helper(*serviceLocator(), log, name());
00538   return helper.getService(svcName, createIf, iid, ppSvc);
00539 }

StatusCode Service::service_i ( const std::string svcType,
const std::string svcName,
const InterfaceID iid,
void **  ppSvc 
) const [private]

Definition at line 542 of file Service.cpp.

References ServiceLocatorHelper::createService(), msgSvc(), name(), and serviceLocator().

00545                                        {
00546 
00547   MsgStream log(msgSvc(), name());
00548   ServiceLocatorHelper helper(*serviceLocator(), log, name());
00549   return  helper.createService(svcType, svcName, iid, ppSvc);
00550 }

void Service::setServiceManager ( ISvcManager  )  [private, virtual]

Implements IService.

Definition at line 563 of file Service.cpp.

References m_svcManager.

00563                                            {
00564   m_svcManager = ism;
00565 }

void Service::initOutputLevel ( Property prop  )  [private]

callback for output level property

Definition at line 521 of file Service.cpp.

References m_outputLevel, msgSvc(), name(), and IMessageSvc::setOutputLevel().

Referenced by Service().

00521                                                 {
00522   if ( name() != "MessageSvc" ) {
00523     msgSvc()->setOutputLevel( name(), m_outputLevel );
00524   }
00525 }


Friends And Related Function Documentation

friend class ServiceManager [friend]

Reimplemented from IService.

Definition at line 34 of file Service.h.


Member Data Documentation

IntegerProperty Service::m_outputLevel [protected]

Service output level.

Definition at line 226 of file Service.h.

Referenced by HistorySvc::initialize(), PoolDbCacheSvc::initialize(), initOutputLevel(), MessageSvc::outputLevel(), outputLevel(), Service(), and MessageSvc::setOutputLevel().

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

Service state.

Reimplemented in MinimalEventLoopMgr.

Definition at line 228 of file Service.h.

Referenced by FSMState(), ExceptionSvc::initialize(), initialize(), MessageSvc::reinitialize(), HistorySvc::reinitialize(), Service(), sysFinalize(), sysInitialize(), sysStart(), and sysStop().

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

Service state.

Definition at line 230 of file Service.h.

Referenced by ToolSvc::releaseTool(), Service(), sysFinalize(), sysInitialize(), sysStart(), sysStop(), and targetFSMState().

IMessageSvc* Service::m_messageSvc [mutable, protected]

MessageSvc reference.

Definition at line 232 of file Service.h.

Referenced by MessageSvc::initialize(), msgSvc(), Service(), and sysFinalize().

std::string Service::m_name [private]

Service Name.

Definition at line 239 of file Service.h.

Referenced by name(), and Service().

unsigned long Service::m_refCount [private]

Reference counter.

Definition at line 241 of file Service.h.

Referenced by addRef(), release(), and Service().

ISvcLocator* Service::m_svcLocator [private]

Service Locator reference.

Definition at line 243 of file Service.h.

Referenced by Service(), and serviceLocator().

ISvcManager* Service::m_svcManager [private]

Definition at line 244 of file Service.h.

Referenced by release(), Service(), and setServiceManager().

PropertyMgr* Service::m_propertyMgr [private]

Property Manager.

Definition at line 246 of file Service.h.

Referenced by declareProperty(), declareRemoteProperty(), getProperties(), getProperty(), Service(), setProperty(), and ~Service().

IAuditorSvc* Service::m_pAuditorSvc [mutable, private]

Auditor Service.

Definition at line 259 of file Service.h.

Referenced by auditorSvc(), Service(), and sysFinalize().

BooleanProperty Service::m_auditInit [private]

Definition at line 260 of file Service.h.

Referenced by Service().

bool Service::m_auditorInitialize [private]

Definition at line 261 of file Service.h.

Referenced by Service(), and sysInitialize().

bool Service::m_auditorStart [private]

Definition at line 262 of file Service.h.

Referenced by Service(), and sysStart().

bool Service::m_auditorStop [private]

Definition at line 263 of file Service.h.

Referenced by Service(), and sysStop().

bool Service::m_auditorFinalize [private]

Definition at line 264 of file Service.h.

Referenced by Service(), and sysFinalize().

bool Service::m_auditorReinitialize [private]

Definition at line 265 of file Service.h.

Referenced by Service(), and sysReinitialize().

bool Service::m_auditorRestart [private]

Definition at line 266 of file Service.h.

Referenced by Service(), and sysRestart().


The documentation for this class was generated from the following files:
Generated at Fri Jul 18 12:09:14 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004