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, IStatefulextend_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...
 
virtual bool hasProperty (const std::string &name) const
 Return true if we have a property with the given name. 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, 1)
 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 322 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 183 of file AlgTool.cpp.

187  : m_outputLevel ( MSG::NIL )
188  , m_type ( type )
189  , m_name ( name )
190  , m_parent ( parent )
191  , m_svcLocator ( 0 )
192  , m_messageSvc ( 0 )
193  , m_ptoolSvc ( 0 )
194  , m_pMonitorSvc ( NULL )
195  , m_propertyMgr ( new PropertyMgr() )
196  , m_interfaceList ( )
197  , m_threadID ( )
198  , m_pAuditorSvc ( 0 )
199  , m_auditInit ( false )
200  , m_auditorInitialize(false)
201  , m_auditorStart(false)
202  , m_auditorStop(false)
203  , m_auditorFinalize(false)
204  , m_auditorReinitialize(false)
205  , m_auditorRestart(false)
208 {
209  addRef(); // Initial count set to 1
210 
211  declareProperty( "MonitorService", m_monitorSvcName = "MonitorSvc" );
212 
213  { // get the "OutputLevel" property from parent
214  const Property* _p = Gaudi::Utils::getProperty ( parent , "OutputLevel") ;
215  if ( 0 != _p ) { m_outputLevel.assign( *_p ) ; }
216  declareProperty ( "OutputLevel" , m_outputLevel ) ;
218  }
219 
220  IInterface* _p = const_cast<IInterface*> ( parent ) ;
221 
222  if ( Algorithm* _alg = dynamic_cast<Algorithm*> ( _p ) )
223  {
224  m_svcLocator = _alg -> serviceLocator () ;
225  m_messageSvc = _alg -> msgSvc () ;
226  m_threadID = getGaudiThreadIDfromName ( _alg -> name() ) ;
227  }
228  else if ( Service* _svc = dynamic_cast<Service*> ( _p ) )
229  {
230  m_svcLocator = _svc -> serviceLocator () ;
231  m_messageSvc = _svc -> msgSvc () ;
232  m_threadID = getGaudiThreadIDfromName ( _svc -> name() ) ;
233  }
234  else if ( AlgTool* _too = dynamic_cast<AlgTool*> ( _p ) )
235  {
236  m_svcLocator = _too -> m_svcLocator;
237  m_messageSvc = _too -> m_messageSvc;
239  }
240  else if ( Auditor* _aud = dynamic_cast<Auditor*> ( _p ) )
241  {
242  m_svcLocator = _aud -> serviceLocator() ;
243  m_messageSvc = _aud -> msgSvc() ;
244  m_threadID = getGaudiThreadIDfromName ( _aud -> name() ) ;
245  }
246  else
247  {
248  throw GaudiException
249  ( "Failure to create tool '"
250  + type + "/" + name + "': illegal parent type '"
251  + System::typeinfoName(typeid(*_p)) + "'", "AlgTool", 0 );
252  }
253 
254 
255  { // audit tools
256  SmartIF<IProperty> appMgr(m_svcLocator->service("ApplicationMgr"));
257  if ( !appMgr.isValid() ) {
258  throw GaudiException("Could not locate ApplicationMgr","AlgTool",0);
259  }
260  const Property* p = Gaudi::Utils::getProperty( appMgr , "AuditTools");
261  if ( 0 != p ) { m_auditInit.assign ( *p ) ; }
262  declareProperty ( "AuditTools", m_auditInit );
263  bool audit = m_auditInit.value();
264  // Declare common AlgTool properties with their defaults
265  declareProperty ( "AuditInitialize" , m_auditorInitialize = audit ) ;
266  declareProperty ( "AuditStart" , m_auditorStart = audit ) ;
267  declareProperty ( "AuditStop" , m_auditorStop = audit ) ;
268  declareProperty ( "AuditFinalize" , m_auditorFinalize = audit ) ;
269  }
270 
271  // check thread ID and try if tool name indicates thread ID
272  if ( m_threadID.empty() )
274 }
void initOutputLevel(Property &prop)
callback for output level property
Definition: AlgTool.cpp:621
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:332
Define general base for Gaudi exception.
std::string m_type
AlgTool type (concrete class name)
Definition: AlgTool.h:324
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:299
IMessageSvc * m_messageSvc
Message service.
Definition: AlgTool.h:328
const IInterface * m_parent
AlgTool parent.
Definition: AlgTool.h:326
ISvcLocator * m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:327
IntegerProperty m_outputLevel
AlgTool output level.
Definition: AlgTool.h:323
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:34
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:331
const std::string m_name
AlgTool full name.
Definition: AlgTool.h:325
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:235
Definition of the basic interface.
Definition: IInterface.h:160
std::string m_threadID
Thread Id for Alg Tool.
Definition: AlgTool.h:334
IToolSvc * m_ptoolSvc
Tool service.
Definition: AlgTool.h:329
const TYPE & value() const
explicit conversion
Definition: Property.h:355
bool m_auditorFinalize
flag for auditors in "finalize()"
Definition: AlgTool.h:352
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:356
IAuditorSvc * m_pAuditorSvc
Auditor Service.
Definition: AlgTool.h:346
bool m_auditorReinitialize
flag for auditors in "reinitialize()"
Definition: AlgTool.h:353
IMonitorSvc * m_pMonitorSvc
Online Monitoring Service.
Definition: AlgTool.h:330
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:354
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:333
BooleanProperty m_auditInit
Definition: AlgTool.h:348
bool m_auditorStart
flag for auditors in "start()"
Definition: AlgTool.h:350
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:357
Base class for all services.
Definition: Service.h:33
bool m_auditorStop
flag for auditors in "stop()"
Definition: AlgTool.h:351
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:349
Base class from which all concrete auditor classes should be derived.
Definition: Auditor.h:34
AlgTool::~AlgTool ( )
protectedvirtual

Definition at line 572 of file AlgTool.cpp.

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

Member Function Documentation

IAuditorSvc * AlgTool::auditorSvc ( ) const

Access the auditor service.

Definition at line 608 of file AlgTool.cpp.

608  {
609 //---------------------------------------------------------------------------
610  if ( 0 == m_pAuditorSvc ) {
611  StatusCode sc = service( "AuditorSvc", m_pAuditorSvc, true );
612  if( sc.isFailure() ) {
613  throw GaudiException("Service [AuditorSvc] not found", name(), sc);
614  }
615  }
616  return m_pAuditorSvc;
617 }
Define general base for Gaudi exception.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
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:180
IAuditorSvc * m_pAuditorSvc
Auditor Service.
Definition: AlgTool.h:346
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 278 of file AlgTool.h.

281  {
282  IMonitorSvc* mS = monitorSvc();
283  if ( mS ) mS->declareInfo(name, var, desc, this);
284  }
IMonitorSvc * monitorSvc() const
Access the monitor service.
Definition: AlgTool.h:262
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 293 of file AlgTool.h.

298  {
299  IMonitorSvc* mS = monitorSvc();
300  if ( mS ) mS->declareInfo(name, format, var, size, desc, this);
301  }
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:262
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 235 of file AlgTool.h.

238  {
239  return m_propertyMgr -> declareProperty ( name , property , doc ) ;
240  }
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:332
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: AlgTool.h:235
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 243 of file AlgTool.h.

246  {
247  return m_propertyMgr-> declareRemoteProperty ( name , rsvc , rname ) ;
248  }
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:332
Property * declareRemoteProperty(const std::string &name, IProperty *rsvc, const std::string &rname="") const
Declare remote named properties.
Definition: AlgTool.h:243
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:333
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 438 of file AlgTool.cpp.

440 {
441  // For the time being there is nothing to be done here.
442  return StatusCode::SUCCESS;
443 }
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:356
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:332
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:332
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:332
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:332
StatusCode getProperty(Property *p) const
get the property
PropertyMgr* AlgTool::getPropertyMgr ( )
inline

Definition at line 96 of file AlgTool.h.

96 { return m_propertyMgr; }
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:332
bool AlgTool::hasProperty ( const std::string &  name) const
virtual

Return true if we have a property with the given name.

Implements IProperty.

Definition at line 146 of file AlgTool.cpp.

146  {
147  return m_propertyMgr->hasProperty(name);
148 }
PropertyMgr * m_propertyMgr
Property Manager.
Definition: AlgTool.h:332
bool hasProperty(const std::string &name) const
Return true if we have a property with the given name.
virtual const std::string & name() const
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:51
StatusCode AlgTool::initialize ( )
virtual

Initialization (from CONFIGURED to INITIALIZED).

Implements IAlgTool.

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

Definition at line 311 of file AlgTool.cpp.

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

callback for output level property

Definition at line 621 of file AlgTool.cpp.

621  {
622 //-----------------------------------------------------------------------------
623  // do nothing... yet ?
624 }
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 262 of file AlgTool.h.

263  {
264  // If not already located try to locate it without forcing a creation
265  if ( !m_pMonitorSvc ){
266  service_i( m_monitorSvcName, false,
267  IMonitorSvc::interfaceID(), pp_cast<void>(&m_pMonitorSvc) ).ignore();
268  }
269  return m_pMonitorSvc;
270  }
StatusCode service_i(const std::string &algName, bool createIf, const InterfaceID &iid, void **ppSvc) const
implementation of service method
Definition: AlgTool.cpp:584
std::string m_monitorSvcName
Name to use for Monitor Service.
Definition: AlgTool.h:331
IMonitorSvc * m_pMonitorSvc
Online Monitoring Service.
Definition: AlgTool.h:330
void ignore() const
Definition: StatusCode.h:107
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:328
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:325
int AlgTool::outputLevel ( ) const
inlineprotected

get tool's output level

Definition at line 306 of file AlgTool.h.

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

Accessor for the Message level property.

Definition at line 309 of file AlgTool.h.

309 { return m_outputLevel; }
IntegerProperty m_outputLevel
AlgTool output level.
Definition: AlgTool.h:323
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:326
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:75
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:333
StatusCode AlgTool::reinitialize ( )
virtual

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

Implements IAlgTool.

Definition at line 486 of file AlgTool.cpp.

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

Initialization (from RUNNING to RUNNING, via INITIALIZED).

Implements IAlgTool.

Definition at line 552 of file AlgTool.cpp.

554 {
555  // Default implementation is stop+start
556  StatusCode sc = stop();
557  if (sc.isFailure()) {
558  MsgStream log ( msgSvc() , name() );
559  log << MSG::ERROR << "restart(): cannot be stopped" << endmsg;
560  return sc;
561  }
562  sc = start();
563  if (sc.isFailure()) {
564  MsgStream log ( msgSvc() , name() );
565  log << MSG::ERROR << "restart(): cannot be started" << endmsg;
566  return sc;
567  }
568  return StatusCode::SUCCESS;
569 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode stop()
Stop (from RUNNING to INITIALIZED).
Definition: AlgTool.cpp:397
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
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:355
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 180 of file AlgTool.h.

180  {
181  return service_i(name, createIf, T::interfaceID(), (void**)&svc);
182  }
StatusCode service_i(const std::string &algName, bool createIf, const InterfaceID &iid, void **ppSvc) const
implementation of service method
Definition: AlgTool.cpp:584
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 187 of file AlgTool.h.

187  {
188  return service_i(type, name, T::interfaceID(), (void**)&svc);
189  }
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:584
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 602 of file AlgTool.cpp.

602  {
603  const ServiceLocatorHelper helper(*serviceLocator(), *this);
604  return helper.service(name, quiet, createIf);
605 }
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 584 of file AlgTool.cpp.

587  {
588  const ServiceLocatorHelper helper(*serviceLocator(), *this);
589  return helper.getService(svcName, createIf, iid, ppSvc);
590 }
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 594 of file AlgTool.cpp.

597  {
598  const ServiceLocatorHelper helper(*serviceLocator(), *this);
599  return helper.createService(svcType, svcName, iid, ppSvc);
600 }
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:327
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 151 of file AlgTool.cpp.

153 {
154  if( m_svcLocator == 0) {
155  return StatusCode::FAILURE;
156  }
157  SmartIF<IJobOptionsSvc> jos(m_svcLocator->service("JobOptionsSvc"));
158  if( !jos.isValid() ) return StatusCode::FAILURE;
159 
160  // set first generic Properties
161  StatusCode sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this );
162  if( sc.isFailure() ) return StatusCode::FAILURE;
163 
164  // set specific Properties
165  if (isGaudiThreaded(name())) {
166  if(jos->setMyProperties( name(), this ).isFailure()) {
167  return StatusCode::FAILURE;
168  }
169  }
170 
171  // Change my own outputlevel
172  if ( 0 != m_messageSvc )
173  {
174  if ( MSG::NIL != m_outputLevel )
175  { m_messageSvc -> setOutputLevel ( name () , m_outputLevel ) ; }
177  }
178 
179  return StatusCode::SUCCESS;
180 }
IMessageSvc * m_messageSvc
Message service.
Definition: AlgTool.h:328
ISvcLocator * m_svcLocator
Pointer to Service Locator service.
Definition: AlgTool.h:327
IntegerProperty m_outputLevel
AlgTool output level.
Definition: AlgTool.h:323
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
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:306
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:332
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:332
string s
Definition: gaudirun.py:217
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:332
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 142 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:332
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 355 of file AlgTool.cpp.

357 {
358  // For the time being there is nothing to be done here.
359  return StatusCode::SUCCESS;
360 }
StatusCode AlgTool::stop ( )
virtual

Stop (from RUNNING to INITIALIZED).

Implements IAlgTool.

Definition at line 397 of file AlgTool.cpp.

399 {
400  // For the time being there is nothing to be done here.
401  return StatusCode::SUCCESS;
402 }
ISvcLocator* AlgTool::svcLoc ( ) const
inline

shortcut for the method service locator

Definition at line 160 of file AlgTool.h.

160 { 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 405 of file AlgTool.cpp.

405  {
406 //-----------------------------------------------------------------------------
407 
408  try {
410  Gaudi::Guards::AuditorGuard guard(this,
411  // check if we want to audit the initialize
412  (m_auditorFinalize) ? auditorSvc() : 0,
414  StatusCode sc = finalize();
415  if (sc.isSuccess())
417  return sc;
418  }
419  catch( const GaudiException& Exception ) {
420  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
421  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
422  << " is caught " << endmsg;
423  log << MSG::ERROR << Exception << endmsg;
424  }
425  catch( const std::exception& Exception ) {
426  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
427  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
428  log << MSG::ERROR << Exception.what() << endmsg;
429  }
430  catch( ... ) {
431  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
432  log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
433  }
434  return StatusCode::FAILURE;
435 
436 }
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:438
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
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:352
Gaudi::StateMachine::State m_state
state of the Tool
Definition: AlgTool.h:356
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:357
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:608
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 277 of file AlgTool.cpp.

277  {
278 //-----------------------------------------------------------------------------
279 
280  try {
282  Gaudi::Guards::AuditorGuard guard(this,
283  // check if we want to audit the initialize
287  if (sc.isSuccess())
289  return sc;
290  }
291  catch( const GaudiException& Exception ) {
292  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
293  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
294  << " is caught " << endmsg;
295  log << MSG::ERROR << Exception << endmsg;
296  }
297  catch( const std::exception& Exception ) {
298  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
299  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
300  log << MSG::ERROR << Exception.what() << endmsg;
301  }
302  catch( ... ) {
303  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
304  log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
305  }
306  return StatusCode::FAILURE ;
307 
308 }
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:75
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:356
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:311
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:357
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:349
IAuditorSvc * auditorSvc() const
Access the auditor service.
Definition: AlgTool.cpp:608
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 446 of file AlgTool.cpp.

446  {
447 //-----------------------------------------------------------------------------
448 
449  // Check that the current status is the correct one.
451  MsgStream log ( msgSvc() , name() );
452  log << MSG::ERROR
453  << "sysReinitialize(): cannot reinitialize tool not initialized"
454  << endmsg;
455  return StatusCode::FAILURE;
456  }
457 
458  try {
459  Gaudi::Guards::AuditorGuard guard(this,
460  // check if we want to audit the initialize
464  return sc;
465  }
466  catch( const GaudiException& Exception ) {
467  MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
468  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
469  << " is caught" << endmsg;
470  log << MSG::ERROR << Exception << endmsg;
471  }
472  catch( const std::exception& Exception ) {
473  MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
474  log << MSG::FATAL << " Standard std::exception is caught" << endmsg;
475  log << MSG::ERROR << Exception.what() << endmsg;
476  }
477  catch( ... ) {
478  MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
479  log << MSG::FATAL << "UNKNOWN Exception is caught" << endmsg;
480  }
481  return StatusCode::FAILURE ;
482 
483 }
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:486
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:353
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:608
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 511 of file AlgTool.cpp.

511  {
512 //-----------------------------------------------------------------------------
513 
514  // Check that the current status is the correct one.
516  MsgStream log ( msgSvc() , name() );
517  log << MSG::ERROR
518  << "sysRestart(): cannot reinitialize tool not started"
519  << endmsg;
520  return StatusCode::FAILURE;
521  }
522 
523  try {
525  Gaudi::Guards::AuditorGuard guard(this,
526  // check if we want to audit the initialize
527  (m_auditorRestart) ? auditorSvc() : 0,
529  StatusCode sc = restart();
530  return sc;
531  }
532  catch( const GaudiException& Exception ) {
533  MsgStream log ( msgSvc() , name() + ".sysRestart()" );
534  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
535  << " is caught" << endmsg;
536  log << MSG::ERROR << Exception << endmsg;
537  }
538  catch( const std::exception& Exception ) {
539  MsgStream log ( msgSvc() , name() + ".sysRestart()" );
540  log << MSG::FATAL << " Standard std::exception is caught" << endmsg;
541  log << MSG::ERROR << Exception.what() << endmsg;
542  }
543  catch( ... ) {
544  MsgStream log ( msgSvc() , name() + ".sysRestart()" );
545  log << MSG::FATAL << "UNKNOWN Exception is caught" << endmsg;
546  }
547  return StatusCode::FAILURE ;
548 
549 }
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:552
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:356
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:354
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:357
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:608
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 321 of file AlgTool.cpp.

321  {
322 //-----------------------------------------------------------------------------
323 
324  try {
326  Gaudi::Guards::AuditorGuard guard(this,
327  // check if we want to audit the initialize
328  (m_auditorStart) ? auditorSvc() : 0,
330  StatusCode sc = start();
331  if (sc.isSuccess())
333  return sc;
334  }
335  catch( const GaudiException& Exception ) {
336  MsgStream log ( msgSvc() , name() + ".sysStart()" );
337  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
338  << " is caught " << endmsg;
339  log << MSG::ERROR << Exception << endmsg;
340  }
341  catch( const std::exception& Exception ) {
342  MsgStream log ( msgSvc() , name() + ".sysStart()" );
343  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
344  log << MSG::ERROR << Exception.what() << endmsg;
345  }
346  catch( ... ) {
347  MsgStream log ( msgSvc() , name() + ".sysStart()" );
348  log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
349  }
350  return StatusCode::FAILURE ;
351 
352 }
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:75
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:356
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:355
bool m_auditorStart
flag for auditors in "start()"
Definition: AlgTool.h:350
Gaudi::StateMachine::State m_targetState
state of the Tool
Definition: AlgTool.h:357
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:608
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 363 of file AlgTool.cpp.

363  {
364 //-----------------------------------------------------------------------------
365 
366  try {
368  Gaudi::Guards::AuditorGuard guard(this,
369  // check if we want to audit the initialize
370  (m_auditorStop) ? auditorSvc() : 0,
372  StatusCode sc = stop();
373  if (sc.isSuccess())
375  return sc;
376  }
377  catch( const GaudiException& Exception ) {
378  MsgStream log ( msgSvc() , name() + ".sysStop()" );
379  log << MSG::FATAL << " Exception with tag=" << Exception.tag()
380  << " is caught " << endmsg;
381  log << MSG::ERROR << Exception << endmsg;
382  }
383  catch( const std::exception& Exception ) {
384  MsgStream log ( msgSvc() , name() + ".sysStop()" );
385  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
386  log << MSG::ERROR << Exception.what() << endmsg;
387  }
388  catch( ... ) {
389  MsgStream log ( msgSvc() , name() + ".sysStop()" );
390  log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
391  }
392  return StatusCode::FAILURE ;
393 
394 }
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:75
virtual StatusCode stop()
Stop (from RUNNING to INITIALIZED).
Definition: AlgTool.cpp:397
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:356
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:357
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:351
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:608
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:357
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:85
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:180
IToolSvc * m_ptoolSvc
Tool service.
Definition: AlgTool.h:329
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:324

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 348 of file AlgTool.h.

bool AlgTool::m_auditorFinalize
private

flag for auditors in "finalize()"

Definition at line 352 of file AlgTool.h.

bool AlgTool::m_auditorInitialize
private

flag for auditors in "initialize()"

Definition at line 349 of file AlgTool.h.

bool AlgTool::m_auditorReinitialize
private

flag for auditors in "reinitialize()"

Definition at line 353 of file AlgTool.h.

bool AlgTool::m_auditorRestart
private

flag for auditors in "restart()"

Definition at line 354 of file AlgTool.h.

bool AlgTool::m_auditorStart
private

flag for auditors in "start()"

Definition at line 350 of file AlgTool.h.

bool AlgTool::m_auditorStop
private

flag for auditors in "stop()"

Definition at line 351 of file AlgTool.h.

InterfaceList AlgTool::m_interfaceList
private

Interface list.

Definition at line 333 of file AlgTool.h.

IMessageSvc* AlgTool::m_messageSvc
mutableprivate

Message service.

Definition at line 328 of file AlgTool.h.

std::string AlgTool::m_monitorSvcName
private

Name to use for Monitor Service.

Definition at line 331 of file AlgTool.h.

const std::string AlgTool::m_name
private

AlgTool full name.

Definition at line 325 of file AlgTool.h.

IntegerProperty AlgTool::m_outputLevel
private

AlgTool output level.

Definition at line 323 of file AlgTool.h.

const IInterface* AlgTool::m_parent
private

AlgTool parent.

Definition at line 326 of file AlgTool.h.

IAuditorSvc* AlgTool::m_pAuditorSvc
mutableprivate

Auditor Service.

Definition at line 346 of file AlgTool.h.

IMonitorSvc* AlgTool::m_pMonitorSvc
mutableprivate

Online Monitoring Service.

Definition at line 330 of file AlgTool.h.

PropertyMgr* AlgTool::m_propertyMgr
private

Property Manager.

Definition at line 332 of file AlgTool.h.

IToolSvc* AlgTool::m_ptoolSvc
mutableprivate

Tool service.

Definition at line 329 of file AlgTool.h.

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

state of the Tool

Definition at line 356 of file AlgTool.h.

ISvcLocator* AlgTool::m_svcLocator
mutableprivate

Pointer to Service Locator service.

Definition at line 327 of file AlgTool.h.

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

state of the Tool

Definition at line 357 of file AlgTool.h.

std::string AlgTool::m_threadID
private

Thread Id for Alg Tool.

Definition at line 334 of file AlgTool.h.

std::string AlgTool::m_type
private

AlgTool type (concrete class name)

Definition at line 324 of file AlgTool.h.


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