| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 2010

# ServiceManager Class Reference

The ServiceManager class is in charge of the creation of concrete instances of Services. More...

`#include <ServiceManager.h>`

Inheritance diagram for ServiceManager:

[legend]
Collaboration diagram for ServiceManager:

[legend]

List of all members.

## Public Types
typedef std::list< ServiceItem > | ListSvc
typedef GaudiUtils::Map < std::string, std::string > | MapType
## Public Member Functions
| ServiceManager (IInterface *application)
| default creator
SmartIF< ISvcLocator > & | serviceLocator () const
| Function needed by CommonMessaging.
virtual | ~ServiceManager ()
| virtual destructor
virtual const std::list < IService * > & | getServices () const
| Return the list of Services.
virtual bool | existsService (const std::string &name) const
| implementation of ISvcLocation::existsService
virtual StatusCode | addService (IService *svc, int prio=10)
| implementation of ISvcManager::addService
virtual StatusCode | addService (const Gaudi::Utils::TypeNameString &typeName, int prio=10)
| implementation of ISvcManager::addService
virtual StatusCode | removeService (IService *svc)
| implementation of ISvcManager::removeService
virtual StatusCode | removeService (const std::string &name)
| implementation of ISvcManager::removeService
virtual StatusCode | declareSvcType (const std::string &svcname, const std::string &svctype)
| implementation of ISvcManager::declareSvcType
virtual SmartIF< IService > & | createService (const Gaudi::Utils::TypeNameString &nametype)
| implementation of ISvcManager::createService
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 | reinitialize ()
| Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
virtual StatusCode | restart ()
| Initialization (from RUNNING to RUNNING, via INITIALIZED).
virtual int | getPriority (const std::string &name) const
| manage priorities of services
virtual StatusCode | setPriority (const std::string &name, int pri)
virtual bool | loopCheckEnabled () const
| Get the value of the initialization loop check flag.
virtual void | setLoopCheckEnabled (bool en)
| Set the value of the initialization loop check flag.
const std::string & | name () const
| Return the name of the manager (implementation of INamedInterface).
virtual SmartIF< IService > & | service (const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)
| Returns a smart pointer to a service.
## Private Member Functions
ListSvc::iterator | find (const std::string &name)
ListSvc::const_iterator | find (const std::string &name) const
ListSvc::iterator | find (const IService *ptr)
ListSvc::const_iterator | find (const IService *ptr) const
## Private Attributes
ListSvc | m_listsvc
| List of service maintained by ServiceManager.
MapType | m_maptype
| Map of service name and service type.
bool | m_loopCheck
| Check for service initialization loops.
SmartIF< IService > | m_appSvc
| Pointer to the application IService interface.
std::list< IService * > | m_listOfPtrs
| List of pointers to the know services used to implement getServices().
GaudiUtils::Map< InterfaceID, SmartIF< IInterface > > | m_defaultImplementations
## Classes
struct | ServiceItem

## Detailed Description

The ServiceManager class is in charge of the creation of concrete instances of Services.

The ApplicationMgr delegates the creation and bookkeeping of services to the ServiceManager. In order to be able to create services from which it is not know the concrete type it requires that the services has been declared in one of 3 possible ways: an abstract static creator function, a dynamic link library or an abstract factory reference.

Author:
  Pere Mato

Definition at line 36 of file ServiceManager.h.

## Member Typedef Documentation

typedef std::list<ServiceItem> ServiceManager::ListSvc

Definition at line 57 of file ServiceManager.h.

typedef GaudiUtils::Map<std::string, std::string> ServiceManager::MapType

Definition at line 58 of file ServiceManager.h.

## Constructor & Destructor Documentation

ServiceManager::ServiceManager | ( | IInterface * | application | ) |

default creator

Definition at line 24 of file ServiceManager.cpp.

    00024                                                      :
    00025   base_class(application, IService::interfaceID()),
    00026   m_loopCheck(true),
    00027   m_appSvc(application)
    00028 {
    00029   // Set the service locator to myself
    00030   m_svcLocator = static_cast<ISvcLocator*>(this);
    00031
    00032   addRef(); // Initial count set to 1
    00033 }

ServiceManager::~ServiceManager | ( |  | ) | `[virtual]`

virtual destructor

Definition at line 36 of file ServiceManager.cpp.

    00036                                 {
    00037   //-- inform the orphan services that I am gone....
    00038   for (ListSvc::iterator it = m_listsvc.begin(); it != m_listsvc.end(); it++ ) {
    00039     it->service->setServiceManager(0);
    00040   }
    00041 }

## Member Function Documentation

SmartIF<ISvcLocator>& ServiceManager::serviceLocator | ( |  | ) | const`[inline, virtual]`

Function needed by CommonMessaging.

Reimplemented from ComponentManager.

Definition at line 64 of file ServiceManager.h.

    00064                                                       {
    00065     return m_svcLocator;
    00066   }

const std::list< IService * > & ServiceManager::getServices | ( |  | ) | const`[virtual]`

Return the list of Services.

Definition at line 185 of file ServiceManager.cpp.

    00187 {
    00188   m_listOfPtrs.clear();
    00189   for (ListSvc::const_iterator it = m_listsvc.begin(); it != m_listsvc.end(); ++it) {
    00190     m_listOfPtrs.push_back(const_cast<IService*>(it->service.get()));
    00191   }
    00192   return m_listOfPtrs;
    00193 }

bool ServiceManager::existsService | ( | const std::string & | name | ) | const`[virtual]`

implementation of ISvcLocation::existsService

Definition at line 196 of file ServiceManager.cpp.

    00198 {
    00199   return find(name) != m_listsvc.end();
    00200 }

StatusCode ServiceManager::addService | ( | IService * | svc,
|  | int | prio = `10` |
| ) |  |  | `[virtual]`

implementation of ISvcManager::addService

Definition at line 95 of file ServiceManager.cpp.

    00097 {
    00098   ListSvc::iterator it = find(svc);
    00099   if (it != m_listsvc.end()) {
    00100     it->priority = prio; // if the service is already known, it is equivalent to a setPriority
    00101     it->active = true;   // and make it active
    00102   } else {
    00103     m_listsvc.push_back(ServiceItem(svc,prio,true));
    00104   }
    00105   return StatusCode::SUCCESS;
    00106 }

StatusCode ServiceManager::addService | ( | const Gaudi::Utils::TypeNameString & | typeName,
|  | int | prio = `10` |
| ) |  |  | `[virtual]`

implementation of ISvcManager::addService

Definition at line 110 of file ServiceManager.cpp.

    00112 {
    00113   ListSvc::iterator it = find(typeName.name()); // try to find the service by name
    00114   if (it == m_listsvc.end()) { // not found
    00115     // If the service does not exist, we create it
    00116     SmartIF<IService> &svc = createService(typeName);
    00117     if (svc.isValid()) {
    00118       StatusCode sc = StatusCode(StatusCode::SUCCESS, true);
    00119       if (targetFSMState() >= Gaudi::StateMachine::INITIALIZED) {
    00120         sc = svc->sysInitialize();
    00121         if (sc.isSuccess() && targetFSMState() >= Gaudi::StateMachine::RUNNING) {
    00122           sc = svc->sysStart();
    00123         }
    00124       }
    00125       it = find(svc.get()); // now it is in the list because createService added it
    00126       if(sc.isFailure()) { // if initialization failed, remove it from the list
    00127         error() << "Unable to initialize service \"" << typeName.name() << "\""
    00128                 << endmsg;
    00129         m_listsvc.erase(it);
    00130         // Note: removing it from the list + the SmartIF going out of scope should trigger the delete
    00131         // delete svc.get();
    00132         return sc;
    00133       } else { // initialization successful, we can work with the service
    00134         // Move the just initialized service to the back of the list
    00135         // (we care more about order of initialization than of creation)
    00136         m_listsvc.push_back(*it);
    00137         m_listsvc.erase(it);
    00138         it = --m_listsvc.end(); // last entry (the iterator was invalidated by erase)
    00139       }
    00140     } else {
    00141       return StatusCode::FAILURE;
    00142     }
    00143   }
    00144   // 'it' is defined because either we found the service or we created it
    00145   // Now we can activate the service
    00146   it->priority = prio; // if the service is already known, it is equivalent to a setPriority
    00147   it->active = true;   // and make it active
    00148   return StatusCode(StatusCode::SUCCESS, true);
    00149 }

StatusCode ServiceManager::removeService | ( | IService * | svc | ) | `[virtual]`

implementation of ISvcManager::removeService

Definition at line 203 of file ServiceManager.cpp.

    00205 {
    00206   ListSvc::iterator it = find(svc);
    00207   if (it != m_listsvc.end()) {
    00208     m_listsvc.erase(it);
    00209     return StatusCode(StatusCode::SUCCESS,true);
    00210   }
    00211   return StatusCode(StatusCode::FAILURE,true);
    00212 }

StatusCode ServiceManager::removeService | ( | const std::string & | name | ) | `[virtual]`

implementation of ISvcManager::removeService

Definition at line 215 of file ServiceManager.cpp.

    00217 {
    00218   ListSvc::iterator it = find(name);
    00219   if (it != m_listsvc.end()) {
    00220     m_listsvc.erase(it);
    00221     return StatusCode::SUCCESS;
    00222   }
    00223   return StatusCode::FAILURE;
    00224 }

StatusCode ServiceManager::declareSvcType | ( | const std::string & | svcname,
|  | const std::string & | svctype |
| ) |  |  | `[virtual]`

implementation of ISvcManager::declareSvcType

Definition at line 227 of file ServiceManager.cpp.

    00230 {
    00231   std::pair<MapType::iterator, bool> p = m_maptype.insert(std::make_pair(svcname, svctype));
    00232   if( p.second == false) {
    00233     m_maptype.erase ( p.first );
    00234     p = m_maptype.insert(std::make_pair(svcname, svctype) );
    00235     if( p.second == false) return StatusCode::FAILURE;
    00236   }
    00237   return StatusCode::SUCCESS;
    00238 }

SmartIF< IService > & ServiceManager::createService | ( | const Gaudi::Utils::TypeNameString & | nametype | ) | `[virtual]`

implementation of ISvcManager::createService

: check how this hack works

: what does this mean?

Definition at line 45 of file ServiceManager.cpp.

    00047 {
    00048   // Check if the service is already existing
    00049   if(existsService(typeName.name())) {
    00050     // return an error because a service with that name already exists
    00051     return no_service;
    00052   }
    00053
    00055   StatusCode rc = StatusCode::FAILURE;
    00056   rc.setChecked(); //hack to avoid going into infinite recursion on ~StatusCode
    00057
    00058   const std::string &name = typeName.name();
    00059   std::string type = typeName.type();
    00060   if (!typeName.haveType()) { // the type is not explicit
    00061     // see we have some specific type mapping for the name
    00062     MapType::iterator it = m_maptype.find(typeName.name());
    00063     if( it != m_maptype.end() ) {
    00064       type = (*it).second; // use the declared type
    00065     }
    00066   }
    00067
    00069   std::string::size_type ip;
    00070   if ( (ip = type.find("__")) != std::string::npos) {
    00071     type.erase(ip,type.length());
    00072   }
    00073
    00074   IService* service = PluginService::Create<IService*>(type, name, static_cast<ISvcLocator*>(this)); // serviceLocator().get());
    00075   if ( !service ) {
    00076     service = PluginService::CreateWithId<IService*>(type, name, static_cast<ISvcLocator*>(this)); // serviceLocator().get());
    00077   }
    00078
    00079   if ( service ) {
    00080     m_listsvc.push_back(service);
    00081     // Check the compatibility of the version of the interface obtained
    00082     if( !isValidInterface(service) ) {
    00083       fatal() << "Incompatible interface IService version for " << type << endmsg;
    00084       return no_service;
    00085     }
    00086     service->setServiceManager(this);
    00087     return m_listsvc.back().service;
    00088   }
    00089   fatal() << "No Service factory for " << type << " available." << endmsg;
    00090   return no_service;
    00091 }

StatusCode ServiceManager::initialize | ( |  | ) | `[virtual]`

Initialization (from CONFIGURED to INITIALIZED).

Reimplemented from ComponentManager.

Definition at line 241 of file ServiceManager.cpp.

    00243 {
    00244   m_listsvc.sort(); // ensure that the list is ordered by priority
    00245   // we work on a copy to avoid to operate twice on the services created on demand
    00246   // (which are already in the correct state.
    00247   ListSvc tmpList(m_listsvc);
    00248
    00249   StatusCode sc(StatusCode::SUCCESS, true);
    00250   // call initialize() for all services
    00251   for (ListSvc::iterator it = tmpList.begin(); it != tmpList.end(); ++it ) {
    00252     if (!it->active) continue; // only act on active services
    00253     const std::string& name = it->service->name();
    00254     switch (it->service->FSMState()) {
    00255     case Gaudi::StateMachine::INITIALIZED:
    00256       debug() << "Service " << name << " already initialized" << endmsg;
    00257       break;
    00258     case Gaudi::StateMachine::OFFLINE:
    00259       debug() << "Initializing service " << name << endmsg;
    00260       sc = it->service->sysInitialize();
    00261       if( !sc.isSuccess() ) {
    00262         error() << "Unable to initialize Service: " << name << endmsg;
    00263         return sc;
    00264       } break;
    00265     default:
    00266       error() << "Service " << name
    00267           << " not in the correct state to be initialized ("
    00268           << it->service->FSMState() << ")" << endmsg;
    00269       return StatusCode::FAILURE;
    00270     }
    00271   }
    00272   return StatusCode::SUCCESS;
    00273 }

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

Start (from INITIALIZED to RUNNING).

Reimplemented from ComponentManager.

Definition at line 276 of file ServiceManager.cpp.

    00278 {
    00279   m_listsvc.sort(); // ensure that the list is ordered by priority
    00280   // we work on a copy to avoid to operate twice on the services created on demand
    00281   // (which are already in the correct state.
    00282   ListSvc tmpList(m_listsvc);
    00283
    00284   StatusCode sc(StatusCode::SUCCESS, true);
    00285   // call initialize() for all services
    00286   for (ListSvc::iterator it = tmpList.begin(); it != tmpList.end(); ++it ) {
    00287     if (!it->active) continue; // only act on active services
    00288     const std::string& name = it->service->name();
    00289     switch (it->service->FSMState()) {
    00290     case Gaudi::StateMachine::RUNNING:
    00291       debug() << "Service " << name
    00292           << " already started" << endmsg;
    00293       break;
    00294     case Gaudi::StateMachine::INITIALIZED:
    00295       debug() << "Starting service " << name << endmsg;
    00296       sc = it->service->sysStart();
    00297       if( !sc.isSuccess() ) {
    00298         error() << "Unable to start Service: " << name << endmsg;
    00299         return sc;
    00300       } break;
    00301     default:
    00302       error() << "Service " << name
    00303           << " not in the correct state to be started ("
    00304           << it->service->FSMState() << ")" << endmsg;
    00305       return StatusCode::FAILURE;
    00306     }
    00307   }
    00308   return StatusCode::SUCCESS;
    00309 }

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

Stop (from RUNNING to INITIALIZED).

Reimplemented from ComponentManager.

Definition at line 313 of file ServiceManager.cpp.

    00315 {
    00316   m_listsvc.sort(); // ensure that the list is ordered by priority
    00317   // we work on a copy to avoid to operate twice on the services created on demand
    00318   // (which are already in the correct state.
    00319   ListSvc tmpList(m_listsvc);
    00320
    00321   StatusCode sc(StatusCode::SUCCESS, true);
    00322   ListSvc::reverse_iterator it;
    00323   // call stop() for all services
    00324   for (it = tmpList.rbegin(); it != tmpList.rend(); ++it ) {
    00325     if (!it->active) continue; // only act on active services
    00326     const std::string& name = it->service->name();
    00327     switch (it->service->FSMState()) {
    00328     case Gaudi::StateMachine::INITIALIZED:
    00329       debug() << "Service " << name << " already stopped" << endmsg;
    00330       break;
    00331     case Gaudi::StateMachine::RUNNING:
    00332       debug() << "Stopping service " << name << endmsg;
    00333       sc = it->service->sysStop();
    00334       if( !sc.isSuccess() ) {
    00335         error() << "Unable to stop Service: " << name << endmsg;
    00336         return sc;
    00337       } break;
    00338     default:
    00339       debug() << "Service " << name
    00340           << " not in the correct state to be stopped ("
    00341           << it->service->FSMState() << ")" << endmsg;
    00342       return StatusCode::FAILURE;
    00343     }
    00344   }
    00345   return StatusCode::SUCCESS;
    00346 }

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

Finalize (from INITIALIZED to CONFIGURED).

Reimplemented from ComponentManager.

Definition at line 395 of file ServiceManager.cpp.

    00397 {
    00398   // make sure that HistogramDataSvc and THistSvc get finalized after the
    00399   // ToolSvc, and StatusCodeSvc after that
    00400   int pri_tool = getPriority("ToolSvc");
    00401   if (pri_tool != 0) {
    00402     setPriority("THistSvc",pri_tool-1).ignore();
    00403     setPriority("ChronoStatSvc",pri_tool-2).ignore();
    00404     setPriority("AuditorSvc",pri_tool-3).ignore();
    00405     setPriority("HistogramDataSvc",pri_tool-1).ignore();
    00406     // Preserve the relative ordering between HistogramDataSvc and HistogramPersistencySvc
    00407     setPriority("HistogramPersistencySvc",pri_tool-2).ignore();
    00408   }
    00409
    00410   // make sure the StatusCodeSvc gets finalized really late:
    00411   setPriority("StatusCodeSvc",-9999).ignore();
    00412
    00413   m_listsvc.sort(); // ensure that the list is ordered by priority
    00414   // we work on a copy to avoid to operate twice on the services created on demand
    00415   // (which are already in the correct state).
    00416   ListSvc tmpList(m_listsvc);
    00417
    00418   StatusCode sc(StatusCode::SUCCESS, true);
    00419   // call finalize() for all services in reverse order
    00420   ListSvc::reverse_iterator rit;
    00421   for (rit = tmpList.rbegin(); rit != tmpList.rend(); ++rit ) {
    00422     if (!rit->active) continue; // only act on active services
    00423     const std::string& name = rit->service->name();
    00424     // ignore the current state for the moment
    00425     // if( Gaudi::StateMachine::INITIALIZED == rit->service->state() ) {
    00426     debug() << "Finalizing service " << name << endmsg;
    00427     if ( !(rit->service->sysFinalize()).isSuccess() ) {
    00428       warning() << "Finalization of service " << name << " failed" << endmsg;
    00429       sc = StatusCode::FAILURE;
    00430     }
    00431   }
    00432   debug() << "Service reference count check:" << endmsg;
    00433   ListSvc::iterator it;
    00434   while (!tmpList.empty()) {
    00435     it = tmpList.begin();
    00436     const std::string& name = it->service->name();
    00437     const unsigned long rc = it->service->refCount() - 1; // exclude the count due to the temporary list
    00438     debug() << "---- " << name
    00439             << " (refCount = " << rc << ")" << endmsg;
    00440     if (rc < 1) {
    00441       warning() << "Too low reference count for " << name
    00442                 << " (should not go below 1 at this point)" << endmsg;
    00443       it->service->addRef();
    00444     }
    00445     tmpList.pop_front();
    00446   }
    00447
    00448   // loop over all Active Services, removing them one by one.
    00449   // They should be deleted because the reference counting goes to 0.
    00450   it = m_listsvc.begin();
    00451   while (it != m_listsvc.end()) {
    00452     if (it->active) {
    00453       it = m_listsvc.erase(it);
    00454     } else {
    00455       ++it;
    00456     }
    00457   }
    00458   return sc ;
    00459 }

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

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

Reimplemented from ComponentManager.

Definition at line 349 of file ServiceManager.cpp.

    00351 {
    00352   m_listsvc.sort(); // ensure that the list is ordered by priority
    00353   // we work on a copy to avoid to operate twice on the services created on demand
    00354   // (which are already in the correct state.
    00355   ListSvc tmpList(m_listsvc);
    00356
    00357   StatusCode sc(StatusCode::SUCCESS, true);
    00358   ListSvc::iterator it;
    00359   // Re-Initialize all services
    00360   for ( it = tmpList.begin(); it != tmpList.end(); ++it ) {
    00361     if (!it->active) continue; // only act on active services
    00362     sc = it->service->sysReinitialize();
    00363     if( !sc.isSuccess() ) {
    00364       error() << "Unable to re-initialize Service: " << it->service->name() << endmsg;
    00365       return StatusCode::FAILURE;
    00366     }
    00367   }
    00368   return StatusCode::SUCCESS;
    00369 }

StatusCode ServiceManager::restart | ( |  | ) | `[virtual]`

Initialization (from RUNNING to RUNNING, via INITIALIZED).

Reimplemented from ComponentManager.

Definition at line 372 of file ServiceManager.cpp.

    00374 {
    00375   m_listsvc.sort(); // ensure that the list is ordered by priority
    00376   // we work on a copy to avoid to operate twice on the services created on demand
    00377   // (which are already in the correct state.
    00378   ListSvc tmpList(m_listsvc);
    00379
    00380   StatusCode sc(StatusCode::SUCCESS, true);
    00381   ListSvc::iterator it;
    00382   // Re-Start all services
    00383   for ( it = tmpList.begin(); it != tmpList.end(); ++it ) {
    00384     if (!it->active) continue; // only act on active services
    00385     sc = it->service->sysRestart();
    00386     if( !sc.isSuccess() ) {
    00387       error() << "Unable to re-start Service: " << it->service->name() << endmsg;
    00388       return StatusCode::FAILURE;
    00389     }
    00390   }
    00391   return StatusCode::SUCCESS;
    00392 }

int ServiceManager::getPriority | ( | const std::string & | name | ) | const`[virtual]`

manage priorities of services

Definition at line 464 of file ServiceManager.cpp.

    00464                                                        {
    00465 //------------------------------------------------------------------------------
    00466   ListSvc::const_iterator it = find(name);
    00467   return (it != m_listsvc.end()) ? it->priority: 0;
    00468 }

StatusCode ServiceManager::setPriority | ( | const std::string & | name,
|  | int | pri |
| ) |  |  | `[virtual]`

Definition at line 472 of file ServiceManager.cpp.

    00472                                                            {
    00473 //------------------------------------------------------------------------------
    00474   ListSvc::iterator it = find(name);
    00475   if (it != m_listsvc.end()) {
    00476     it->priority = prio;
    00477     return StatusCode::SUCCESS;
    00478   }
    00479   return StatusCode::FAILURE;
    00480 }

bool ServiceManager::loopCheckEnabled | ( |  | ) | const`[virtual]`

Get the value of the initialization loop check flag.

Definition at line 485 of file ServiceManager.cpp.

    00485                                             {
    00486   return m_loopCheck;
    00487 }

void ServiceManager::setLoopCheckEnabled | ( | bool | en | ) | `[virtual]`

Set the value of the initialization loop check flag.

Definition at line 491 of file ServiceManager.cpp.

    00491                                                 {
    00492   m_loopCheck = en;
    00493 }

const std::string& ServiceManager::name | ( |  | ) | const`[inline, virtual]`

Return the name of the manager (implementation of INamedInterface).

Implements CommonMessaging< implements1< IComponentManager > >.

Definition at line 116 of file ServiceManager.h.

    00116                                 {
    00117     static std::string _name = "ServiceManager";
    00118     return _name;
    00119   }

SmartIF< IService > & ServiceManager::service | ( | const Gaudi::Utils::TypeNameString & | typeName,
|  | const bool | createIf = `true` |
| ) |  |  | `[virtual]`

Returns a smart pointer to a service.

Definition at line 153 of file ServiceManager.cpp.

    00153                                                                                                         {
    00154   const std::string &name = typeName.name();
    00155   ListSvc::iterator it = find(name);
    00156
    00157   if (it !=  m_listsvc.end()) {
    00158     if (m_loopCheck &&
    00159         (createIf && it->service->FSMState() == Gaudi::StateMachine::CONFIGURED)) {
    00160       error()
    00161           << "Initialization loop detected when creating service \"" << name
    00162           << "\""
    00163           << endmsg;
    00164       return no_service;
    00165     }
    00166     return it->service;
    00167   } else {
    00168     // Service not found. The user may be interested in one of the interfaces
    00169     // of the application manager itself
    00170     if( name == "ApplicationMgr" ||
    00171         name == "APPMGR" ||
    00172         name == "" ) {
    00173       return m_appSvc;
    00174     } else if ( createIf ){
    00175       //last resort: we try to create the service
    00176       if (addService(typeName).isSuccess()){
    00177         return find(name)->service;
    00178       }
    00179     }
    00180   }
    00181   return no_service;
    00182 }

ListSvc::iterator ServiceManager::find | ( | const std::string & | name | ) | `[inline, private]`

Definition at line 131 of file ServiceManager.h.

    00131                                                      {
    00132     return std::find(m_listsvc.begin(), m_listsvc.end(), name);
    00133   }

ListSvc::const_iterator ServiceManager::find | ( | const std::string & | name | ) | const`[inline, private]`

Definition at line 134 of file ServiceManager.h.

    00134                                                                  {
    00135     return std::find(m_listsvc.begin(), m_listsvc.end(), name);
    00136   }

ListSvc::iterator ServiceManager::find | ( | const IService * | ptr | ) | `[inline, private]`

Definition at line 137 of file ServiceManager.h.

    00137                                                    {
    00138     return std::find(m_listsvc.begin(), m_listsvc.end(), ptr);
    00139   }

ListSvc::const_iterator ServiceManager::find | ( | const IService * | ptr | ) | const`[inline, private]`

Definition at line 140 of file ServiceManager.h.

    00140                                                                {
    00141     return std::find(m_listsvc.begin(), m_listsvc.end(), ptr);
    00142   }

## Member Data Documentation

ListSvc ServiceManager::m_listsvc`[private]`

List of service maintained by ServiceManager.

Definition at line 145 of file ServiceManager.h.

MapType ServiceManager::m_maptype`[private]`

Map of service name and service type.

Definition at line 146 of file ServiceManager.h.

bool ServiceManager::m_loopCheck`[private]`

Check for service initialization loops.

Definition at line 147 of file ServiceManager.h.

SmartIF<IService> ServiceManager::m_appSvc`[private]`

Pointer to the application IService interface.

Definition at line 150 of file ServiceManager.h.

std::list<IService*> ServiceManager::m_listOfPtrs`[mutable, private]`

List of pointers to the know services used to implement getServices().

Definition at line 153 of file ServiceManager.h.

GaudiUtils::Map<InterfaceID, SmartIF<IInterface> > ServiceManager::m_defaultImplementations`[private]`

Definition at line 155 of file ServiceManager.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r8/GaudiSvc/src/ApplicationMgr/ServiceManager.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r8/GaudiSvc/src/ApplicationMgr/ServiceManager.cpp