Gaudi Framework, version v24r2
Home
Generated: Wed Dec 4 2013
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
GaudiCoreSvc
src
ApplicationMgr
ServiceManager.h
Go to the documentation of this file.
1
// $Id: ServiceManager.h,v 1.9 2008/11/10 15:29:09 marcocle Exp $
2
#ifndef GAUDISVC_ServiceManager_H
3
#define GAUDISVC_ServiceManager_H
4
5
// Include files
6
#include "
GaudiKernel/Kernel.h
"
7
#include "
GaudiKernel/ISvcManager.h
"
8
#include "
GaudiKernel/ISvcLocator.h
"
9
#include "
GaudiKernel/IStateful.h
"
10
#include "
GaudiKernel/SmartIF.h
"
11
#include "
GaudiKernel/ComponentManager.h
"
12
#include "
GaudiKernel/Map.h
"
13
#include <
string
>
14
#include <
list
>
15
#include <
map
>
16
#include <
algorithm
>
17
#include "boost/thread.hpp"
18
19
// Forward declarations
20
class
IService
;
21
class
ISvcFactory;
22
class
IMessageSvc
;
23
class
Property
;
24
37
class
ServiceManager
:
public
extends2
<ComponentManager, ISvcManager, ISvcLocator>{
38
public
:
39
40
struct
ServiceItem
{
41
ServiceItem
(
IService
*
s
,
long
p = 0,
bool
act =
false
):
42
service
(s),
priority
(p),
active
(act) {}
43
SmartIF<IService>
service
;
44
long
priority
;
45
bool
active
;
46
inline
bool
operator==
(
const
std::string
&
name
)
const
{
47
return
service
->name() ==
name
;
48
}
49
inline
bool
operator==
(
const
IService
*ptr)
const
{
50
return
service
.
get
() == ptr;
51
}
52
inline
bool
operator<
(
const
ServiceItem
& rhs)
const
{
53
return
priority
< rhs.
priority
;
54
}
55
};
56
57
// typedefs and classes
58
typedef
std::list<ServiceItem>
ListSvc
;
59
typedef
GaudiUtils::Map<std::string, std::string>
MapType
;
60
62
ServiceManager
(
IInterface
* application);
63
65
inline
SmartIF<ISvcLocator>
&
serviceLocator
()
const
{
66
return
m_svcLocator
;
67
}
68
70
virtual
~ServiceManager
();
71
73
virtual
const
std::list<IService*>
&
getServices
()
const
;
74
76
virtual
bool
existsService
(
const
std::string
&
name
)
const
;
77
79
virtual
StatusCode
addService
(
IService
* svc,
int
prio = DEFAULT_SVC_PRIORITY);
81
virtual
StatusCode
addService
(
const
Gaudi::Utils::TypeNameString&
typeName
,
int
prio = DEFAULT_SVC_PRIORITY);
83
virtual
StatusCode
removeService
(
IService
* svc);
85
virtual
StatusCode
removeService
(
const
std::string
&
name
);
86
88
virtual
StatusCode
declareSvcType
(
const
std::string
& svcname,
const
std::string
& svctype);
89
91
virtual
SmartIF<IService>
&
createService
(
const
Gaudi::Utils::TypeNameString& nametype);
92
94
virtual
StatusCode
initialize
();
96
virtual
StatusCode
start
();
98
virtual
StatusCode
stop
();
100
virtual
StatusCode
finalize
();
101
103
virtual
StatusCode
reinitialize
();
105
virtual
StatusCode
restart
();
106
108
virtual
int
getPriority
(
const
std::string
&
name
)
const
;
109
virtual
StatusCode
setPriority
(
const
std::string
&
name
,
int
pri);
110
112
virtual
bool
loopCheckEnabled
()
const
;
114
virtual
void
setLoopCheckEnabled
(
bool
en);
115
117
const
std::string
&
name
()
const
{
118
static
std::string
_name =
"ServiceManager"
;
119
return
_name;
120
}
121
123
virtual
SmartIF<IService>
&
service
(
const
Gaudi::Utils::TypeNameString &
typeName
,
const
bool
createIf =
true
);
124
125
#if !defined(GAUDI_V22_API) || defined(G22_NEW_SVCLOCATOR)
126
using
ISvcManager::createService
;
127
using
ISvcManager::addService
;
128
#endif
129
130
private
:
131
132
inline
ListSvc::iterator
find
(
const
std::string
&
name
) {
133
return
std::find
(
m_listsvc
.
begin
(),
m_listsvc
.
end
(),
name
);
134
}
135
inline
ListSvc::const_iterator
find
(
const
std::string
&
name
)
const
{
136
return
std::find
(
m_listsvc
.
begin
(),
m_listsvc
.
end
(),
name
);
137
}
138
inline
ListSvc::iterator
find
(
const
IService
*ptr) {
139
return
std::find
(
m_listsvc
.
begin
(),
m_listsvc
.
end
(), ptr);
140
}
141
inline
ListSvc::const_iterator
find
(
const
IService
*ptr)
const
{
142
return
std::find
(
m_listsvc
.
begin
(),
m_listsvc
.
end
(), ptr);
143
}
144
145
private
:
146
ListSvc
m_listsvc
;
147
MapType
m_maptype
;
148
bool
m_loopCheck
;
149
151
SmartIF<IService>
m_appSvc
;
152
154
mutable
std::list<IService*>
m_listOfPtrs
;
155
156
GaudiUtils::Map<InterfaceID, SmartIF<IInterface>
>
m_defaultImplementations
;
157
159
boost::recursive_mutex
m_svcinitmutex
;
160
161
private
:
162
void
dump
()
const
;
163
164
};
165
#endif // GAUDISVC_ServiceManager_H
166
Generated at Wed Dec 4 2013 14:33:08 for Gaudi Framework, version v24r2 by
Doxygen
version 1.8.2 written by
Dimitri van Heesch
, © 1997-2004