|
Gaudi Framework, version v21r9 |
| Home | Generated: 3 May 2010 |
#include <Service.h>


Public Member Functions | |
| virtual unsigned long | release () |
| Release Interface instance. | |
| virtual const std::string & | name () const |
| Retrieve name of the service. | |
| virtual StatusCode | configure () |
| virtual StatusCode | initialize () |
| virtual StatusCode | start () |
| virtual StatusCode | stop () |
| virtual StatusCode | finalize () |
| virtual StatusCode | terminate () |
| virtual Gaudi::StateMachine::State | FSMState () const |
| virtual Gaudi::StateMachine::State | targetFSMState () const |
| virtual StatusCode | reinitialize () |
| virtual StatusCode | restart () |
| virtual StatusCode | sysInitialize () |
| Initialize Service. | |
| virtual StatusCode | sysStart () |
| Initialize Service. | |
| virtual StatusCode | sysStop () |
| Initialize Service. | |
| virtual StatusCode | sysFinalize () |
| Finalize Service. | |
| virtual StatusCode | sysReinitialize () |
| Re-initialize the Service. | |
| virtual StatusCode | sysRestart () |
| Re-initialize the Service. | |
| virtual StatusCode | setProperty (const Property &p) |
| virtual StatusCode | setProperty (const std::string &s) |
| virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
| virtual StatusCode | getProperty (Property *p) const |
| virtual const Property & | getProperty (const std::string &name) const |
| virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
| virtual const std::vector < Property * > & | getProperties () const |
| template<class TYPE> | |
| StatusCode | setProperty (const std::string &name, const TYPE &value) |
| set the property form the value | |
| Service (const std::string &name, ISvcLocator *svcloc) | |
| Standard Constructor. | |
| SmartIF< ISvcLocator > & | serviceLocator () const |
| Retrieve pointer to service locator. | |
| StatusCode | setProperties () |
| Method for setting declared properties to the values specified for the job. | |
| template<class T> | |
| StatusCode | service (const std::string &name, 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> | |
| Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
| Declare the named property. | |
| Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
| Declare remote named properties. | |
| SmartIF< IAuditorSvc > & | auditorSvc () const |
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. | |
Protected Member Functions | |
| virtual | ~Service () |
| Standard Destructor. | |
| int | outputLevel () const |
get the Service's output level | |
Protected Attributes | |
| IntegerProperty | m_outputLevel |
| Service output level. | |
| Gaudi::StateMachine::State | m_state |
| Service state. | |
| Gaudi::StateMachine::State | m_targetState |
| Service state. | |
Private Member Functions | |
| void | setServiceManager (ISvcManager *ism) |
| void | initOutputLevel (Property &prop) |
| callback for output level property | |
Private Attributes | |
| std::string | m_name |
| Service Name. | |
| SmartIF< ISvcLocator > | m_svcLocator |
| Service Locator reference. | |
| SmartIF< ISvcManager > | m_svcManager |
| PropertyMgr * | m_propertyMgr |
| Property Manager. | |
| SmartIF< IAuditorSvc > | m_pAuditorSvc |
| Auditor Service. | |
| BooleanProperty | m_auditInit |
| bool | m_auditorInitialize |
| bool | m_auditorStart |
| bool | m_auditorStop |
| bool | m_auditorFinalize |
| bool | m_auditorReinitialize |
| bool | m_auditorRestart |
Friends | |
| class | ServiceManager |
It implements the IService and IProperty interfaces.
Definition at line 34 of file Service.h.
| Service::Service | ( | const std::string & | name, | |
| ISvcLocator * | svcloc | |||
| ) |
Standard Constructor.
Definition at line 389 of file Service.cpp.
00389 { 00390 m_name = name; 00391 m_svcLocator = svcloc; 00392 m_state = Gaudi::StateMachine::OFFLINE; 00393 m_targetState = Gaudi::StateMachine::OFFLINE; 00394 m_propertyMgr = new PropertyMgr(); 00395 m_outputLevel = MSG::NIL; 00396 // Declare common Service properties with their defaults 00397 if ( (name != "MessageSvc") && msgSvc().isValid() ) { 00398 // In genconf a service is instantiated without the ApplicationMgr 00399 m_outputLevel = msgSvc()->outputLevel(); 00400 } 00401 declareProperty( "OutputLevel", m_outputLevel); 00402 m_outputLevel.declareUpdateHandler(&Service::initOutputLevel, this); 00403 00404 // Get the default setting for service auditing from the AppMgr 00405 declareProperty( "AuditServices", m_auditInit=true ); 00406 00407 bool audit(false); 00408 SmartIF<IProperty> appMgr(serviceLocator()->service("ApplicationMgr")); 00409 if (appMgr.isValid()) { 00410 const Property& prop = appMgr->getProperty("AuditServices"); 00411 if (m_name != "IncidentSvc") { 00412 setProperty(prop).ignore(); 00413 audit = m_auditInit.value(); 00414 } else { 00415 audit = false; 00416 } 00417 } 00418 00419 declareProperty( "AuditInitialize" , m_auditorInitialize = audit ); 00420 declareProperty( "AuditStart" , m_auditorStart = audit ); 00421 declareProperty( "AuditStop" , m_auditorStop = audit ); 00422 declareProperty( "AuditFinalize" , m_auditorFinalize = audit ); 00423 declareProperty( "AuditReInitialize" , m_auditorReinitialize = audit ); 00424 declareProperty( "AuditReStart" , m_auditorRestart = audit ); 00425 }
| Service::~Service | ( | ) | [protected, virtual] |
Standard Destructor.
Definition at line 435 of file Service.cpp.
00435 { 00436 delete m_propertyMgr; 00437 }
| unsigned long Service::release | ( | ) | [virtual] |
Release Interface instance.
Specialized implementation because the default one is not enough.
Definition at line 21 of file Service.cpp.
00021 { 00022 // Avoid to decrement 0 00023 const unsigned long count = (m_refCount) ? --m_refCount : m_refCount; 00024 if( count == 0) { 00025 if (m_svcManager!=0) { 00026 m_svcManager->removeService(this).ignore(); 00027 } 00028 delete this; 00029 } 00030 return count; 00031 }
| const std::string & Service::name | ( | ) | const [virtual] |
Retrieve name of the service.
Implements CommonMessaging< implements3< IService, IProperty, IStateful > >.
Definition at line 327 of file Service.cpp.
00327 { 00328 return m_name; 00329 }
| virtual StatusCode Service::configure | ( | ) | [inline, virtual] |
| StatusCode Service::initialize | ( | ) | [virtual] |
Reimplemented in GslSvc, ConversionSvc, DataSvc, MinimalEventLoopMgr, DataListenerSvc, PoolDbCacheSvc, PoolDbCnvSvc, PoolDbEvtSelector, PythonScriptingSvc, AIDATupleSvc, AlgContextSvc, AppMgrRunable, EventLoopMgr, AuditorSvc, ChronoStatSvc, EvtDataSvc, MultiStoreSvc, RecordDataSvc, 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::Utils::StopSignalHandler, StalledEventMonitor, PartPropSvc, and RootHistCnv::PersSvc.
Definition at line 69 of file Service.cpp.
00069 { 00070 // Set the Algorithm's properties 00071 StatusCode sc = setProperties(); 00072 00073 debug() << "Service base class initialized successfully" << endmsg; 00074 m_state = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::CONFIGURE,m_state); 00075 return sc ; 00076 }
| StatusCode Service::start | ( | ) | [virtual] |
Reimplemented in MinimalEventLoopMgr, AppMgrRunable, ToolSvc, and StalledEventMonitor.
Definition at line 154 of file Service.cpp.
00154 { 00155 // stub implementation 00156 return StatusCode::SUCCESS; 00157 }
| StatusCode Service::stop | ( | ) | [virtual] |
Reimplemented in MinimalEventLoopMgr, AppMgrRunable, EventLoopMgr, ToolSvc, and StalledEventMonitor.
Definition at line 148 of file Service.cpp.
00148 { 00149 // stub implementation 00150 return StatusCode::SUCCESS; 00151 }
| StatusCode Service::finalize | ( | void | ) | [virtual] |
Reimplemented in GslSvc, ConversionSvc, DataSvc, MinimalEventLoopMgr, DataListenerSvc, PoolDbCacheSvc, PoolDbCnvSvc, PoolDbEvtSelector, PythonScriptingSvc, AIDATupleSvc, AlgContextSvc, AppMgrRunable, EventLoopMgr, AuditorSvc, ChronoStatSvc, CounterSvc, EvtDataSvc, MultiStoreSvc, RecordDataSvc, 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::Utils::StopSignalHandler, StalledEventMonitor, PartPropSvc, and RootHistCnv::PersSvc.
Definition at line 195 of file Service.cpp.
00195 { 00196 //MsgStream log(msgSvc(),name()); 00197 //m_state = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::TERMINATE,m_state); 00198 return StatusCode::SUCCESS; 00199 }
| virtual StatusCode Service::terminate | ( | ) | [inline, virtual] |
| virtual Gaudi::StateMachine::State Service::FSMState | ( | ) | const [inline, virtual] |
| virtual Gaudi::StateMachine::State Service::targetFSMState | ( | ) | const [inline, virtual] |
| StatusCode Service::reinitialize | ( | ) | [virtual] |
Reimplemented in DataSvc, MinimalEventLoopMgr, AIDATupleSvc, EventLoopMgr, EvtDataSvc, MultiStoreSvc, RecordDataSvc, DetDataSvc, EventSelector, FastContainersSvc, HistogramSvc, HistorySvc, DataOnDemandSvc, IssueLogger, MessageSvc, NTupleSvc, HistogramPersistencySvc, StatusCodeSvc, and THistSvc.
Definition at line 290 of file Service.cpp.
00290 { 00291 /* @TODO 00292 * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize 00293 * is causing too many problems 00294 * 00295 // Default implementation is finalize+initialize 00296 StatusCode sc = finalize(); 00297 if (sc.isFailure()) { 00298 error() << "reinitialize(): cannot be finalized" << endmsg; 00299 return sc; 00300 } 00301 sc = initialize(); 00302 if (sc.isFailure()) { 00303 error() << "reinitialize(): cannot be initialized" << endmsg; 00304 return sc; 00305 } 00306 */ 00307 return StatusCode::SUCCESS; 00308 }
| StatusCode Service::restart | ( | ) | [virtual] |
Reimplemented in MinimalEventLoopMgr.
Definition at line 311 of file Service.cpp.
00311 { 00312 // Default implementation is stop+start 00313 StatusCode sc = stop(); 00314 if (sc.isFailure()) { 00315 error() << "restart(): cannot be stopped" << endmsg; 00316 return sc; 00317 } 00318 sc = start(); 00319 if (sc.isFailure()) { 00320 error() << "restart(): cannot be started" << endmsg; 00321 return sc; 00322 } 00323 return StatusCode::SUCCESS; 00324 }
| StatusCode Service::sysInitialize | ( | ) | [virtual] |
Initialize Service.
Reimplemented in AuditorSvc.
Definition at line 34 of file Service.cpp.
00034 { 00035 StatusCode sc; 00036 00037 try { 00038 m_targetState = Gaudi::StateMachine::INITIALIZED; 00039 Gaudi::Guards::AuditorGuard guard(this, 00040 // check if we want to audit the initialize 00041 (m_auditorInitialize) ? auditorSvc().get() : 0, 00042 IAuditor::Initialize); 00043 sc = initialize(); // This should change the state to Gaudi::StateMachine::CONFIGURED 00044 if (sc.isSuccess()) 00045 m_state = m_targetState; 00046 return sc; 00047 } 00048 catch ( const GaudiException& Exception ) { 00049 fatal() << "in sysInitialize(): exception with tag=" << Exception.tag() 00050 << " is caught" << endmsg; 00051 error() << Exception << endmsg; 00052 // Stat stat( chronoSvc() , Exception.tag() ); 00053 } 00054 catch( const std::exception& Exception ) { 00055 fatal() << "in sysInitialize(): standard std::exception is caught" << endmsg; 00056 error() << Exception.what() << endmsg; 00057 // Stat stat( chronoSvc() , "*std::exception*" ); 00058 } 00059 catch(...) { 00060 fatal() << "in sysInitialize(): UNKNOWN Exception is caught" << endmsg; 00061 // Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00062 } 00063 00064 return StatusCode::FAILURE; 00065 }
| StatusCode Service::sysStart | ( | ) | [virtual] |
Initialize Service.
Definition at line 79 of file Service.cpp.
00079 { 00080 StatusCode sc; 00081 00082 try { 00083 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state); 00084 Gaudi::Guards::AuditorGuard guard(this, 00085 // check if we want to audit the initialize 00086 (m_auditorStart) ? auditorSvc().get() : 0, 00087 IAuditor::Start); 00088 sc = start(); 00089 if (sc.isSuccess()) 00090 m_state = m_targetState; 00091 return sc; 00092 } 00093 catch ( const GaudiException& Exception ) { 00094 fatal() << "in sysStart(): exception with tag=" << Exception.tag() 00095 << " is caught" << endmsg; 00096 error() << Exception << endmsg; 00097 // Stat stat( chronoSvc() , Exception.tag() ); 00098 } 00099 catch( const std::exception& Exception ) { 00100 fatal() << "in sysStart(): standard std::exception is caught" << endmsg; 00101 fatal() << Exception.what() << endmsg; 00102 // Stat stat( chronoSvc() , "*std::exception*" ); 00103 } 00104 catch(...) { 00105 fatal() << "in sysStart(): UNKNOWN Exception is caught" << endmsg; 00106 // Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00107 } 00108 00109 return StatusCode::FAILURE; 00110 }
| StatusCode Service::sysStop | ( | ) | [virtual] |
Initialize Service.
Definition at line 113 of file Service.cpp.
00113 { 00114 StatusCode sc; 00115 00116 try { 00117 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::STOP,m_state); 00118 Gaudi::Guards::AuditorGuard guard(this, 00119 // check if we want to audit the initialize 00120 (m_auditorStop) ? auditorSvc().get() : 0, 00121 IAuditor::Stop); 00122 sc = stop(); 00123 if (sc.isSuccess()) 00124 m_state = m_targetState; 00125 return sc; 00126 } 00127 catch ( const GaudiException& Exception ) { 00128 fatal() << "in sysStop(): exception with tag=" << Exception.tag() 00129 << " is caught" << endmsg; 00130 error() << Exception << endmsg; 00131 // Stat stat( chronoSvc() , Exception.tag() ); 00132 } 00133 catch( const std::exception& Exception ) { 00134 fatal() << "in sysStop(): standard std::exception is caught" << endmsg; 00135 error() << Exception.what() << endmsg; 00136 // Stat stat( chronoSvc() , "*std::exception*" ); 00137 } 00138 catch(...) { 00139 fatal() << "in sysStop(): UNKNOWN Exception is caught" << endmsg; 00140 // Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00141 } 00142 00143 return StatusCode::FAILURE; 00144 }
| StatusCode Service::sysFinalize | ( | ) | [virtual] |
Finalize Service.
Reimplemented in AuditorSvc.
Definition at line 160 of file Service.cpp.
00160 { 00161 00162 StatusCode sc(StatusCode::FAILURE); 00163 00164 try { 00165 m_targetState = Gaudi::StateMachine::OFFLINE; 00166 Gaudi::Guards::AuditorGuard guard(this, 00167 // check if we want to audit the initialize 00168 (m_auditorFinalize) ? auditorSvc().get() : 0, 00169 IAuditor::Finalize); 00170 sc = finalize(); 00171 if (sc.isSuccess()) 00172 m_state = m_targetState; 00173 } 00174 catch( const GaudiException& Exception ) { 00175 fatal() << " Exception with tag=" << Exception.tag() 00176 << " is caught " << endmsg; 00177 error() << Exception << endmsg; 00178 // Stat stat( chronoSvc() , Exception.tag() ) ; 00179 } 00180 catch( const std::exception& Exception ) { 00181 fatal() << " Standard std::exception is caught " << endmsg; 00182 error() << Exception.what() << endmsg; 00183 // Stat stat( chronoSvc() , "*std::exception*" ) ; 00184 } 00185 catch( ... ) { 00186 fatal() << "UNKNOWN Exception is caught " << endmsg; 00187 // Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00188 } 00189 00190 m_pAuditorSvc = 0; 00191 return sc; 00192 }
| StatusCode Service::sysReinitialize | ( | ) | [virtual] |
Re-initialize the Service.
Definition at line 202 of file Service.cpp.
00202 { 00203 00204 StatusCode sc; 00205 00206 // Check that the current status is the correct one. 00207 if ( Gaudi::StateMachine::INITIALIZED != FSMState() ) { 00208 MsgStream log ( msgSvc() , name() ); 00209 error() 00210 << "sysReinitialize(): cannot reinitialize service not initialized" 00211 << endmsg; 00212 return StatusCode::FAILURE; 00213 } 00214 00215 try { 00216 00217 Gaudi::Guards::AuditorGuard guard(this, 00218 // check if we want to audit the initialize 00219 (m_auditorReinitialize) ? auditorSvc().get() : 0, 00220 IAuditor::ReInitialize); 00221 sc = reinitialize(); 00222 return sc; 00223 } 00224 catch( const GaudiException& Exception ) { 00225 MsgStream log ( msgSvc() , name() + ".sysReinitialize()" ); 00226 fatal() << " Exception with tag=" << Exception.tag() 00227 << " is caught " << endmsg; 00228 error() << Exception << endmsg; 00229 // Stat stat( chronoSvc() , Exception.tag() ) ; 00230 } 00231 catch( const std::exception& Exception ) { 00232 MsgStream log ( msgSvc() , name() + ".sysReinitialize()" ); 00233 fatal() << " Standard std::exception is caught " << endmsg; 00234 error() << Exception.what() << endmsg; 00235 // Stat stat( chronoSvc() , "*std::exception*" ) ; 00236 } 00237 catch( ... ) { 00238 MsgStream log ( msgSvc() , name() + ".sysReinitialize()" ); 00239 fatal() << "UNKNOWN Exception is caught " << endmsg; 00240 // Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00241 } 00242 return StatusCode::FAILURE ; 00243 00244 }
| StatusCode Service::sysRestart | ( | ) | [virtual] |
Re-initialize the Service.
Definition at line 247 of file Service.cpp.
00247 { 00248 00249 StatusCode sc; 00250 00251 // Check that the current status is the correct one. 00252 if ( Gaudi::StateMachine::RUNNING != FSMState() ) { 00253 MsgStream log ( msgSvc() , name() ); 00254 error() 00255 << "sysRestart(): cannot restart service in state " << FSMState() 00256 << " -- must be RUNNING " 00257 << endmsg; 00258 return StatusCode::FAILURE; 00259 } 00260 00261 try { 00262 00263 Gaudi::Guards::AuditorGuard guard(this, 00264 // check if we want to audit the initialize 00265 (m_auditorRestart) ? auditorSvc().get() : 0, 00266 IAuditor::ReStart); 00267 sc = restart(); 00268 return sc; 00269 } 00270 catch( const GaudiException& Exception ) { 00271 fatal() << " Exception with tag=" << Exception.tag() 00272 << " is caught " << endmsg; 00273 error() << Exception << endmsg; 00274 // Stat stat( chronoSvc() , Exception.tag() ) ; 00275 } 00276 catch( const std::exception& Exception ) { 00277 fatal() << " Standard std::exception is caught " << endmsg; 00278 error() << Exception.what() << endmsg; 00279 // Stat stat( chronoSvc() , "*std::exception*" ) ; 00280 } 00281 catch( ... ) { 00282 fatal() << "UNKNOWN Exception is caught " << endmsg; 00283 // Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ; 00284 } 00285 return StatusCode::FAILURE ; 00286 00287 }
| StatusCode Service::setProperty | ( | const Property & | p | ) | [virtual] |
Reimplemented in JobOptionsSvc.
Definition at line 338 of file Service.cpp.
00338 { 00339 return m_propertyMgr->setProperty(p); 00340 }
| StatusCode Service::setProperty | ( | const std::string & | s | ) | [virtual] |
Definition at line 342 of file Service.cpp.
00342 { 00343 return m_propertyMgr->setProperty(s); 00344 }
| StatusCode Service::setProperty | ( | const std::string & | n, | |
| const std::string & | v | |||
| ) | [virtual] |
Definition at line 346 of file Service.cpp.
00346 { 00347 return m_propertyMgr->setProperty(n,v); 00348 }
| StatusCode Service::getProperty | ( | Property * | p | ) | const [virtual] |
Reimplemented in JobOptionsSvc.
Definition at line 350 of file Service.cpp.
00350 { 00351 return m_propertyMgr->getProperty(p); 00352 }
| const Property & Service::getProperty | ( | const std::string & | name | ) | const [virtual] |
Definition at line 354 of file Service.cpp.
00354 { 00355 return m_propertyMgr->getProperty(n); 00356 }
| StatusCode Service::getProperty | ( | const std::string & | n, | |
| std::string & | v | |||
| ) | const [virtual] |
Definition at line 358 of file Service.cpp.
00358 { 00359 return m_propertyMgr->getProperty(n,v); 00360 }
| const std::vector< Property * > & Service::getProperties | ( | ) | const [virtual] |
Definition at line 362 of file Service.cpp.
00362 { 00363 return m_propertyMgr->getProperties(); 00364 }
| 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..
| name | name of the property | |
| value | value of the property |
Definition at line 121 of file Service.h.
00123 { return Gaudi::Utils::setProperty ( m_propertyMgr , name , value ) ; }
| SmartIF< ISvcLocator > & Service::serviceLocator | ( | ) | const [virtual] |
Retrieve pointer to service locator.
Implements CommonMessaging< implements3< IService, IProperty, IStateful > >.
Definition at line 332 of file Service.cpp.
00332 { 00333 return m_svcLocator; 00334 }
| StatusCode Service::setProperties | ( | ) |
Method for setting declared properties to the values specified for the job.
Definition at line 367 of file Service.cpp.
00367 { 00368 const bool CREATEIF(true); 00369 SmartIF<IJobOptionsSvc> jos(serviceLocator()->service("JobOptionsSvc", CREATEIF)); 00370 if( !jos.isValid() ) { 00371 throw GaudiException("Service [JobOptionsSvc] not found", name(), StatusCode::FAILURE); 00372 } 00373 // set first generic Properties 00374 StatusCode sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this ); 00375 if( sc.isFailure() ) return sc; 00376 00377 // set specific Properties 00378 if (isGaudiThreaded(name())) { 00379 if (jos->setMyProperties( name(), this ).isFailure()) { 00380 return StatusCode::FAILURE; 00381 } 00382 } 00383 return StatusCode::SUCCESS; 00384 }
| 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 138 of file Service.h.
00138 { 00139 ISvcLocator& svcLoc = *serviceLocator(); 00140 SmartIF<T> ptr( 00141 ServiceLocatorHelper(svcLoc, *this).service(name, !createIf, // quiet 00142 createIf)); 00143 if (ptr.isValid()) { 00144 psvc = ptr.get(); 00145 psvc->addRef(); 00146 return StatusCode::SUCCESS; 00147 } 00148 // else 00149 psvc = 0; 00150 return StatusCode::FAILURE; 00151 }
| StatusCode Service::service | ( | const std::string & | svcType, | |
| const std::string & | svcName, | |||
| T *& | psvc | |||
| ) | const [inline] |
| 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 ) ; }
| name | the property name | |
| proeprty | the property itself, | |
| doc | the documentation string |
Definition at line 191 of file Service.h.
00194 { 00195 return m_propertyMgr -> declareProperty ( name , property , doc ) ; 00196 }
| 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.
| name | Local property name | |
| rsvc | Remote IProperty interface | |
| rname | Name of the property at remote service |
Definition at line 207 of file Service.h.
00210 { 00211 return m_propertyMgr -> declareRemoteProperty ( name , rsvc , rname ) ; 00212 }
| SmartIF< IAuditorSvc > & Service::auditorSvc | ( | ) | const |
The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Definition at line 439 of file Service.cpp.
00439 { 00440 if ( !m_pAuditorSvc.isValid() ) { 00441 m_pAuditorSvc = serviceLocator()->service("AuditorSvc"); 00442 if( !m_pAuditorSvc.isValid() ) { 00443 throw GaudiException("Service [AuditorSvc] not found", name(), StatusCode::FAILURE); 00444 } 00445 } 00446 return m_pAuditorSvc; 00447 }
| int Service::outputLevel | ( | ) | const [inline, protected] |
get the Service's output level
Reimplemented in MessageSvc.
Definition at line 230 of file Service.h.
00230 { return m_outputLevel.value(); }
| void Service::setServiceManager | ( | ISvcManager * | ism | ) | [private] |
| void Service::initOutputLevel | ( | Property & | prop | ) | [private] |
callback for output level property
Definition at line 428 of file Service.cpp.
00428 { 00429 if ( (name() != "MessageSvc") && msgSvc().isValid() ) { 00430 msgSvc()->setOutputLevel( name(), m_outputLevel ); 00431 } 00432 }
friend class ServiceManager [friend] |
IntegerProperty Service::m_outputLevel [protected] |
Gaudi::StateMachine::State Service::m_state [protected] |
Gaudi::StateMachine::State Service::m_targetState [protected] |
std::string Service::m_name [private] |
SmartIF<ISvcLocator> Service::m_svcLocator [mutable, private] |
SmartIF<ISvcManager> Service::m_svcManager [private] |
PropertyMgr* Service::m_propertyMgr [private] |
SmartIF<IAuditorSvc> Service::m_pAuditorSvc [mutable, private] |
BooleanProperty Service::m_auditInit [private] |
bool Service::m_auditorInitialize [private] |
bool Service::m_auditorStart [private] |
bool Service::m_auditorStop [private] |
bool Service::m_auditorFinalize [private] |
bool Service::m_auditorReinitialize [private] |
bool Service::m_auditorRestart [private] |