#include <Service.h>
Inheritance diagram for Service:
Public Types | |
SUCCESS = 1 | |
Normal successful completion. | |
NO_INTERFACE | |
Requested interface is not available. | |
VERSMISMATCH | |
Requested interface version is incompatible. | |
LAST_ERROR | |
Last error. | |
enum | Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR } |
Return status. More... | |
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::string & | name () const |
Retrieve name of the service. | |
virtual const InterfaceID & | type () 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 Property & | getProperty (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. | |
ISvcLocator * | serviceLocator () const |
Retrieve pointer to service locator. | |
IMessageSvc * | msgSvc () |
Retrieve pointer to message service. | |
IMessageSvc * | msgSvc () const |
IMessageSvc * | messageService () |
IMessageSvc * | messageService () 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> | |
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. | |
IAuditorSvc * | auditorSvc () const |
The standard auditor service.May not be invoked before sysInitialize() has been invoked. | |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
Retrieve interface ID. | |
static const InterfaceID & | interfaceID () |
Retrieve interface ID. | |
static const InterfaceID & | interfaceID () |
Retrieve interface ID. | |
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. | |
IMessageSvc * | m_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. | |
ISvcLocator * | m_svcLocator |
Service Locator reference. | |
ISvcManager * | m_svcManager |
PropertyMgr * | m_propertyMgr |
Property Manager. | |
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 30 of file Service.h.
enum IInterface::Status [inherited] |
Return status.
SUCCESS | Normal successful completion. |
NO_INTERFACE | Requested interface is not available. |
VERSMISMATCH | Requested interface version is incompatible. |
LAST_ERROR | Last error. |
Reimplemented in IConversionSvc, IConverter, and IDataProviderSvc.
Definition at line 113 of file IInterface.h.
00113 { 00115 SUCCESS = 1, 00117 NO_INTERFACE, 00119 VERSMISMATCH, 00121 LAST_ERROR 00122 };
Service::Service | ( | const std::string & | name, | |
ISvcLocator * | svcloc | |||
) |
Standard Constructor.
virtual Service::~Service | ( | ) | [protected, virtual] |
Standard Destructor.
virtual StatusCode Service::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvUnknown | |||
) | [virtual] |
Query interfaces of Interface.
riid | ID of Interface to be retrieved | |
ppvUnknown | Pointer to Location for interface pointer |
Implements IInterface.
Reimplemented in ConversionSvc, DataSvc, and MinimalEventLoopMgr.
virtual unsigned long Service::addRef | ( | ) | [virtual] |
virtual unsigned long Service::release | ( | ) | [virtual] |
virtual const std::string& Service::name | ( | ) | const [virtual] |
virtual const InterfaceID& Service::type | ( | ) | const [virtual] |
virtual StatusCode Service::configure | ( | ) | [inline, virtual] |
Configuration (from OFFLINE to CONFIGURED).
Implements IService.
Definition at line 53 of file Service.h.
00053 { return StatusCode::SUCCESS; }
virtual StatusCode Service::initialize | ( | ) | [virtual] |
Initialization (from CONFIGURED to INITIALIZED).
Implements IService.
Reimplemented in ConversionSvc, DataSvc, and MinimalEventLoopMgr.
virtual StatusCode Service::start | ( | ) | [virtual] |
virtual StatusCode Service::stop | ( | ) | [virtual] |
virtual StatusCode Service::finalize | ( | ) | [virtual] |
Finalize (from INITIALIZED to CONFIGURED).
Implements IService.
Reimplemented in ConversionSvc, DataSvc, and MinimalEventLoopMgr.
virtual StatusCode Service::terminate | ( | ) | [inline, virtual] |
Initialization (from CONFIGURED to OFFLINE).
Implements IService.
Definition at line 58 of file Service.h.
00058 { return StatusCode::SUCCESS; }
virtual Gaudi::StateMachine::State Service::FSMState | ( | ) | const [inline, virtual] |
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.
00060 { return m_targetState; }
virtual StatusCode Service::reinitialize | ( | ) | [virtual] |
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Implements IService.
Reimplemented in DataSvc, and MinimalEventLoopMgr.
virtual StatusCode Service::restart | ( | ) | [virtual] |
Initialization (from RUNNING to RUNNING, via INITIALIZED).
Implements IService.
Reimplemented in MinimalEventLoopMgr.
virtual StatusCode Service::sysInitialize | ( | ) | [virtual] |
virtual StatusCode Service::sysStart | ( | ) | [virtual] |
virtual StatusCode Service::sysStop | ( | ) | [virtual] |
virtual StatusCode Service::sysFinalize | ( | ) | [virtual] |
virtual StatusCode Service::sysReinitialize | ( | ) | [virtual] |
virtual StatusCode Service::sysRestart | ( | ) | [virtual] |
virtual StatusCode Service::setProperty | ( | const Property & | p | ) | [virtual] |
virtual StatusCode Service::setProperty | ( | const std::string & | s | ) | [virtual] |
virtual StatusCode Service::setProperty | ( | const std::string & | n, | |
const std::string & | v | |||
) | [virtual] |
virtual StatusCode Service::getProperty | ( | Property * | p | ) | const [virtual] |
virtual const Property& Service::getProperty | ( | const std::string & | name | ) | const [virtual] |
virtual StatusCode Service::getProperty | ( | const std::string & | n, | |
std::string & | v | |||
) | const [virtual] |
virtual const std::vector<Property*>& Service::getProperties | ( | ) | const [virtual] |
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 128 of file Service.h.
00130 { return Gaudi::Utils::setProperty ( m_propertyMgr , name , value ) ; }
ISvcLocator* Service::serviceLocator | ( | ) | const |
Retrieve pointer to service locator.
IMessageSvc* Service::msgSvc | ( | ) |
Retrieve pointer to message service.
IMessageSvc* Service::msgSvc | ( | ) | const |
IMessageSvc* Service::messageService | ( | ) |
IMessageSvc* Service::messageService | ( | ) | const |
StatusCode Service::setProperties | ( | ) |
Method for setting declared properties to the values specifed for the job.
StatusCode Service::service | ( | const std::string & | name, | |
T *& | psvc, | |||
bool | createIf = true | |||
) | const [inline] |
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 194 of file Service.h.
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.
name | Local property name | |
rsvc | Remote IProperty interface | |
rname | Name of the property at remote service |
Definition at line 210 of file Service.h.
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.
int Service::outputLevel | ( | ) | const [inline, protected] |
get the Service's
output level
Definition at line 235 of file Service.h.
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
StatusCode Service::service_i | ( | const std::string & | svcType, | |
const std::string & | svcName, | |||
const InterfaceID & | iid, | |||
void ** | ppSvc | |||
) | const [private] |
void Service::setServiceManager | ( | ISvcManager * | ) | [private, virtual] |
Implements IService.
void Service::initOutputLevel | ( | Property & | prop | ) | [private] |
callback for output level property
static const InterfaceID& IService::interfaceID | ( | ) | [inline, static, inherited] |
Retrieve interface ID.
Reimplemented from INamedInterface.
Reimplemented in IAuditorSvc, IChronoStatSvc, IHistorySvc, IIssueLogger, IMagneticFieldSvc, IParticlePropertySvc, IPartPropSvc, IRndmGenSvc, IStatusCodeSvc, and ITHistSvc.
Definition at line 26 of file IService.h.
00026 { return IID_IService; }
static const InterfaceID& IProperty::interfaceID | ( | ) | [inline, static, inherited] |
Retrieve interface ID.
Reimplemented from IInterface.
Definition at line 28 of file IProperty.h.
00028 { return IID_IProperty; }
static const InterfaceID& IStateful::interfaceID | ( | ) | [inline, static, inherited] |
Retrieve interface ID.
Reimplemented from IInterface.
Definition at line 23 of file IStateful.h.
00023 { return IID_IStateful; }
friend class ServiceManager [friend] |
IntegerProperty Service::m_outputLevel [protected] |
Gaudi::StateMachine::State Service::m_state [protected] |
Gaudi::StateMachine::State Service::m_targetState [protected] |
IMessageSvc* Service::m_messageSvc [mutable, protected] |
std::string Service::m_name [private] |
unsigned long Service::m_refCount [private] |
ISvcLocator* Service::m_svcLocator [private] |
ISvcManager* Service::m_svcManager [private] |
PropertyMgr* Service::m_propertyMgr [private] |
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] |