All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AlgTool Class Reference

Base class from which all the concrete tool classes should be derived. More...

#include <GaudiKernel/AlgTool.h>

Inheritance diagram for AlgTool:
Collaboration diagram for AlgTool:

Classes

class  declareInterface
 

Public Types

typedef
Gaudi::PluginService::Factory
< IAlgTool *, const
std::string &, const
std::string &, const
IInterface * > 
Factory
 
- Public Types inherited from implements3< IAlgTool, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IAlgTool, IProperty,
IStateful
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IAlgTool, IProperty, IStateful >
typedef mpl::fold< typename
IAlgTool::iid::iids::type,
typename mpl::fold< typename
IProperty::iid::iids::type,
typename
IStateful::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 

Public Member Functions

virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 Query for a given interface. More...
 
virtual const std::string & name () const
 Retrieve full identifying name of the concrete tool object. More...
 
virtual const std::string & type () const
 Retrieve type (concrete class) of the sub-algtool. More...
 
virtual const IInterfaceparent () const
 Retrieve parent of the sub-algtool. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode initialize ()
 Initialization (from CONFIGURED to INITIALIZED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode finalize ()
 Finalize (from INITIALIZED to CONFIGURED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode sysInitialize ()
 Initialize AlgTool. More...
 
virtual StatusCode sysStart ()
 Start AlgTool. More...
 
virtual StatusCode sysStop ()
 Stop AlgTool. More...
 
virtual StatusCode sysFinalize ()
 Finalize AlgTool. More...
 
virtual StatusCode sysReinitialize ()
 Initialize AlgTool. More...
 
virtual StatusCode sysRestart ()
 Start AlgTool. More...
 
virtual StatusCode setProperty (const Property &p)
 Default implementations for IProperty interface. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector
< Property * > & 
getProperties () const
 Get list of properties. More...
 
PropertyMgrgetPropertyMgr ()
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 AlgTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Constructor. More...
 
ISvcLocatorserviceLocator () const
 Retrieve pointer to service locator. More...
 
ISvcLocatorsvcLoc () const
 shortcut for the method service locator More...
 
IMessageSvcmsgSvc () const
 Retrieve pointer to message service. More...
 
IToolSvctoolSvc () const
 The standard ToolSvc service, Return a pointer to the service if present. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified in the jobOptions via the job option service. More...
 
template<class T >
StatusCode service (const std::string &name, T *&svc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &type, const std::string &name, T *&svc) const
 Access a service by name, type creating it if it doesn't already exist. More...
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true, const bool quiet=false) const
 Return a pointer to the service identified by name (or "type/name") More...
 
void declInterface (const InterfaceID &, void *)
 declare interface More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
IAuditorSvcauditorSvc () const
 Access the auditor service. More...
 
IMonitorSvcmonitorSvc () const
 Access the monitor service. More...
 
template<class T >
void declareInfo (const std::string &name, const T &var, const std::string &desc) const
 Declare monitoring information. More...
 
void declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const
 Declare monitoring information (special case) More...
 
- Public Member Functions inherited from extend_interfaces3< IAlgTool, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IAlgTool
 DeclareInterfaceID (IAlgTool, 3, 0)
 InterfaceID. More...
 
virtual ~IAlgTool ()
 Virtual destructor. More...
 
virtual unsigned long refCount () const =0
 Current number of reference counts. More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 

Protected Member Functions

int outputLevel () const
 get tool's output level More...
 
IntegerPropertyoutputLevelProperty ()
 Accessor for the Message level property. More...
 
void initOutputLevel (Property &prop)
 callback for output level property More...
 
virtual ~AlgTool ()
 

Private Types

typedef std::list< std::pair
< InterfaceID, void * > > 
InterfaceList
 

Private Member Functions

StatusCode service_i (const std::string &algName, bool createIf, const InterfaceID &iid, void **ppSvc) const
 implementation of service method More...
 
StatusCode service_i (const std::string &svcType, const std::string &svcName, const InterfaceID &iid, void **ppS) const
 

Private Attributes

IntegerProperty m_outputLevel
 AlgTool output level. More...
 
std::string m_type
 AlgTool type (concrete class name) More...
 
const std::string m_name
 AlgTool full name. More...
 
const IInterfacem_parent
 AlgTool parent. More...
 
ISvcLocatorm_svcLocator
 Pointer to Service Locator service. More...
 
IMessageSvcm_messageSvc
 Message service. More...
 
IToolSvcm_ptoolSvc
 Tool service. More...
 
IMonitorSvcm_pMonitorSvc
 Online Monitoring Service. More...
 
std::string m_monitorSvcName
 Name to use for Monitor Service. More...
 
PropertyMgrm_propertyMgr
 Property Manager. More...
 
InterfaceList m_interfaceList
 Interface list. More...
 
std::string m_threadID
 Thread Id for Alg Tool. More...
 
IAuditorSvcm_pAuditorSvc
 Auditor Service. More...
 
BooleanProperty m_auditInit
 
bool m_auditorInitialize
 flag for auditors in "initialize()" More...
 
bool m_auditorStart
 flag for auditors in "start()" More...
 
bool m_auditorStop
 flag for auditors in "stop()" More...
 
bool m_auditorFinalize
 flag for auditors in "finalize()" More...
 
bool m_auditorReinitialize
 flag for auditors in "reinitialize()" More...
 
bool m_auditorRestart
 flag for auditors in "restart()" More...
 
Gaudi::StateMachine::State m_state
 state of the Tool More...
 
Gaudi::StateMachine::State m_targetState
 state of the Tool More...
 

Friends

class ToolSvc
 

Additional Inherited Members

- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 

Detailed Description

Base class from which all the concrete tool classes should be derived.

Specific methods for doing something useful should be implemented in the concrete tools. Sub-types of this class could implement an additional interface for behavior common to sets of concrete tools (for example vertexers).

Author
Gloria Corti
Pere Mato

Definition at line 34 of file AlgTool.h.

Member Typedef Documentation

typedef Gaudi::PluginService::Factory<IAlgTool*, const std::string&, const std::string&, const IInterface*> AlgTool::Factory

Definition at line 41 of file AlgTool.h.

typedef std::list<std::pair<InterfaceID,void*> > AlgTool::InterfaceList
private

Definition at line 321 of file AlgTool.h.

Constructor & Destructor Documentation

AlgTool::AlgTool ( const std::string &  type,
const std::string &  name,
const IInterface parent 
)

Standard Constructor.

Parameters
typethe concrete class of the sub-algtool
namethe full name of the concrete sub-algtool
parentthe parent of the concrete sub-algtool

Definition at line 179 of file AlgTool.cpp.

183  : m_outputLevel ( MSG::NIL )
184  , m_type ( type )
185  , m_name ( name )
186  , m_parent ( parent )
187  , m_svcLocator ( 0 )
188  , m_messageSvc ( 0 )
189  , m_ptoolSvc ( 0 )
190  , m_pMonitorSvc ( NULL )
191  , m_propertyMgr ( new PropertyMgr() )
192  , m_interfaceList ( )
193  , m_threadID ( )
194  , m_pAuditorSvc ( 0 )
195  , m_auditInit ( false )
196  , m_auditorInitialize(false)
197  , m_auditorStart(false)
198  , m_auditorStop(false)
199  , m_auditorFinalize(false)
200  , m_auditorReinitialize(false)
201  , m_auditorRestart(false)
204 {
205  addRef(); // Initial count set to 1
206 
207  declareProperty( "MonitorService", m_monitorSvcName = "MonitorSvc" );
208 
209  { // get the "OutputLevel" property from parent
210  const Property* _p = Gaudi::Utils::getProperty ( parent , "OutputLevel") ;
211  if ( 0 != _p ) { m_outputLevel.assign( *_p ) ; }
212  declareProperty ( "OutputLevel" , m_outputLevel ) ;
214  }
215 
216  IInterface* _p = const_cast<IInterface*> ( parent ) ;
217 
218  if ( Algorithm* _alg = dynamic_cast<Algorithm*> ( _p ) )
219  {
220  m_svcLocator = _alg -> serviceLocator () ;
221  m_messageSvc = _alg -> msgSvc () ;
222  m_threadID = getGaudiThreadIDfromName ( _alg -> name() ) ;
223  }
224  else if ( Service* _svc = dynamic_cast<Service*> ( _p ) )
225  {
226  m_svcLocator = _svc -> serviceLocator () ;
227  m_messageSvc = _svc -> msgSvc () ;
228  m_threadID = getGaudiThreadIDfromName ( _svc -> name() ) ;
229  }
230  else if ( AlgTool* _too = dynamic_cast<AlgTool*> ( _p ) )
231  {
232  m_svcLocator = _too -> m_svcLocator;
233  m_messageSvc = _too -> m_messageSvc;
235  }
236  else if ( Auditor* _aud = dynamic_cast<Auditor*> ( _p ) )
237  {
238  m_svcLocator = _aud -> serviceLocator() ;
239  m_messageSvc = _aud -> msgSvc() ;
240  m_threadID = getGaudiThreadIDfromName ( _aud -> name() ) ;
241  }
242  else
243  {
244  throw GaudiException
245  ( "Failure to create tool '"
246  + type + "/" + name + "': illegal parent type '"
247  + System::typeinfoName(typeid(*_p)) + "'", "AlgTool", 0 );
248  }
249 
250 
251  { // audit tools
252  SmartIF<IProperty> appMgr(m_svcLocator->service("ApplicationMgr"));
253  if ( !appMgr.isValid() ) {
254  throw GaudiException("Could not locate ApplicationMgr","AlgTool",0);
255  }
256  const Property* p = Gaudi::Utils::getProperty( appMgr , "AuditTools");
257  if ( 0 != p ) { m_auditInit.assign ( *p ) ; }
258  declareProperty ( "AuditTools", m_auditInit );
259  bool audit = m_auditInit.value();
260  // Declare common AlgTool properties with their defaults
261  declareProperty ( "AuditInitialize" , m_auditorInitialize = audit ) ;
262  declareProperty ( "AuditStart" , m_auditorStart = audit ) ;
263  declareProperty ( "AuditStop" , m_auditorStop = audit ) ;
264  declareProperty ( "AuditFinalize" , m_auditorFinalize = audit ) ;
265  }
266 
267  // check thread ID and try if tool name indicates thread ID
268  if ( m_threadID.empty() )
270 }
void initOutputLevel(Property &prop)
callback for output level property
Definition: AlgTool.cpp:617
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
Define general base for Gaudi exception.
std::string m_type
AlgTool type (concrete class name)
Definition: AlgTool.h:323
virtual const std::string & type() const
Retrieve type (concrete class) of the sub-algtool.
Definition: AlgTool.cpp:58
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
IMessageSvc * m_messageSvc
Message service.
Definition: AlgTool.h:327
const IInterface * m_parent
AlgTool parent.
Definition: AlgTool.h:325
ISvcLocator * m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:326
IntegerProperty m_outputLevel
AlgTool output level.
Definition: AlgTool.h:322
GAUDI_API Property * getProperty(const IProperty *p, const std::string &name)
simple function which gets the property with given name from the component
Definition: Property.cpp:349
Property manager helper class.
Definition: PropertyMgr.h:38
ISvcLocator * serviceLocator() const
Retrieve pointer to service locator.
Definition: AlgTool.cpp:72
std::string m_monitorSvcName
Name to use for Monitor Service.
Definition: AlgTool.h:330
const std::string m_name
AlgTool full name.
Definition: AlgTool.h:324
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
Definition: Property.cpp:141
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:82
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: AlgTool.h:234
Definition of the basic interface.
Definition: IInterface.h:160
std::string m_threadID
Thread Id for Alg Tool.
Definition: AlgTool.h:333
IToolSvc * m_ptoolSvc
Tool service.
Definition: AlgTool.h:328
const TYPE & value() const
explicit conversion
Definition: Property.h:355
bool m_auditorFinalize
flag for auditors in "finalize()"
Definition: AlgTool.h:351
virtual bool assign(const Property &source)
get the value from another property
Definition: Property.h:283
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:61
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:355
IAuditorSvc * m_pAuditorSvc
Auditor Service.
Definition: AlgTool.h:345
bool m_auditorReinitialize
flag for auditors in "reinitialize()"
Definition: AlgTool.h:352
IMonitorSvc * m_pMonitorSvc
Online Monitoring Service.
Definition: AlgTool.h:329
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:34
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
bool m_auditorRestart
flag for auditors in "restart()"
Definition: AlgTool.h:353
tuple appMgr
Definition: IOTest.py:83
virtual const IInterface * parent() const
Retrieve parent of the sub-algtool.
Definition: AlgTool.cpp:65
InterfaceList m_interfaceList
Interface list.
Definition: AlgTool.h:332
BooleanProperty m_auditInit
Definition: AlgTool.h:347
bool m_auditorStart
flag for auditors in "start()"
Definition: AlgTool.h:349
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:356
Base class for all services.
Definition: Service.h:33
bool m_auditorStop
flag for auditors in "stop()"
Definition: AlgTool.h:350
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
GAUDI_API std::string getGaudiThreadIDfromName(const std::string &name)
helper function to extract Gaudi Thread ID from thread copy name
Definition: ThreadGaudi.cpp:28
bool m_auditorInitialize
flag for auditors in "initialize()"
Definition: AlgTool.h:348
Base class from which all concrete auditor classes should be derived.
Definition: Auditor.h:34
AlgTool::~AlgTool ( )
protectedvirtual

Definition at line 568 of file AlgTool.cpp.

570 {
571  delete m_propertyMgr;
572  if( m_ptoolSvc ) m_ptoolSvc->release();
575 }
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
IToolSvc * m_ptoolSvc
Tool service.
Definition: AlgTool.h:328
virtual unsigned long release()=0
Release Interface instance.
IAuditorSvc * m_pAuditorSvc
Auditor Service.
Definition: AlgTool.h:345
IMonitorSvc * m_pMonitorSvc
Online Monitoring Service.
Definition: AlgTool.h:329
virtual void undeclareAll(const IInterface *owner)=0
Undeclare monitoring information.

Member Function Documentation

IAuditorSvc * AlgTool::auditorSvc ( ) const

Access the auditor service.

Definition at line 604 of file AlgTool.cpp.

604  {
605 //---------------------------------------------------------------------------
606  if ( 0 == m_pAuditorSvc ) {
607  StatusCode sc = service( "AuditorSvc", m_pAuditorSvc, true );
608  if( sc.isFailure() ) {
609  throw GaudiException("Service [AuditorSvc] not found", name(), sc);
610  }
611  }
612  return m_pAuditorSvc;
613 }
Define general base for Gaudi exception.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode service(const std::string &name, T *&svc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: AlgTool.h:179
IAuditorSvc * m_pAuditorSvc
Auditor Service.
Definition: AlgTool.h:345
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
virtual StatusCode AlgTool::configure ( )
inlinevirtual

Configuration (from OFFLINE to CONFIGURED).

Implements IAlgTool.

Definition at line 57 of file AlgTool.h.

template<class T >
void AlgTool::declareInfo ( const std::string &  name,
const T &  var,
const std::string &  desc 
) const
inline

Declare monitoring information.

Parameters
nameMonitoring information name known to the external system
varMonitoring Listener address (the item to monitor...)
descTextual description of the information being monitored

Definition at line 277 of file AlgTool.h.

280  {
281  IMonitorSvc* mS = monitorSvc();
282  if ( mS ) mS->declareInfo(name, var, desc, this);
283  }
IMonitorSvc * monitorSvc() const
Access the monitor service.
Definition: AlgTool.h:261
Definition of the IMonitorSvc interface, which publishes Gaudi variables to outside monitoring proces...
Definition: IMonitorSvc.h:21
virtual void declareInfo(const std::string &name, const bool &var, const std::string &desc, const IInterface *owner)=0
Declare monitoring information.
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
void AlgTool::declareInfo ( const std::string &  name,
const std::string &  format,
const void *  var,
int  size,
const std::string &  desc 
) const
inline

Declare monitoring information (special case)

Parameters
nameMonitoring information name known to the external system
formatFormat information
varMonitoring Listener address
sizeMonitoring Listener address size
descTextual description of the information being monitored

Definition at line 292 of file AlgTool.h.

297  {
298  IMonitorSvc* mS = monitorSvc();
299  if ( mS ) mS->declareInfo(name, format, var, size, desc, this);
300  }
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:133
IMonitorSvc * monitorSvc() const
Access the monitor service.
Definition: AlgTool.h:261
Definition of the IMonitorSvc interface, which publishes Gaudi variables to outside monitoring proces...
Definition: IMonitorSvc.h:21
virtual void declareInfo(const std::string &name, const bool &var, const std::string &desc, const IInterface *owner)=0
Declare monitoring information.
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
template<class T >
Property* AlgTool::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
) const
inline

Declare the named property.

MyTool ( const std::string& type ,
const std::string& name ,
const IInterface* parent )
: AlgTool ( type , name , pSvc )
, m_property1 ( ... )
, m_property2 ( ... )
{
// declare the property
declareProperty( "Property1" , m_property1 , "Doc for property #1" ) ;
// declare the property and attach the handler to it
declareProperty( "Property2" , m_property2 , "Doc for property #2" )
-> declareUpdateHandler( &MyTool::handler_2 ) ;
}
See also
PropertyMgr
PropertyMgr::declareProperty
Parameters
namethe property name
propertythe property itself,
docthe documentation string
Returns
the actual property objects

Definition at line 234 of file AlgTool.h.

237  {
238  return m_propertyMgr -> declareProperty ( name , property , doc ) ;
239  }
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: AlgTool.h:234
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
Property* AlgTool::declareRemoteProperty ( const std::string &  name,
IProperty rsvc,
const std::string &  rname = "" 
) const
inline

Declare remote named properties.

Definition at line 242 of file AlgTool.h.

245  {
246  return m_propertyMgr-> declareRemoteProperty ( name , rsvc , rname ) ;
247  }
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
Property * declareRemoteProperty(const std::string &name, IProperty *rsvc, const std::string &rname="") const
Declare remote named properties.
Definition: AlgTool.h:242
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
void AlgTool::declInterface ( const InterfaceID iid,
void *  ii 
)

declare interface

Definition at line 43 of file AlgTool.cpp.

45 {
46  m_interfaceList.push_back(std::make_pair(iid, ii));
47 }
InterfaceList m_interfaceList
Interface list.
Definition: AlgTool.h:332
StatusCode AlgTool::finalize ( )
virtual

Finalize (from INITIALIZED to CONFIGURED).

Implements IAlgTool.

Reimplemented in GaudiHistos< GaudiTool >, GaudiCommon< AlgTool >, GaudiTuples< GaudiHistoTool >, GaudiTool, GaudiHistoTool, GaudiTupleTool, PartitionSwitchTool, SequencerTimerTool, DataStreamTool, FuncMinimum, GslErrorCount, DataSvcFileEntriesTool, and EqSolver.

Definition at line 434 of file AlgTool.cpp.

436 {
437  // For the time being there is nothing to be done here.
438  return StatusCode::SUCCESS;
439 }
virtual Gaudi::StateMachine::State AlgTool::FSMState ( ) const
inlinevirtual

Get the current state.

Implements IAlgTool.

Definition at line 65 of file AlgTool.h.

65 { return m_state; }
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:355
const std::vector< Property * > & AlgTool::getProperties ( ) const
virtual

Get list of properties.

Implements IProperty.

Definition at line 140 of file AlgTool.cpp.

142 {
143  return m_propertyMgr->getProperties();
144 }
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
const std::vector< Property * > & getProperties() const
get all properties
StatusCode AlgTool::getProperty ( Property p) const
virtual

Get the property by property.

Implements IProperty.

Definition at line 120 of file AlgTool.cpp.

122 {
123  return m_propertyMgr->getProperty(p);
124 }
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
StatusCode getProperty(Property *p) const
get the property
const Property & AlgTool::getProperty ( const std::string &  name) const
virtual

Get the property by name.

Implements IProperty.

Definition at line 127 of file AlgTool.cpp.

128 {
129  return m_propertyMgr->getProperty(n);
130 }
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
StatusCode getProperty(Property *p) const
get the property
StatusCode AlgTool::getProperty ( const std::string &  n,
std::string &  v 
) const
virtual

Get the property by std::string.

Implements IProperty.

Definition at line 133 of file AlgTool.cpp.

135 {
136  return m_propertyMgr->getProperty(n,v);
137 }
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
StatusCode getProperty(Property *p) const
get the property
PropertyMgr* AlgTool::getPropertyMgr ( )
inline

Definition at line 95 of file AlgTool.h.

95 { return m_propertyMgr; }
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
StatusCode AlgTool::initialize ( )
virtual

Initialization (from CONFIGURED to INITIALIZED).

Implements IAlgTool.

Reimplemented in GaudiHistos< GaudiTool >, GaudiCommon< AlgTool >, GaudiTuples< GaudiHistoTool >, GaudiTool, GaudiHistoTool, GaudiTupleTool, SequencerTimerTool, FuncMinimum, PartitionSwitchTool, DataStreamTool, EqSolver, and DataSvcFileEntriesTool.

Definition at line 307 of file AlgTool.cpp.

309 {
310  // For the time being there is nothing to be done here.
311  // Setting the properties is done by the ToolSvc calling setProperties()
312  // explicitly.
313  return StatusCode::SUCCESS;
314 }
void AlgTool::initOutputLevel ( Property prop)
protected

callback for output level property

Definition at line 617 of file AlgTool.cpp.

617  {
618 //-----------------------------------------------------------------------------
619  // do nothing... yet ?
620 }
IMonitorSvc* AlgTool::monitorSvc ( ) const
inline

Access the monitor service.

Attention
Note that this method will return a NULL pointer if no monitor service is configured to be present. You must take this possibility into account when using the pointer
Returns
Pointer to the Monitor service
Return values
NULLNo monitor service is present
non-NULLA monitor service is present and available to be used

Definition at line 261 of file AlgTool.h.

262  {
263  // If not already located try to locate it without forcing a creation
264  if ( !m_pMonitorSvc ){
265  service_i( m_monitorSvcName, false,
266  IMonitorSvc::interfaceID(), pp_cast<void>(&m_pMonitorSvc) ).ignore();
267  }
268  return m_pMonitorSvc;
269  }
StatusCode service_i(const std::string &algName, bool createIf, const InterfaceID &iid, void **ppSvc) const
implementation of service method
Definition: AlgTool.cpp:580
std::string m_monitorSvcName
Name to use for Monitor Service.
Definition: AlgTool.h:330
IMonitorSvc * m_pMonitorSvc
Online Monitoring Service.
Definition: AlgTool.h:329
void ignore() const
Definition: StatusCode.h:94
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:171
IMessageSvc * AlgTool::msgSvc ( ) const

Retrieve pointer to message service.

Definition at line 79 of file AlgTool.cpp.

81 {
82  return m_messageSvc;
83 }
IMessageSvc * m_messageSvc
Message service.
Definition: AlgTool.h:327
const std::string & AlgTool::name ( ) const
virtual

Retrieve full identifying name of the concrete tool object.

Implements INamedInterface.

Definition at line 51 of file AlgTool.cpp.

53 {
54  return m_name;
55 }
const std::string m_name
AlgTool full name.
Definition: AlgTool.h:324
int AlgTool::outputLevel ( ) const
inlineprotected

get tool's output level

Definition at line 305 of file AlgTool.h.

305 { return (int)m_outputLevel ; }
IntegerProperty m_outputLevel
AlgTool output level.
Definition: AlgTool.h:322
IntegerProperty& AlgTool::outputLevelProperty ( )
inlineprotected

Accessor for the Message level property.

Definition at line 308 of file AlgTool.h.

308 { return m_outputLevel; }
IntegerProperty m_outputLevel
AlgTool output level.
Definition: AlgTool.h:322
const IInterface * AlgTool::parent ( ) const
virtual

Retrieve parent of the sub-algtool.

Implements IAlgTool.

Definition at line 65 of file AlgTool.cpp.

67 {
68  return m_parent;
69 }
const IInterface * m_parent
AlgTool parent.
Definition: AlgTool.h:325
StatusCode AlgTool::queryInterface ( const InterfaceID riid,
void **  ppvUnknown 
)
virtual

Query for a given interface.

Implements IInterface.

Reimplemented in extends2< AlgTool, IDODAlgMapper, IDODNodeMapper >, extends2< AlgTool, IDataStoreLeaves, IIncidentListener >, extends1< AlgTool, IDataStreamTool >, extends1< GaudiTool, IFuncMinimum >, extends1< AlgTool, IGslErrorHandler >, extends1< AlgTool, IFileAccess >, extends1< AlgTool, IPartitionControl >, and extends1< GaudiTool, IEqSolver >.

Definition at line 18 of file AlgTool.cpp.

21 {
22  if ( 0 == ppvi ) { return StatusCode::FAILURE ; } // RETURN
23  StatusCode sc = base_class::queryInterface(riid,ppvi);
24  if (sc.isSuccess()) {
25  return sc;
26  }
27  else {
28  for ( InterfaceList::iterator it = m_interfaceList.begin() ;
29  m_interfaceList.end() != it ; ++it )
30  {
31  if ( !it->first.versionMatch ( riid ) ) { continue ; }
32  // OK
33  *ppvi = it->second ;
34  addRef() ;
35  return SUCCESS ; // RETURN
36  }
37  *ppvi = 0 ;
38  return NO_INTERFACE ; // RETURN
39  }
40  // cannot reach this point
41 }
Requested interface is not available.
Definition: IInterface.h:221
Normal successful completion.
Definition: IInterface.h:219
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
InterfaceList m_interfaceList
Interface list.
Definition: AlgTool.h:332
StatusCode AlgTool::reinitialize ( )
virtual

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

Implements IAlgTool.

Definition at line 482 of file AlgTool.cpp.

484 {
485  /* @TODO
486  * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize
487  * is causing too many problems
488  *
489  // Default implementation is finalize+initialize
490  StatusCode sc = finalize();
491  if (sc.isFailure()) {
492  MsgStream log ( msgSvc() , name() );
493  log << MSG::ERROR << "reinitialize(): cannot be finalized" << endmsg;
494  return sc;
495  }
496  sc = initialize();
497  if (sc.isFailure()) {
498  MsgStream log ( msgSvc() , name() );
499  log << MSG::ERROR << "reinitialize(): cannot be initialized" << endmsg;
500  return sc;
501  }
502  */
503  return StatusCode::SUCCESS;
504 }
StatusCode AlgTool::restart ( )
virtual

Initialization (from RUNNING to RUNNING, via INITIALIZED).

Implements IAlgTool.

Definition at line 548 of file AlgTool.cpp.

550 {
551  // Default implementation is stop+start
552  StatusCode sc = stop();
553  if (sc.isFailure()) {
554  MsgStream log ( msgSvc() , name() );
555  log << MSG::ERROR << "restart(): cannot be stopped" << endmsg;
556  return sc;
557  }
558  sc = start();
559  if (sc.isFailure()) {
560  MsgStream log ( msgSvc() , name() );
561  log << MSG::ERROR << "restart(): cannot be started" << endmsg;
562  return sc;
563  }
564  return StatusCode::SUCCESS;
565 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode stop()
Stop (from RUNNING to INITIALIZED).
Definition: AlgTool.cpp:393
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode start()
Start (from INITIALIZED to RUNNING).
Definition: AlgTool.cpp:351
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
template<class T >
StatusCode AlgTool::service ( const std::string &  name,
T *&  svc,
bool  createIf = true 
) const
inline

Access a service by name, creating it if it doesn't already exist.

Definition at line 179 of file AlgTool.h.

179  {
180  return service_i(name, createIf, T::interfaceID(), (void**)&svc);
181  }
StatusCode service_i(const std::string &algName, bool createIf, const InterfaceID &iid, void **ppSvc) const
implementation of service method
Definition: AlgTool.cpp:580
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
template<class T >
StatusCode AlgTool::service ( const std::string &  type,
const std::string &  name,
T *&  svc 
) const
inline

Access a service by name, type creating it if it doesn't already exist.

Definition at line 186 of file AlgTool.h.

186  {
187  return service_i(type, name, T::interfaceID(), (void**)&svc);
188  }
virtual const std::string & type() const
Retrieve type (concrete class) of the sub-algtool.
Definition: AlgTool.cpp:58
StatusCode service_i(const std::string &algName, bool createIf, const InterfaceID &iid, void **ppSvc) const
implementation of service method
Definition: AlgTool.cpp:580
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
SmartIF< IService > AlgTool::service ( const std::string &  name,
const bool  createIf = true,
const bool  quiet = false 
) const

Return a pointer to the service identified by name (or "type/name")

Definition at line 598 of file AlgTool.cpp.

598  {
599  const ServiceLocatorHelper helper(*serviceLocator(), *this);
600  return helper.service(name, quiet, createIf);
601 }
an helper to share the implementation of service() among the various kernel base classes $Id: ...
ISvcLocator * serviceLocator() const
Retrieve pointer to service locator.
Definition: AlgTool.cpp:72
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
StatusCode AlgTool::service_i ( const std::string &  algName,
bool  createIf,
const InterfaceID iid,
void **  ppSvc 
) const
private

implementation of service method

Definition at line 580 of file AlgTool.cpp.

583  {
584  const ServiceLocatorHelper helper(*serviceLocator(), *this);
585  return helper.getService(svcName, createIf, iid, ppSvc);
586 }
an helper to share the implementation of service() among the various kernel base classes $Id: ...
ISvcLocator * serviceLocator() const
Retrieve pointer to service locator.
Definition: AlgTool.cpp:72
StatusCode AlgTool::service_i ( const std::string &  svcType,
const std::string &  svcName,
const InterfaceID iid,
void **  ppS 
) const
private

Definition at line 590 of file AlgTool.cpp.

593  {
594  const ServiceLocatorHelper helper(*serviceLocator(), *this);
595  return helper.createService(svcType, svcName, iid, ppSvc);
596 }
an helper to share the implementation of service() among the various kernel base classes $Id: ...
ISvcLocator * serviceLocator() const
Retrieve pointer to service locator.
Definition: AlgTool.cpp:72
ISvcLocator * AlgTool::serviceLocator ( ) const

Retrieve pointer to service locator.

Definition at line 72 of file AlgTool.cpp.

74 {
75  return m_svcLocator;
76 }
ISvcLocator * m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:326
StatusCode AlgTool::setProperties ( )

Method for setting declared properties to the values specified in the jobOptions via the job option service.

This method is called by the ToolSvc after creating the concrete tool, before passing it to the requesting parent and does not need to be called explicitly.

Definition at line 147 of file AlgTool.cpp.

149 {
150  if( m_svcLocator == 0) {
151  return StatusCode::FAILURE;
152  }
153  SmartIF<IJobOptionsSvc> jos(m_svcLocator->service("JobOptionsSvc"));
154  if( !jos.isValid() ) return StatusCode::FAILURE;
155 
156  // set first generic Properties
157  StatusCode sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this );
158  if( sc.isFailure() ) return StatusCode::FAILURE;
159 
160  // set specific Properties
161  if (isGaudiThreaded(name())) {
162  if(jos->setMyProperties( name(), this ).isFailure()) {
163  return StatusCode::FAILURE;
164  }
165  }
166 
167  // Change my own outputlevel
168  if ( 0 != m_messageSvc )
169  {
170  if ( MSG::NIL != m_outputLevel )
171  { m_messageSvc -> setOutputLevel ( name () , m_outputLevel ) ; }
173  }
174 
175  return StatusCode::SUCCESS;
176 }
IMessageSvc * m_messageSvc
Message service.
Definition: AlgTool.h:327
ISvcLocator * m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:326
IntegerProperty m_outputLevel
AlgTool output level.
Definition: AlgTool.h:322
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
GAUDI_API bool isGaudiThreaded(const std::string &name)
test if current Gaudi object is running /will run in a thread
Definition: ThreadGaudi.cpp:75
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:82
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
int outputLevel() const
get tool's output level
Definition: AlgTool.h:305
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
GAUDI_API std::string getGaudiThreadGenericName(const std::string &name)
helper function to extract Gaudi instance name from thread copy name
Definition: ThreadGaudi.cpp:52
StatusCode AlgTool::setProperty ( const Property p)
virtual

Default implementations for IProperty interface.

Implements IProperty.

Definition at line 99 of file AlgTool.cpp.

101 {
102  return m_propertyMgr->setProperty(p);
103 }
StatusCode setProperty(const Property &p)
set the property form another property
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
StatusCode AlgTool::setProperty ( const std::string &  s)
virtual

Set the property by string.

Implements IProperty.

Definition at line 106 of file AlgTool.cpp.

108 {
109  return m_propertyMgr->setProperty(s);
110 }
StatusCode setProperty(const Property &p)
set the property form another property
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
string s
Definition: gaudirun.py:210
StatusCode AlgTool::setProperty ( const std::string &  n,
const std::string &  v 
)
virtual

Set the property by std::string.

Implements IProperty.

Definition at line 113 of file AlgTool.cpp.

115 {
116  return m_propertyMgr->setProperty(n,v);
117 }
StatusCode setProperty(const Property &p)
set the property form another property
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
template<class TYPE >
StatusCode AlgTool::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 convenient 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..

Parameters
namename of the property
valuevalue of the property
See also
Gaudi::Utils::setProperty
Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2007-05-13

Definition at line 141 of file AlgTool.h.

StatusCode setProperty(IProperty *component, const std::string &name, const TYPE &value, const std::string &doc)
simple function to set the property of the given object from the value
Definition: Property.h:1212
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:331
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
StatusCode AlgTool::start ( )
virtual

Start (from INITIALIZED to RUNNING).

Implements IAlgTool.

Definition at line 351 of file AlgTool.cpp.

353 {
354  // For the time being there is nothing to be done here.
355  return StatusCode::SUCCESS;
356 }
StatusCode AlgTool::stop ( )
virtual

Stop (from RUNNING to INITIALIZED).

Implements IAlgTool.

Definition at line 393 of file AlgTool.cpp.

395 {
396  // For the time being there is nothing to be done here.
397  return StatusCode::SUCCESS;
398 }
ISvcLocator* AlgTool::svcLoc ( ) const
inline

shortcut for the method service locator

Definition at line 159 of file AlgTool.h.

159 { return serviceLocator() ; }
ISvcLocator * serviceLocator() const
Retrieve pointer to service locator.
Definition: AlgTool.cpp:72
StatusCode AlgTool::sysFinalize ( )
virtual

Finalize AlgTool.

Implements IAlgTool.

Definition at line 401 of file AlgTool.cpp.

401  {
402 //-----------------------------------------------------------------------------
403 
404  try {
406  Gaudi::Guards::AuditorGuard guard(this,
407  // check if we want to audit the initialize
408  (m_auditorFinalize) ? auditorSvc() : 0,
410  StatusCode sc = finalize();
411  if (sc.isSuccess())
413  return sc;
414  }
415  catch( const GaudiException& Exception ) {
416  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
417  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
418  << " is caught " << endmsg;
419  log << MSG::ERROR << Exception << endmsg;
420  }
421  catch( const std::exception& Exception ) {
422  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
423  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
424  log << MSG::ERROR << Exception.what() << endmsg;
425  }
426  catch( ... ) {
427  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
428  log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
429  }
430  return StatusCode::FAILURE;
431 
432 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Define general base for Gaudi exception.
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: AlgTool.cpp:434
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & tag() const
name tag for the exception, or exception type
bool m_auditorFinalize
flag for auditors in "finalize()"
Definition: AlgTool.h:351
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:355
State GAUDI_API ChangeState(const Transition transition, const State state)
Function to get the new state according to the required transition, checking if the transition is all...
Definition: StateMachine.cpp:8
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:356
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:218
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:604
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode AlgTool::sysInitialize ( )
virtual

Initialize AlgTool.

Implements IAlgTool.

Definition at line 273 of file AlgTool.cpp.

273  {
274 //-----------------------------------------------------------------------------
275 
276  try {
278  Gaudi::Guards::AuditorGuard guard(this,
279  // check if we want to audit the initialize
283  if (sc.isSuccess())
285  return sc;
286  }
287  catch( const GaudiException& Exception ) {
288  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
289  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
290  << " is caught " << endmsg;
291  log << MSG::ERROR << Exception << endmsg;
292  }
293  catch( const std::exception& Exception ) {
294  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
295  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
296  log << MSG::ERROR << Exception.what() << endmsg;
297  }
298  catch( ... ) {
299  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
300  log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
301  }
302  return StatusCode::FAILURE ;
303 
304 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Define general base for Gaudi exception.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & tag() const
name tag for the exception, or exception type
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:355
State GAUDI_API ChangeState(const Transition transition, const State state)
Function to get the new state according to the required transition, checking if the transition is all...
Definition: StateMachine.cpp:8
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: AlgTool.cpp:307
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:356
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:218
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
bool m_auditorInitialize
flag for auditors in "initialize()"
Definition: AlgTool.h:348
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:604
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode AlgTool::sysReinitialize ( )
virtual

Initialize AlgTool.

Implements IAlgTool.

Definition at line 442 of file AlgTool.cpp.

442  {
443 //-----------------------------------------------------------------------------
444 
445  // Check that the current status is the correct one.
447  MsgStream log ( msgSvc() , name() );
448  log << MSG::ERROR
449  << "sysReinitialize(): cannot reinitialize tool not initialized"
450  << endmsg;
451  return StatusCode::FAILURE;
452  }
453 
454  try {
455  Gaudi::Guards::AuditorGuard guard(this,
456  // check if we want to audit the initialize
460  return sc;
461  }
462  catch( const GaudiException& Exception ) {
463  MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
464  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
465  << " is caught" << endmsg;
466  log << MSG::ERROR << Exception << endmsg;
467  }
468  catch( const std::exception& Exception ) {
469  MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
470  log << MSG::FATAL << " Standard std::exception is caught" << endmsg;
471  log << MSG::ERROR << Exception.what() << endmsg;
472  }
473  catch( ... ) {
474  MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
475  log << MSG::FATAL << "UNKNOWN Exception is caught" << endmsg;
476  }
477  return StatusCode::FAILURE ;
478 
479 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Define general base for Gaudi exception.
virtual Gaudi::StateMachine::State FSMState() const
Get the current state.
Definition: AlgTool.h:65
virtual StatusCode reinitialize()
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Definition: AlgTool.cpp:482
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & tag() const
name tag for the exception, or exception type
bool m_auditorReinitialize
flag for auditors in "reinitialize()"
Definition: AlgTool.h:352
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:218
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:604
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode AlgTool::sysRestart ( )
virtual

Start AlgTool.

Implements IAlgTool.

Definition at line 507 of file AlgTool.cpp.

507  {
508 //-----------------------------------------------------------------------------
509 
510  // Check that the current status is the correct one.
512  MsgStream log ( msgSvc() , name() );
513  log << MSG::ERROR
514  << "sysRestart(): cannot reinitialize tool not started"
515  << endmsg;
516  return StatusCode::FAILURE;
517  }
518 
519  try {
521  Gaudi::Guards::AuditorGuard guard(this,
522  // check if we want to audit the initialize
523  (m_auditorRestart) ? auditorSvc() : 0,
525  StatusCode sc = restart();
526  return sc;
527  }
528  catch( const GaudiException& Exception ) {
529  MsgStream log ( msgSvc() , name() + ".sysRestart()" );
530  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
531  << " is caught" << endmsg;
532  log << MSG::ERROR << Exception << endmsg;
533  }
534  catch( const std::exception& Exception ) {
535  MsgStream log ( msgSvc() , name() + ".sysRestart()" );
536  log << MSG::FATAL << " Standard std::exception is caught" << endmsg;
537  log << MSG::ERROR << Exception.what() << endmsg;
538  }
539  catch( ... ) {
540  MsgStream log ( msgSvc() , name() + ".sysRestart()" );
541  log << MSG::FATAL << "UNKNOWN Exception is caught" << endmsg;
542  }
543  return StatusCode::FAILURE ;
544 
545 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Define general base for Gaudi exception.
virtual StatusCode restart()
Initialization (from RUNNING to RUNNING, via INITIALIZED).
Definition: AlgTool.cpp:548
virtual Gaudi::StateMachine::State FSMState() const
Get the current state.
Definition: AlgTool.h:65
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & tag() const
name tag for the exception, or exception type
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:355
State GAUDI_API ChangeState(const Transition transition, const State state)
Function to get the new state according to the required transition, checking if the transition is all...
Definition: StateMachine.cpp:8
bool m_auditorRestart
flag for auditors in "restart()"
Definition: AlgTool.h:353
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:356
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:218
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:604
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode AlgTool::sysStart ( )
virtual

Start AlgTool.

Implements IAlgTool.

Definition at line 317 of file AlgTool.cpp.

317  {
318 //-----------------------------------------------------------------------------
319 
320  try {
322  Gaudi::Guards::AuditorGuard guard(this,
323  // check if we want to audit the initialize
324  (m_auditorStart) ? auditorSvc() : 0,
326  StatusCode sc = start();
327  if (sc.isSuccess())
329  return sc;
330  }
331  catch( const GaudiException& Exception ) {
332  MsgStream log ( msgSvc() , name() + ".sysStart()" );
333  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
334  << " is caught " << endmsg;
335  log << MSG::ERROR << Exception << endmsg;
336  }
337  catch( const std::exception& Exception ) {
338  MsgStream log ( msgSvc() , name() + ".sysStart()" );
339  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
340  log << MSG::ERROR << Exception.what() << endmsg;
341  }
342  catch( ... ) {
343  MsgStream log ( msgSvc() , name() + ".sysStart()" );
344  log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
345  }
346  return StatusCode::FAILURE ;
347 
348 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Define general base for Gaudi exception.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & tag() const
name tag for the exception, or exception type
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:355
State GAUDI_API ChangeState(const Transition transition, const State state)
Function to get the new state according to the required transition, checking if the transition is all...
Definition: StateMachine.cpp:8
virtual StatusCode start()
Start (from INITIALIZED to RUNNING).
Definition: AlgTool.cpp:351
bool m_auditorStart
flag for auditors in "start()"
Definition: AlgTool.h:349
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:356
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:218
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:604
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode AlgTool::sysStop ( )
virtual

Stop AlgTool.

Implements IAlgTool.

Definition at line 359 of file AlgTool.cpp.

359  {
360 //-----------------------------------------------------------------------------
361 
362  try {
364  Gaudi::Guards::AuditorGuard guard(this,
365  // check if we want to audit the initialize
366  (m_auditorStop) ? auditorSvc() : 0,
368  StatusCode sc = stop();
369  if (sc.isSuccess())
371  return sc;
372  }
373  catch( const GaudiException& Exception ) {
374  MsgStream log ( msgSvc() , name() + ".sysStop()" );
375  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
376  << " is caught " << endmsg;
377  log << MSG::ERROR << Exception << endmsg;
378  }
379  catch( const std::exception& Exception ) {
380  MsgStream log ( msgSvc() , name() + ".sysStop()" );
381  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
382  log << MSG::ERROR << Exception.what() << endmsg;
383  }
384  catch( ... ) {
385  MsgStream log ( msgSvc() , name() + ".sysStop()" );
386  log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
387  }
388  return StatusCode::FAILURE ;
389 
390 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Define general base for Gaudi exception.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
virtual StatusCode stop()
Stop (from RUNNING to INITIALIZED).
Definition: AlgTool.cpp:393
IMessageSvc * msgSvc() const
Retrieve pointer to message service.
Definition: AlgTool.cpp:79
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & tag() const
name tag for the exception, or exception type
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:355
State GAUDI_API ChangeState(const Transition transition, const State state)
Function to get the new state according to the required transition, checking if the transition is all...
Definition: StateMachine.cpp:8
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:356
It is a simple guard, which "locks" the scope for the Auditor Service is am exception-safe way...
Definition: Guards.h:218
bool m_auditorStop
flag for auditors in "stop()"
Definition: AlgTool.h:350
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:604
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual Gaudi::StateMachine::State AlgTool::targetFSMState ( ) const
inlinevirtual

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 IStateful.

Definition at line 66 of file AlgTool.h.

66 { return m_targetState; }
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:356
virtual StatusCode AlgTool::terminate ( )
inlinevirtual

Initialization (from CONFIGURED to OFFLINE).

Implements IAlgTool.

Definition at line 62 of file AlgTool.h.

IToolSvc * AlgTool::toolSvc ( ) const

The standard ToolSvc service, Return a pointer to the service if present.

Definition at line 86 of file AlgTool.cpp.

88 {
89  if ( 0 == m_ptoolSvc ) {
90  StatusCode sc = service( "ToolSvc", m_ptoolSvc, true );
91  if( sc.isFailure() ) {
92  throw GaudiException("Service [ToolSvc] not found", name(), sc);
93  }
94  }
95  return m_ptoolSvc;
96 }
Define general base for Gaudi exception.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode service(const std::string &name, T *&svc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: AlgTool.h:179
IToolSvc * m_ptoolSvc
Tool service.
Definition: AlgTool.h:328
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
const std::string & AlgTool::type ( ) const
virtual

Retrieve type (concrete class) of the sub-algtool.

Implements IAlgTool.

Definition at line 58 of file AlgTool.cpp.

60 {
61  return m_type;
62 }
std::string m_type
AlgTool type (concrete class name)
Definition: AlgTool.h:323

Friends And Related Function Documentation

friend class ToolSvc
friend

Definition at line 35 of file AlgTool.h.

Member Data Documentation

BooleanProperty AlgTool::m_auditInit
private

Definition at line 347 of file AlgTool.h.

bool AlgTool::m_auditorFinalize
private

flag for auditors in "finalize()"

Definition at line 351 of file AlgTool.h.

bool AlgTool::m_auditorInitialize
private

flag for auditors in "initialize()"

Definition at line 348 of file AlgTool.h.

bool AlgTool::m_auditorReinitialize
private

flag for auditors in "reinitialize()"

Definition at line 352 of file AlgTool.h.

bool AlgTool::m_auditorRestart
private

flag for auditors in "restart()"

Definition at line 353 of file AlgTool.h.

bool AlgTool::m_auditorStart
private

flag for auditors in "start()"

Definition at line 349 of file AlgTool.h.

bool AlgTool::m_auditorStop
private

flag for auditors in "stop()"

Definition at line 350 of file AlgTool.h.

InterfaceList AlgTool::m_interfaceList
private

Interface list.

Definition at line 332 of file AlgTool.h.

IMessageSvc* AlgTool::m_messageSvc
mutableprivate

Message service.

Definition at line 327 of file AlgTool.h.

std::string AlgTool::m_monitorSvcName
private

Name to use for Monitor Service.

Definition at line 330 of file AlgTool.h.

const std::string AlgTool::m_name
private

AlgTool full name.

Definition at line 324 of file AlgTool.h.

IntegerProperty AlgTool::m_outputLevel
private

AlgTool output level.

Definition at line 322 of file AlgTool.h.

const IInterface* AlgTool::m_parent
private

AlgTool parent.

Definition at line 325 of file AlgTool.h.

IAuditorSvc* AlgTool::m_pAuditorSvc
mutableprivate

Auditor Service.

Definition at line 345 of file AlgTool.h.

IMonitorSvc* AlgTool::m_pMonitorSvc
mutableprivate

Online Monitoring Service.

Definition at line 329 of file AlgTool.h.

PropertyMgr* AlgTool::m_propertyMgr
private

Property Manager.

Definition at line 331 of file AlgTool.h.

IToolSvc* AlgTool::m_ptoolSvc
mutableprivate

Tool service.

Definition at line 328 of file AlgTool.h.

Gaudi::StateMachine::State AlgTool::m_state
private

state of the Tool

Definition at line 355 of file AlgTool.h.

ISvcLocator* AlgTool::m_svcLocator
mutableprivate

Pointer to Service Locator service.

Definition at line 326 of file AlgTool.h.

Gaudi::StateMachine::State AlgTool::m_targetState
private

state of the Tool

Definition at line 356 of file AlgTool.h.

std::string AlgTool::m_threadID
private

Thread Id for Alg Tool.

Definition at line 333 of file AlgTool.h.

std::string AlgTool::m_type
private

AlgTool type (concrete class name)

Definition at line 323 of file AlgTool.h.


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