| The Gaudi Framework v29r0 (ff2e7097)

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

- File List
- File Members

ServiceManager.cpp
Go to the documentation of this file.
1 // Include files
2 #include "ServiceManager.h"
3 #include "GaudiKernel/IIncidentListener.h"
4 #include "GaudiKernel/IIncidentSvc.h"
5 #include "GaudiKernel/IService.h"
6 #include "GaudiKernel/Incident.h"
7 #include "GaudiKernel/MsgStream.h"
8 #include "GaudiKernel/ObjectFactory.h"
9 #include "GaudiKernel/Service.h"
10 #include "GaudiKernel/SmartIF.h"
11 #include "GaudiKernel/System.h"
12 #include "GaudiKernel/TypeNameString.h"
13 #include "GaudiKernel/reverse.h"
14
15 #include <algorithm>
16 #include <cassert>
17 #include <functional>
18 #include <iostream>
19
20 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) )
21 #define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) )
22
23 #define DEBMSG ON_DEBUG debug()
24 #define VERMSG ON_VERBOSE verbose()
25
27 static SmartIF<IService> no_service;
28
30 namespace
31 {
32 template <typename C>
33 std::vector<IService*> activeSvc( const C& lst )
34 {
35 std::vector<IService*> v;
36 v.reserve( lst.size() );
37 for ( auto& i : lst ) {
38 if ( i.active ) v.push_back( i.service.get() );
39 }
40 return v;
41 }
42 }
43
44 // constructor
45 ServiceManager::ServiceManager( IInterface* application )
46 : base_class( application, IService::interfaceID() ), m_appSvc( application )
47 {
48 // Set the service locator to myself
49 m_svcLocator = this;
50 addRef(); // increase ref count, so we live forever...
51 }
52
53 // destructor
54 ServiceManager::~ServiceManager()
55 {
56 //-- inform the orphan services that I am gone....
57 for ( auto& svc : m_listsvc ) svc.service->setServiceManager( nullptr );
58 }
59
60 //------------------------------------------------------------------------------
61 // Instantiate a service
62 SmartIF<IService>& ServiceManager::createService( const Gaudi::Utils::TypeNameString& typeName )
63 //------------------------------------------------------------------------------
64 {
65 // Check if the service is already existing
66 if ( existsService( typeName.name() ) ) {
67 // return an error because a service with that name already exists
68 return no_service;
69 }
70
71 const std::string& name = typeName.name();
72 std::string type = typeName.type();
73 if ( !typeName.haveType() ) { // the type is not explicit
74 // see we have some specific type mapping for the name
75 auto it = m_maptype.find( typeName.name() );
76 if ( it != m_maptype.end() ) {
77 type = it->second; // use the declared type
78 }
79 }
80
82 auto ip = type.find( "__" );
83 if ( ip != std::string::npos ) type.erase( ip, type.length() );
84
85 IService* service = Service::Factory::create( type, name, this );
86 if ( !service ) {
87 fatal() << "No Service factory for " << type << " available." << endmsg;
88 return no_service;
89 }
90 // Check the compatibility of the version of the interface obtained
91 if ( !isValidInterface( service ) ) {
92 fatal() << "Incompatible interface IService version for " << type << endmsg;
93 return no_service;
94 }
95
96 m_listsvc.push_back( service );
97 service->setServiceManager( this );
98 return m_listsvc.back().service; // DANGER: returns a reference to a SmartIF in m_listsvc, and hence does no longer
99 // allow relocations of those...
100 }
101
102 //------------------------------------------------------------------------------
103 // add a service to the managed list
104 StatusCode ServiceManager::addService( IService* svc, int prio )
105 //------------------------------------------------------------------------------
106 {
107 ListSvc::iterator it = find( svc );
108 LockGuard_t lck( m_gLock );
109 if ( it != m_listsvc.end() ) {
110 it->priority = prio; // if the service is already known, it is equivalent to a setPriority
111 it->active = true; // and make it active
112 } else {
113 m_listsvc.emplace_back( svc, prio, true );
114 }
115 return StatusCode::SUCCESS;
116 }
117
118 //------------------------------------------------------------------------------
119 // add the service with the give type and name to the active list
120 StatusCode ServiceManager::addService( const Gaudi::Utils::TypeNameString& typeName, int prio )
121 //------------------------------------------------------------------------------
122 {
123 auto it = find( typeName.name() ); // try to find the service by name
124 if ( it == m_listsvc.end() ) { // not found
125 // If the service does not exist, we create it
126 SmartIF<IService>& svc =
127 createService( typeName ); // WARNING: svc is now a reference to something that lives in m_listsvc
128 if ( !svc ) return StatusCode::FAILURE;
129 it = find( svc.get() ); // now it is in the list because createService added it
130 it->priority = prio;
131 StatusCode sc = StatusCode( StatusCode::SUCCESS, true );
132 if ( targetFSMState() >= Gaudi::StateMachine::INITIALIZED ) { // WARNING: this can trigger a recursion!!!
133 sc = svc->sysInitialize();
134 if ( sc.isSuccess() && targetFSMState() >= Gaudi::StateMachine::RUNNING ) {
135 sc = svc->sysStart();
136 }
137 }
138 if ( sc.isFailure() ) { // if initialization failed, remove it from the list
139 error() << "Unable to initialize service \"" << typeName.name() << "\"" << endmsg;
140 LockGuard_t lck( m_gLock );
141 m_listsvc.erase( it );
142 // Note: removing it from the list + the SmartIF going out of scope should trigger the delete
143 // delete svc.get();
144 return sc;
145 }
146 // initialization successful, we can work with the service
147 // Move the just initialized service to the back of the list
148 // (we care more about order of initialization than of creation)
149 LockGuard_t lck( m_gLock );
150 m_listsvc.push_back( *it );
151 m_listsvc.erase( it );
152 it = std::prev( std::end( m_listsvc ) ); // last entry (the iterator was invalidated by erase)
153 } else {
154 // if the service is already known, it is equivalent to a setPriority
155 it->priority = prio;
156 }
157 // 'it' is defined because either we found the service or we created it
158 // Now we can activate the service
159 it->active = true; // and make it active
160 return StatusCode( StatusCode::SUCCESS, true );
161 }
162
163 //------------------------------------------------------------------------------
164 // Returns a smart pointer to a service.
165 SmartIF<IService>& ServiceManager::service( const Gaudi::Utils::TypeNameString& typeName, const bool createIf )
166 {
167 const std::string& name = typeName.name();
168
169 // Acquire the RAII lock to avoid simultaneous attempts from different threads to initialize a service
170
171 Mutex_t* imut;
172 {
173 // get the global lock, then extract/create the service specific mutex
174 // then release global lock
175
176 LockGuard_t lk( m_gLock );
177 auto mit = m_lockMap.find( name );
178 if ( mit == m_lockMap.end() ) {
179 mit = m_lockMap.emplace( name, std::unique_ptr<Mutex_t>( new Mutex_t ) ).first;
180 }
181 imut = mit->second.get();
182 }
183
184 {
185 // now we have the service specific lock on the above mutex
186 LockGuard_t lk2( *imut );
187
188 auto it = find( name );
189
190 if ( it != m_listsvc.end() ) {
191 if ( m_loopCheck && ( createIf && it->service->FSMState() == Gaudi::StateMachine::CONFIGURED ) ) {
192 error() << "Initialization loop detected when creating service \"" << name << "\"" << endmsg;
193 return no_service;
194 }
195 return it->service;
196 }
197
198 // Service not found. The user may be interested in one of the interfaces
199 // of the application manager itself
200 if ( name == "ApplicationMgr" || name == "APPMGR" || name == "" ) {
201 return m_appSvc;
202 }
203
204 // last resort: we try to create the service
205 if ( createIf && addService( typeName ).isSuccess() ) {
206 return find( name )->service;
207 }
208
209 return no_service;
210 }
211 }
212
213 //------------------------------------------------------------------------------
214 const std::list<IService*>& ServiceManager::getServices() const
215 //------------------------------------------------------------------------------
216 {
217 m_listOfPtrs.clear();
218 std::transform( std::begin( m_listsvc ), std::end( m_listsvc ), std::back_inserter( m_listOfPtrs ),
219 []( ListSvc::const_reference i ) { return const_cast<IService*>( i.service.get() ); } );
220 return m_listOfPtrs;
221 }
222
223 //------------------------------------------------------------------------------
224 bool ServiceManager::existsService( const std::string& name ) const
225 //------------------------------------------------------------------------------
226 {
227 return find( name ) != m_listsvc.end();
228 }
229
230 //------------------------------------------------------------------------------
231 StatusCode ServiceManager::removeService( IService* svc )
232 //------------------------------------------------------------------------------
233 {
234 auto it = find( svc );
235 if ( it == m_listsvc.end() ) return StatusCode( StatusCode::FAILURE, true );
236 m_listsvc.erase( it );
237 return StatusCode( StatusCode::SUCCESS, true );
238 }
239
240 //------------------------------------------------------------------------------
241 StatusCode ServiceManager::removeService( const std::string& name )
242 //------------------------------------------------------------------------------
243 {
244 auto it = find( name );
245 if ( it == m_listsvc.end() ) return StatusCode::FAILURE;
246 m_listsvc.erase( it );
247 return StatusCode::SUCCESS;
248 }
249
250 //------------------------------------------------------------------------------
251 StatusCode ServiceManager::declareSvcType( const std::string& svcname, const std::string& svctype )
252 //------------------------------------------------------------------------------
253 {
254 // once we get to C++17, replace with m_maptype.insert_or_assign...
255 auto p = m_maptype.emplace( svcname, svctype );
256 if ( !p.second ) p.first->second = svctype;
257 return StatusCode::SUCCESS;
258 }
259
260 //------------------------------------------------------------------------------
261 StatusCode ServiceManager::initialize()
262 //------------------------------------------------------------------------------
263 {
264 // ensure that the list is ordered by priority
265 m_listsvc.sort();
266 // we work on a copy to avoid to operate twice on the services created on demand
267 // which are already in the correct state.
268
269 StatusCode sc( StatusCode::SUCCESS, true );
270 // call initialize() for all services
271 for ( auto& it : activeSvc( m_listsvc ) ) {
272 const std::string& name = it->name();
273 switch ( it->FSMState() ) {
274 case Gaudi::StateMachine::INITIALIZED:
275 DEBMSG << "Service " << name << " already initialized" << endmsg;
276 break;
277 case Gaudi::StateMachine::OFFLINE:
278 DEBMSG << "Initializing service " << name << endmsg;
279 sc = it->sysInitialize();
280 if ( !sc.isSuccess() ) {
281 error() << "Unable to initialize Service: " << name << endmsg;
282 return sc;
283 }
284 break;
285 default:
286 error() << "Service " << name << " not in the correct state to be initialized (" << it->FSMState() << ")"
287 << endmsg;
288 return StatusCode::FAILURE;
289 }
290 }
291 return StatusCode::SUCCESS;
292 }
293
294 //------------------------------------------------------------------------------
295 StatusCode ServiceManager::start()
296 //------------------------------------------------------------------------------
297 {
298 // ensure that the list is ordered by priority
299 m_listsvc.sort();
300 // we work on a copy to avoid to operate twice on the services created on demand
301 // (which are already in the correct state.
302 // only act on active services
303 StatusCode sc( StatusCode::SUCCESS, true );
304 // call initialize() for all services
305 for ( auto& it : activeSvc( m_listsvc ) ) {
306 const std::string& name = it->name();
307 switch ( it->FSMState() ) {
308 case Gaudi::StateMachine::RUNNING:
309 DEBMSG << "Service " << name << " already started" << endmsg;
310 break;
311 case Gaudi::StateMachine::INITIALIZED:
312 DEBMSG << "Starting service " << name << endmsg;
313 sc = it->sysStart();
314 if ( !sc.isSuccess() ) {
315 error() << "Unable to start Service: " << name << endmsg;
316 return sc;
317 }
318 break;
319 default:
320 error() << "Service " << name << " not in the correct state to be started (" << it->FSMState() << ")" << endmsg;
321 return StatusCode::FAILURE;
322 }
323 }
324 return StatusCode::SUCCESS;
325 }
326
327 //------------------------------------------------------------------------------
328 StatusCode ServiceManager::stop()
329 //------------------------------------------------------------------------------
330 {
331 // ensure that the list is ordered by priority
332 m_listsvc.sort();
333 // we work on a copy to avoid to operate twice on the services created on demand
334 // which are already in the correct state.
335 // only act on active services
336
337 StatusCode sc( StatusCode::SUCCESS, true );
338 // call stop() for all services
339 for ( const auto& svc : reverse( activeSvc( m_listsvc ) ) ) {
340 const std::string& name = svc->name();
341 switch ( svc->FSMState() ) {
342 case Gaudi::StateMachine::INITIALIZED:
343 DEBMSG << "Service " << name << " already stopped" << endmsg;
344 break;
345 case Gaudi::StateMachine::RUNNING:
346 DEBMSG << "Stopping service " << name << endmsg;
347 sc = svc->sysStop();
348 if ( !sc.isSuccess() ) {
349 error() << "Unable to stop Service: " << name << endmsg;
350 return sc;
351 }
352 break;
353 default:
354 DEBMSG << "Service " << name << " not in the correct state to be stopped (" << svc->FSMState() << ")" << endmsg;
355 return StatusCode::FAILURE;
356 }
357 }
358 return StatusCode::SUCCESS;
359 }
360
361 //------------------------------------------------------------------------------
362 StatusCode ServiceManager::reinitialize()
363 //------------------------------------------------------------------------------
364 {
365 // ensure that the list is ordered by priority
366 m_listsvc.sort();
367 // we work on a copy to avoid to operate twice on the services created on demand
368 // which are already in the correct state.
369 // only act on active services
370 StatusCode sc( StatusCode::SUCCESS, true );
371 // Re-Initialize all services
372 for ( auto& svc : activeSvc( m_listsvc ) ) {
373 sc = svc->sysReinitialize();
374 if ( !sc.isSuccess() ) {
375 error() << "Unable to re-initialize Service: " << svc->name() << endmsg;
376 return StatusCode::FAILURE;
377 }
378 }
379 return StatusCode::SUCCESS;
380 }
381
382 //------------------------------------------------------------------------------
383 StatusCode ServiceManager::restart()
384 //------------------------------------------------------------------------------
385 {
386 // ensure that the list is ordered by priority
387 m_listsvc.sort();
388 // we work on a copy to avoid to operate twice on the services created on demand
389 // which are already in the correct state.
390 // only act on active services
391 StatusCode sc( StatusCode::SUCCESS, true );
392 // Re-Start all services
393 for ( auto& svc : activeSvc( m_listsvc ) ) {
394 sc = svc->sysRestart();
395 if ( !sc.isSuccess() ) {
396 error() << "Unable to re-start Service: " << svc->name() << endmsg;
397 return StatusCode::FAILURE;
398 }
399 }
400 return StatusCode::SUCCESS;
401 }
402
403 //------------------------------------------------------------------------------
404 StatusCode ServiceManager::finalize()
405 //------------------------------------------------------------------------------
406 {
407 // make sure that HistogramDataSvc and THistSvc get finalized after the
408 // ToolSvc, and the FileMgr and StatusCodeSvc after that
409 int pri_tool = getPriority( "ToolSvc" );
410 if ( pri_tool != 0 ) {
411 setPriority( "THistSvc", pri_tool - 10 ).ignore();
412 setPriority( "ChronoStatSvc", pri_tool - 20 ).ignore();
413 setPriority( "AuditorSvc", pri_tool - 30 ).ignore();
414 setPriority( "NTupleSvc", pri_tool - 10 ).ignore();
415 setPriority( "HistogramDataSvc", pri_tool - 10 ).ignore();
416 // Preserve the relative ordering between HistogramDataSvc and HistogramPersistencySvc
417 setPriority( "HistogramPersistencySvc", pri_tool - 20 ).ignore();
418 setPriority( "HistorySvc", pri_tool - 30 ).ignore();
419 setPriority( "FileMgr", pri_tool - 40 ).ignore();
420 }
421
422 // get list of PostFinalize clients
423 std::vector<IIncidentListener*> postFinList;
424 auto p_inc = service<IIncidentSvc>( "IncidentSvc", false );
425 if ( p_inc ) {
426 p_inc->getListeners( postFinList, IncidentType::SvcPostFinalize );
427 p_inc.reset();
428 }
429
430 // make sure the StatusCodeSvc gets finalized really late:
431 setPriority( "StatusCodeSvc", -9999 ).ignore();
432
433 // ensure that the list is ordered by priority
434 m_listsvc.sort();
435 // dump();
436
437 StatusCode sc( StatusCode::SUCCESS, true );
438 {
439 // we work on a copy to avoid to operate twice on the services created on demand
440 // which are already in the correct state.
441 // only act on active services
442 // call finalize() for all services in reverse order
443 for ( const auto& svc : reverse( activeSvc( m_listsvc ) ) ) {
444 const std::string& name = svc->name();
445 // ignore the current state for the moment
446 // if( Gaudi::StateMachine::INITIALIZED == svc->state() )
447 DEBMSG << "Finalizing service " << name << endmsg;
448 if ( !svc->sysFinalize().isSuccess() ) {
449 warning() << "Finalization of service " << name << " failed" << endmsg;
450 sc = StatusCode::FAILURE;
451 }
452 }
453 }
454
455 // call SvcPostFinalize on all clients
456 if ( !postFinList.empty() ) {
457 DEBMSG << "Will call SvcPostFinalize for " << postFinList.size() << " clients" << endmsg;
458 Incident inc( "ServiceManager", IncidentType::SvcPostFinalize );
459 for ( auto& itr : postFinList ) itr->handle( inc );
460 }
461
462 // loop over all Active Services, removing them one by one.
463 // They should be deleted because the reference counting goes to 0.
464 DEBMSG << "Looping over all active services..." << endmsg;
465 auto it = m_listsvc.begin();
466 while ( it != m_listsvc.end() ) {
467 DEBMSG << "---- " << it->service->name() << " (refCount = " << it->service->refCount() << ")" << endmsg;
468 if ( it->service->refCount() < 1 ) {
469 warning() << "Too low reference count for " << it->service->name() << " (should not go below 1 at this point)"
470 << endmsg;
471 it->service->addRef();
472 }
473 if ( it->active ) {
474 it = m_listsvc.erase( it );
475 } else {
476 ++it;
477 }
478 }
479 return sc;
480 }
481
482 //------------------------------------------------------------------------------
483 int ServiceManager::getPriority( const std::string& name ) const
484 {
485 //------------------------------------------------------------------------------
486 auto it = find( name );
487 return ( it != m_listsvc.end() ) ? it->priority : 0;
488 }
489
490 //------------------------------------------------------------------------------
491 StatusCode ServiceManager::setPriority( const std::string& name, int prio )
492 {
493 //------------------------------------------------------------------------------
494 auto it = find( name );
495 if ( it == m_listsvc.end() ) return StatusCode::FAILURE;
496 it->priority = prio;
497 return StatusCode::SUCCESS;
498 }
499
500 //------------------------------------------------------------------------------
501 // Get the value of the initialization loop check flag.
502 //------------------------------------------------------------------------------
503 bool ServiceManager::loopCheckEnabled() const { return m_loopCheck; }
504 //------------------------------------------------------------------------------
505 // Set the value of the initialization loop check flag.
506 //------------------------------------------------------------------------------
507 void ServiceManager::setLoopCheckEnabled( bool en ) { m_loopCheck = en; }
508
509 //------------------------------------------------------------------------------
510 // Dump out contents of service list
511 //------------------------------------------------------------------------------
512 void ServiceManager::dump() const
513 {
514
515 auto& log = info();
516 log << "\n"
517 << "===================== listing all services ===================\n"
518 << " prior ref name active\n";
519
520 for ( const auto& svc : m_listsvc ) {
521
522 log.width( 6 );
523 log.flags( std::ios_base::right );
524 log << svc.priority << " ";
525 log.width( 5 );
526 log << svc.service->refCount() << " ";
527 log.width( 30 );
528 log.flags( std::ios_base::left );
529 log << svc.service->name() << " ";
530 log.width( 2 );
531 log << svc.active << std::endl;
532 }
533
534 log << "=================================================================\n";
535 log << endmsg;
536 }
537
538 DECLARE_OBJECT_FACTORY( ServiceManager )
ServiceManager
The ServiceManager class is in charge of the creation of concrete instances of Services.
Definition: ServiceManager.h:36
System.h
ServiceManager::m_listOfPtrs
std::list< IService * > m_listOfPtrs
List of pointers to the know services used to implement getServices()
Definition: ServiceManager.h:176
ServiceManager::setLoopCheckEnabled
void setLoopCheckEnabled(bool en) override
Set the value of the initialization loop check flag.
Definition: ServiceManager.cpp:507
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:17
StatusCode::SUCCESS
Definition: StatusCode.h:31
ServiceManager::m_appSvc
SmartIF< IService > m_appSvc
Pointer to the application IService interface.
Definition: ServiceManager.h:173
SmartIF< IService >
std::vector::empty
T empty(T...args)
ServiceManager::LockGuard_t
boost::lock_guard< Mutex_t > LockGuard_t
Definition: ServiceManager.h:182
ServiceManager::m_gLock
Mutex_t m_gLock
Definition: ServiceManager.h:184
ServiceManager::finalize
StatusCode finalize() override
Finalize (from INITIALIZED to CONFIGURED).
Definition: ServiceManager.cpp:404
Gaudi::StateMachine::CONFIGURED
Definition: StateMachine.h:16
StatusCode::FAILURE
Definition: StatusCode.h:31
MsgStream.h
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:117
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
ComponentManager::m_svcLocator
SmartIF< ISvcLocator > m_svcLocator
Service locator (needed to access the MessageSvc)
Definition: ComponentManager.h:76
ServiceManager::m_loopCheck
bool m_loopCheck
Check for service initialization loops.
Definition: ServiceManager.h:170
ServiceManager::ServiceManager
ServiceManager(IInterface *application)
default creator
Definition: ServiceManager.cpp:45
std::endl
T endl(T...args)
ObjectFactory.h
ComponentManager::targetFSMState
Gaudi::StateMachine::State targetFSMState() const override
When we are in the middle of a transition, get the state where the transition is leading us...
Definition: ComponentManager.h:63
ServiceManager::Mutex_t
boost::recursive_mutex Mutex_t
Mutex to synchronize shared service initialization between threads.
Definition: ServiceManager.h:181
ServiceManager::restart
StatusCode restart() override
Initialization (from RUNNING to RUNNING, via INITIALIZED).
Definition: ServiceManager.cpp:383
std::list::end
T end(T...args)
isValidInterface
bool isValidInterface(I *i)
Templated function that throws an exception if the version if the interface implemented by the object...
Definition: IInterface.h:374
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
ServiceManager::m_maptype
MapType m_maptype
Map of service name and service type.
Definition: ServiceManager.h:169
std::prev
T prev(T...args)
std::string
STL class.
Incident.h
Service.h
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
IService::sysInitialize
virtual StatusCode sysInitialize()=0
Initialize Service.
std::vector::push_back
T push_back(T...args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:111
ServiceManager::existsService
bool existsService(const std::string &name) const override
implementation of ISvcLocation::existsService
Definition: ServiceManager.cpp:224
ServiceManager::stop
StatusCode stop() override
Stop (from RUNNING to INITIALIZED).
Definition: ServiceManager.cpp:328
GaudiUtils::Map::end
iterator end()
Definition: Map.h:134
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:12
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:114
ServiceManager::loopCheckEnabled
bool loopCheckEnabled() const override
Get the value of the initialization loop check flag.
Definition: ServiceManager.cpp:503
ServiceManager::dump
void dump() const
Definition: ServiceManager.cpp:512
IIncidentSvc.h
IService
General service interface definition.
Definition: IService.h:18
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
IInterface
Definition of the basic interface.
Definition: IInterface.h:277
gaudirun.type
type
Definition: gaudirun.py:133
ServiceManager::~ServiceManager
~ServiceManager() override
virtual destructor
Definition: ServiceManager.cpp:54
SmartIF.h
DECLARE_OBJECT_FACTORY
#define DECLARE_OBJECT_FACTORY(x)
Definition: ObjectFactory.h:16
std::string::erase
T erase(T...args)
ServiceManager::name
const std::string & name() const override
Return the name of the manager (implementation of INamedInterface)
Definition: ServiceManager.h:111
GaudiUtils::Map::find
iterator find(const key_type &key)
Definition: Map.h:151
ServiceManager::getServices
const std::list< IService * > & getServices() const override
Return the list of Services.
Definition: ServiceManager.cpp:214
ServiceManager::start
StatusCode start() override
Start (from INITIALIZED to RUNNING).
Definition: ServiceManager.cpp:295
GaudiUtils::Map::emplace
std::pair< iterator, bool > emplace(Args &&...args)
Definition: Map.h:169
std::list::clear
T clear(T...args)
std::list< IService * >
ServiceManager::m_lockMap
std::map< std::string, std::unique_ptr< Mutex_t > > m_lockMap
Definition: ServiceManager.h:185
IService.h
ServiceManager::getPriority
int getPriority(const std::string &name) const override
manage priorities of services
Definition: ServiceManager.cpp:483
reverse
reverse_wrapper< T > reverse(T &&iterable)
Definition: reverse.h:35
std::unique_ptr::get
T get(T...args)
std::string::find
T find(T...args)
std::string::length
T length(T...args)
Gaudi::StateMachine::RUNNING
Definition: StateMachine.h:18
std::vector
STL class.
IService::sysStart
virtual StatusCode sysStart()=0
Start Service.
std::unique_ptr< Mutex_t >
std::begin
T begin(T...args)
std::back_inserter
T back_inserter(T...args)
Gaudi::Utils::TypeNameString::type
const std::string & type() const
Definition: TypeNameString.h:39
ServiceManager::reinitialize
StatusCode reinitialize() override
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Definition: ServiceManager.cpp:362
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
std::map::emplace
T emplace(T...args)
ServiceManager.h
std::list::back
T back(T...args)
TypeNameString.h
CommonMessaging
Definition: CommonMessaging.h:62
IIncidentListener.h
Gaudi::Utils::TypeNameString::haveType
bool haveType() const
Definition: TypeNameString.h:41
ServiceManager::find
ListSvc::iterator find(const std::string &name)
Definition: ServiceManager.h:133
ServiceManager::declareSvcType
StatusCode declareSvcType(const std::string &svcname, const std::string &svctype) override
implementation of ISvcManager::declareSvcType
Definition: ServiceManager.cpp:251
std::list::sort
T sort(T...args)
std::transform
T transform(T...args)
DEBMSG
#define DEBMSG
Definition: ServiceManager.cpp:23
Gaudi::Utils::TypeNameString::name
const std::string & name() const
Definition: TypeNameString.h:40
ServiceManager::setPriority
StatusCode setPriority(const std::string &name, int pri) override
Definition: ServiceManager.cpp:491
ServiceManager::removeService
StatusCode removeService(IService *svc) override
implementation of ISvcManager::removeService
Definition: ServiceManager.cpp:231
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:109
CommonMessagingBase::fatal
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
Definition: CommonMessaging.h:105
ServiceManager::service
SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true) override
Returns a smart pointer to a service.
Definition: ServiceManager.cpp:165
GaudiDict::typeName
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:23
ServiceManager::m_listsvc
ListSvc m_listsvc
List of service maintained by ServiceManager This contains SmartIF<T> for all services – and because...
Definition: ServiceManager.h:155
Gaudi::StateMachine::OFFLINE
Definition: StateMachine.h:15
IService::setServiceManager
virtual void setServiceManager(ISvcManager *)=0
ServiceManager::createService
SmartIF< IService > & createService(const Gaudi::Utils::TypeNameString &nametype) override
implementation of ISvcManager::createService NOTE: as this returns a &, we must guarantee that once c...
Definition: ServiceManager.cpp:62
ServiceManager::ServiceItem::service
SmartIF< IService > service
Definition: ServiceManager.h:41
reverse.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
std::vector::reserve
T reserve(T...args)
Gaudi.Configuration.log
log
Definition: Configuration.py:13
ServiceManager::addService
StatusCode addService(IService *svc, int prio=DEFAULT_SVC_PRIORITY) override
implementation of ISvcManager::addService
Definition: ServiceManager.cpp:104
std::list::emplace_back
T emplace_back(T...args)
ServiceManager::initialize
StatusCode initialize() override
Initialization (from CONFIGURED to INITIALIZED).
Definition: ServiceManager.cpp:261