| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 2012

Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends

# AlgTool Class Reference

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

`#include <GaudiKernel/AlgTool.h>`

Inheritance diagram for AlgTool:
[legend]
Collaboration diagram for AlgTool:
[legend]

List of all members.

## Classes
class | declareInterface
## Public Member Functions
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvUnknown)
| Query for a given interface.
virtual const std::string & | name () const
| Retrieve full identifying name of the concrete tool object.
virtual const std::string & | type () const
| Retrieve type (concrete class) of the sub-algtool.
virtual const IInterface * | parent () const
| Retrieve parent of the sub-algtool.
virtual StatusCode | configure ()
virtual StatusCode | initialize ()
virtual StatusCode | start ()
virtual StatusCode | stop ()
virtual StatusCode | finalize ()
virtual StatusCode | terminate ()
virtual StatusCode | reinitialize ()
virtual StatusCode | restart ()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | sysInitialize ()
| Initialize AlgTool.
virtual StatusCode | sysStart ()
| Start AlgTool.
virtual StatusCode | sysStop ()
| Stop AlgTool.
virtual StatusCode | sysFinalize ()
| Finalize AlgTool.
virtual StatusCode | sysReinitialize ()
| Initialize AlgTool.
virtual StatusCode | sysRestart ()
| Start AlgTool.
virtual StatusCode | setProperty (const Property &p)
| Default implementations for IProperty interface.
virtual StatusCode | setProperty (const std::string &s)
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
virtual StatusCode | getProperty (Property *p) const
virtual const Property & | getProperty (const std::string &name) const
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
virtual const std::vector < Property * > & | getProperties () const
PropertyMgr * | getPropertyMgr ()
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
| AlgTool (const std::string &type, const std::string &name, const IInterface *parent)
| Standard Constructor.
ISvcLocator * | serviceLocator () const
| Retrieve pointer to service locator.
ISvcLocator * | svcLoc () const
| shortcut for the method service locator
IMessageSvc * | msgSvc () const
| Retrieve pointer to message service.
IToolSvc * | toolSvc () const
| The standard ToolSvc service, Return a pointer to the service if present.
StatusCode | setProperties ()
| Method for setting declared properties to the values specified in the jobOptions via the job option service.
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.
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.
SmartIF< IService > | 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")
void | declInterface (const InterfaceID &, void *)
| declare interface
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
IAuditorSvc * | auditorSvc () const
| Access the auditor service.
IMonitorSvc * | monitorSvc () const
| Access the monitor service.
template<class T >
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const
| Declare monitoring information.
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)
## Protected Member Functions
int | outputLevel () const
| get tool's output level
IntegerProperty & | outputLevelProperty ()
| Accessor for the Message level property.
void | initOutputLevel (Property &prop)
| callback for output level property
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
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.
std::string | m_type
| AlgTool type (concrete class name)
const std::string | m_name
| AlgTool full name.
const IInterface * | m_parent
| AlgTool parent.
ISvcLocator * | m_svcLocator
| Pointer to Service Locator service.
IMessageSvc * | m_messageSvc
| Message service.
IToolSvc * | m_ptoolSvc
| Tool service.
IMonitorSvc * | m_pMonitorSvc
| Online Monitoring Service.
std::string | m_monitorSvcName
| Name to use for Monitor Service.
PropertyMgr * | m_propertyMgr
| Property Manager.
InterfaceList | m_interfaceList
| Interface list.
std::string | m_threadID
| Thread Id for Alg Tool.
IAuditorSvc * | m_pAuditorSvc
| Auditor Service.
BooleanProperty | m_auditInit
bool | m_auditorInitialize
| flag for auditors in "initialize()"
bool | m_auditorStart
| flag for auditors in "start()"
bool | m_auditorStop
| flag for auditors in "stop()"
bool | m_auditorFinalize
| flag for auditors in "finalize()"
bool | m_auditorReinitialize
| flag for auditors in "reinitialize()"
bool | m_auditorRestart
| flag for auditors in "restart()"
Gaudi::StateMachine::State | m_state
| state of the Tool
Gaudi::StateMachine::State | m_targetState
| state of the Tool
## Friends
class | ToolSvc

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

## Member Typedef Documentation

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

Definition at line 314 of file AlgTool.h.

## Constructor & Destructor Documentation

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

Standard Constructor.

Parameters:

  type | the concrete class of the sub-algtool
  name | the full name of the concrete sub-algtool
  parent | the parent of the concrete sub-algtool

Definition at line 179 of file AlgTool.cpp.

      : m_outputLevel ( MSG::NIL )
      , m_type          ( type )
      , m_name          ( name )
      , m_parent        ( parent )
      , m_svcLocator    ( 0 )
      , m_messageSvc    ( 0 )
      , m_ptoolSvc      ( 0 )
      , m_pMonitorSvc   ( NULL )
      , m_propertyMgr   ( new PropertyMgr() )
      , m_interfaceList (       )
      , m_threadID      (       )
      , m_pAuditorSvc   ( 0     )
      , m_auditInit     ( false )
      , m_state         ( Gaudi::StateMachine::CONFIGURED )
      , m_targetState   ( Gaudi::StateMachine::CONFIGURED )
    {
      addRef(); // Initial count set to 1

      declareProperty( "MonitorService", m_monitorSvcName = "MonitorSvc" );

      { // get the "OutputLevel" property from parent
        const Property* _p = Gaudi::Utils::getProperty ( parent , "OutputLevel") ;
        if ( 0 != _p ) { m_outputLevel.assign( *_p ) ; }
        declareProperty ( "OutputLevel"     , m_outputLevel ) ;
         m_outputLevel.declareUpdateHandler(&AlgTool::initOutputLevel, this);
      }

      IInterface* _p = const_cast<IInterface*> ( parent ) ;

      if      ( Algorithm* _alg = dynamic_cast<Algorithm*> ( _p ) )
      {
        m_svcLocator  = _alg -> serviceLocator  () ;
        m_messageSvc  = _alg -> msgSvc          () ;
        m_threadID    = getGaudiThreadIDfromName ( _alg -> name() ) ;
      }
      else if ( Service*   _svc = dynamic_cast<Service*>  ( _p ) )
      {
        m_svcLocator  = _svc -> serviceLocator () ;
        m_messageSvc  = _svc -> msgSvc         () ;
        m_threadID    = getGaudiThreadIDfromName ( _svc -> name() ) ;
      }
      else if ( AlgTool*   _too = dynamic_cast<AlgTool*>  ( _p ) )
      {
        m_svcLocator  = _too -> m_svcLocator;
        m_messageSvc  = _too -> m_messageSvc;
        m_threadID    = getGaudiThreadIDfromName ( _too ->m_threadID ) ;
      }
      else if ( Auditor*   _aud = dynamic_cast<Auditor*>  ( _p ) )
      {
        m_svcLocator  = _aud -> serviceLocator() ;
        m_messageSvc  = _aud -> msgSvc()         ;
        m_threadID    = getGaudiThreadIDfromName ( _aud -> name() )    ;
      }
      else
      {
        throw GaudiException
          ( "Failure to create tool '"
            + type + "/" + name + "': illegal parent type '"
            + System::typeinfoName(typeid(*_p)) + "'", "AlgTool", 0 );
      }

      { // audit tools
        SmartIF<IProperty> appMgr(m_svcLocator->service("ApplicationMgr"));
        if ( !appMgr.isValid() ) {
          throw GaudiException("Could not locate ApplicationMgr","AlgTool",0);
        }
        const Property* p = Gaudi::Utils::getProperty( appMgr , "AuditTools");
        if ( 0 != p ) { m_auditInit.assign ( *p ) ; }
        declareProperty ( "AuditTools", m_auditInit );
        bool audit = m_auditInit.value();
        // Declare common AlgTool properties with their defaults
        declareProperty ( "AuditInitialize" , m_auditorInitialize = audit ) ;
        declareProperty ( "AuditStart"      , m_auditorStart      = audit ) ;
        declareProperty ( "AuditStop"       , m_auditorStop       = audit ) ;
        declareProperty ( "AuditFinalize"   , m_auditorFinalize   = audit ) ;
      }

      // check thread ID and try if tool name indicates thread ID
      if ( m_threadID.empty() )
      { m_threadID = getGaudiThreadIDfromName ( AlgTool::name() ) ; }
    }

AlgTool::~AlgTool | ( | ) | `[protected, virtual]`

Definition at line 569 of file AlgTool.cpp.

    {
      delete m_propertyMgr;
      if( m_ptoolSvc ) m_ptoolSvc->release();
      if( m_pAuditorSvc ) m_pAuditorSvc->release();
      if ( m_pMonitorSvc ) { m_pMonitorSvc->undeclareAll(this); m_pMonitorSvc->release(); }
    }

## Member Function Documentation

IAuditorSvc * AlgTool::auditorSvc | ( | ) | const

Access the auditor service.

Definition at line 605 of file AlgTool.cpp.

                                           {
    //---------------------------------------------------------------------------
      if ( 0 == m_pAuditorSvc ) {
        StatusCode sc = service( "AuditorSvc", m_pAuditorSvc, true );
        if( sc.isFailure() ) {
          throw GaudiException("Service [AuditorSvc] not found", name(), sc);
        }
      }
      return m_pAuditorSvc;
    }

virtual StatusCode AlgTool::configure | ( | ) | `[inline, virtual]`

Definition at line 50 of file AlgTool.h.

    { return StatusCode::SUCCESS; }

template<class T >

void AlgTool::declareInfo | ( | const std::string & | name,
|  | const T & | var,
|  | const std::string & | desc
| ) |  | const`[inline]`

Declare monitoring information.

Parameters:

  name | Monitoring information name known to the external system
  var | Monitoring Listener address (the item to monitor...)
  desc | Textual description of the information being monitored

Definition at line 270 of file AlgTool.h.

      {
        IMonitorSvc* mS = monitorSvc();
        if ( mS ) mS->declareInfo(name, var, desc, this);
      }

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:

  name | Monitoring information name known to the external system
  format | Format information
  var | Monitoring Listener address
  size | Monitoring Listener address size
  desc | Textual description of the information being monitored

Definition at line 285 of file AlgTool.h.

      {
        IMonitorSvc* mS = monitorSvc();
        if ( mS ) mS->declareInfo(name, format, var, size, desc, this);
      }

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 fro property #1" ) ;

         // declare the property and attach the handler  to it
         declareProperty( "Property2" , m_property2 , "Doc for property #2" )
            -> declareUpdateHandler( &MyAlg::handler_2 ) ;

       }

See also:
  PropertyMgr
  PropertyMgr::declareProperty

Parameters:

  name | the property name
  property | the property itself,
  doc | the documentation string

Returns:
  the actual property objects

Definition at line 227 of file AlgTool.h.

      {
        return m_propertyMgr -> declareProperty ( name , property , doc ) ;
      }

Property* AlgTool::declareRemoteProperty | ( | const std::string & | name,
|  | IProperty * | rsvc,
|  | const std::string & | rname = `""`
| ) |  | const`[inline]`

Declare remote named properties.

Definition at line 235 of file AlgTool.h.

      {
        return m_propertyMgr-> declareRemoteProperty ( name , rsvc , rname ) ;
      }

void AlgTool::declInterface | ( | const InterfaceID & | iid,
|  | void * | ii
| ) |  |

declare interface

Definition at line 43 of file AlgTool.cpp.

    {
      m_interfaceList.push_back(std::make_pair(iid, ii));
    }

StatusCode AlgTool::finalize | ( | void | ) | `[virtual]`

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

Definition at line 433 of file AlgTool.cpp.

    {
      // For the time being there is nothing to be done here.
      return StatusCode::SUCCESS;
    }

virtual Gaudi::StateMachine::State AlgTool::FSMState | ( | ) | const`[inline, virtual]`

Definition at line 58 of file AlgTool.h.

    { return m_state; }

const std::vector< Property * > & AlgTool::getProperties | ( | ) | const`[virtual]`

Definition at line 140 of file AlgTool.cpp.

    {
      return m_propertyMgr->getProperties();
    }

const Property & AlgTool::getProperty | ( | const std::string & | name ) | const`[virtual]`

Definition at line 127 of file AlgTool.cpp.

    {
      return m_propertyMgr->getProperty(n);
    }

StatusCode AlgTool::getProperty | ( | Property * | p ) | const`[virtual]`

Definition at line 120 of file AlgTool.cpp.

    {
      return m_propertyMgr->getProperty(p);
    }

StatusCode AlgTool::getProperty | ( | const std::string & | n,
|  | std::string & | v
| ) |  | const`[virtual]`

Definition at line 133 of file AlgTool.cpp.

    {
      return m_propertyMgr->getProperty(n,v);
    }

PropertyMgr* AlgTool::getPropertyMgr | ( | ) | `[inline]`

Definition at line 88 of file AlgTool.h.

    { return m_propertyMgr; }

StatusCode AlgTool::initialize | ( | void | ) | `[virtual]`

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

Definition at line 302 of file AlgTool.cpp.

    {
      // For the time being there is nothing to be done here.
      // Setting the properties is done by the ToolSvc calling setProperties()
      // explicitly.
      return StatusCode::SUCCESS;
    }

void AlgTool::initOutputLevel | ( | Property & | prop ) | `[protected]`

callback for output level property

Definition at line 618 of file AlgTool.cpp.

                                                     {
    //-----------------------------------------------------------------------------
       // do nothing... yet ?
    }

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:

  NULL | No monitor service is present
  non-NULL | A monitor service is present and available to be used

Definition at line 254 of file AlgTool.h.

      {
        // If not already located try to locate it without forcing a creation
        if ( !m_pMonitorSvc ){
          service_i( m_monitorSvcName, false,
                     IMonitorSvc::interfaceID(), pp_cast<void>(&m_pMonitorSvc) ).ignore();
        }
        return m_pMonitorSvc;
      }

IMessageSvc * AlgTool::msgSvc | ( | ) | const

Retrieve pointer to message service.

Definition at line 79 of file AlgTool.cpp.

    {
      return m_messageSvc;
    }

const std::string & AlgTool::name | ( | ) | const`[virtual]`

Retrieve full identifying name of the concrete tool object.

Definition at line 51 of file AlgTool.cpp.

    {
      return m_name;
    }

int AlgTool::outputLevel | ( | ) | const`[inline, protected]`

get tool's output level

Definition at line 298 of file AlgTool.h.

    { return (int)m_outputLevel ; }

IntegerProperty& AlgTool::outputLevelProperty | ( | ) | `[inline, protected]`

Accessor for the Message level property.

Definition at line 301 of file AlgTool.h.

    { return m_outputLevel; }

const IInterface * AlgTool::parent | ( | ) | const`[virtual]`

Retrieve parent of the sub-algtool.

Definition at line 65 of file AlgTool.cpp.

    {
      return m_parent;
    }

StatusCode AlgTool::queryInterface | ( | const InterfaceID & | riid,
|  | void ** | ppvUnknown
| ) |  | `[virtual]`

Query for a given interface.

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

Definition at line 18 of file AlgTool.cpp.

    {
      if ( 0 == ppvi ) { return StatusCode::FAILURE ; } // RETURN
      StatusCode sc = base_class::queryInterface(riid,ppvi);
      if (sc.isSuccess()) {
        return sc;
      }
      else {
        for ( InterfaceList::iterator it = m_interfaceList.begin() ;
              m_interfaceList.end() != it ; ++it )
        {
          if ( !it->first.versionMatch ( riid ) ) { continue ; }
          // OK
          *ppvi = it->second ;
          addRef() ;
          return SUCCESS ;     // RETURN
        }
        *ppvi = 0 ;
        return NO_INTERFACE ;  // RETURN
      }
      // cannot reach this point
    }

StatusCode AlgTool::reinitialize | ( | ) | `[virtual]`

Definition at line 482 of file AlgTool.cpp.

    {
      /* @TODO
       * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize
       *                 is causing too many problems
       *
      // Default implementation is finalize+initialize
      StatusCode sc = finalize();
      if (sc.isFailure()) {
        MsgStream log ( msgSvc() , name() );
        log << MSG::ERROR << "reinitialize(): cannot be finalized" << endmsg;
        return sc;
      }
      sc = initialize();
      if (sc.isFailure()) {
        MsgStream log ( msgSvc() , name() );
        log << MSG::ERROR << "reinitialize(): cannot be initialized" << endmsg;
        return sc;
      }
      */
      return StatusCode::SUCCESS;
    }

StatusCode AlgTool::restart | ( | ) | `[virtual]`

Definition at line 549 of file AlgTool.cpp.

    {
      // Default implementation is stop+start
      StatusCode sc = stop();
      if (sc.isFailure()) {
        MsgStream log ( msgSvc() , name() );
        log << MSG::ERROR << "restart(): cannot be stopped" << endmsg;
        return sc;
      }
      sc = start();
      if (sc.isFailure()) {
        MsgStream log ( msgSvc() , name() );
        log << MSG::ERROR << "restart(): cannot be started" << endmsg;
        return sc;
      }
      return StatusCode::SUCCESS;
    }

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

                                                                     {
        return service_i(name, createIf, T::interfaceID(), (void**)&svc);
      }

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

                                                                                       {
        return service_i(type, name, T::interfaceID(), (void**)&svc);
      }

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 599 of file AlgTool.cpp.

                                                                                                         {
      const ServiceLocatorHelper helper(*serviceLocator(), *this);
      return helper.service(name, quiet, createIf);
    }

StatusCode AlgTool::service_i | ( | const std::string & | svcType,
|  | const std::string & | svcName,
|  | const InterfaceID & | iid,
|  | void ** | ppS
| ) |  | const`[private]`

Definition at line 591 of file AlgTool.cpp.

                                           {
      const ServiceLocatorHelper helper(*serviceLocator(), *this);
      return  helper.createService(svcType, svcName, iid, ppSvc);
    }

StatusCode AlgTool::service_i | ( | const std::string & | algName,
|  | bool | createIf,
|  | const InterfaceID & | iid,
|  | void ** | ppSvc
| ) |  | const`[private]`

implementation of service method

Definition at line 581 of file AlgTool.cpp.

                                           {
      const ServiceLocatorHelper helper(*serviceLocator(), *this);
      return helper.getService(svcName, createIf, iid, ppSvc);
    }

ISvcLocator * AlgTool::serviceLocator | ( | ) | const

Retrieve pointer to service locator.

Definition at line 72 of file AlgTool.cpp.

    {
      return m_svcLocator;
    }

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.

    {
      if( m_svcLocator == 0) {
        return StatusCode::FAILURE;
      }
      SmartIF<IJobOptionsSvc> jos(m_svcLocator->service("JobOptionsSvc"));
      if( !jos.isValid() )  return StatusCode::FAILURE;

      // set first generic Properties
      StatusCode sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this );
      if( sc.isFailure() ) return StatusCode::FAILURE;

      // set specific Properties
      if (isGaudiThreaded(name())) {
        if(jos->setMyProperties( name(), this ).isFailure()) {
          return StatusCode::FAILURE;
        }
      }

      // Change my own outputlevel
      if ( 0 != m_messageSvc )
      {
        if ( MSG::NIL != m_outputLevel )
        { m_messageSvc -> setOutputLevel ( name () , m_outputLevel ) ; }
        m_outputLevel = m_messageSvc -> outputLevel ( name () ) ;
      }

      return StatusCode::SUCCESS;
    }

StatusCode AlgTool::setProperty | ( | const std::string & | s ) | `[virtual]`

Definition at line 106 of file AlgTool.cpp.

    {
      return m_propertyMgr->setProperty(s);
    }

StatusCode AlgTool::setProperty | ( | const Property & | p ) | `[virtual]`

Default implementations for IProperty interface.

Definition at line 99 of file AlgTool.cpp.

    {
      return m_propertyMgr->setProperty(p);
    }

StatusCode AlgTool::setProperty | ( | const std::string & | n,
|  | const std::string & | v
| ) |  | `[virtual]`

Definition at line 113 of file AlgTool.cpp.

    {
      return m_propertyMgr->setProperty(n,v);
    }

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:

  name | name of the property
  value | value of the property

See also:
  Gaudi::Utils::setProperty

Author:
  Vanya BELYAEV ibelyaev@physics.syr.edu

Date:
  2007-05-13

Definition at line 134 of file AlgTool.h.

      { return Gaudi::Utils::setProperty ( m_propertyMgr , name , value ) ; }

StatusCode AlgTool::start | ( | ) | `[virtual]`

Definition at line 347 of file AlgTool.cpp.

    {
      // For the time being there is nothing to be done here.
      return StatusCode::SUCCESS;
    }

StatusCode AlgTool::stop | ( | ) | `[virtual]`

Definition at line 390 of file AlgTool.cpp.

    {
      // For the time being there is nothing to be done here.
      return StatusCode::SUCCESS;
    }

ISvcLocator* AlgTool::svcLoc | ( | ) | const`[inline]`

shortcut for the method service locator

Definition at line 152 of file AlgTool.h.

    { return serviceLocator() ; }

StatusCode AlgTool::sysFinalize | ( | ) | `[virtual]`

Finalize AlgTool.

Definition at line 398 of file AlgTool.cpp.

                                    {
      //-----------------------------------------------------------------------------

      StatusCode sc;

      try {
        m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::FINALIZE,m_state);
        Gaudi::Guards::AuditorGuard guard(this,
                                          // check if we want to audit the initialize
                                          (m_auditorFinalize) ? auditorSvc() : 0,
                                          IAuditor::Finalize);
        sc = finalize();
        if (sc.isSuccess())
          m_state = m_targetState;
        return sc;
      }
      catch( const GaudiException& Exception ) {
        MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
        log << MSG::FATAL << " Exception with tag=" << Exception.tag()
            << " is caught " << endmsg;
        log << MSG::ERROR << Exception  << endmsg;
      }
      catch( const std::exception& Exception ) {
        MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
        log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
        log << MSG::ERROR << Exception.what()  << endmsg;
      }
      catch( ... ) {
        MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
        log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
      }
      return StatusCode::FAILURE;

    }

StatusCode AlgTool::sysInitialize | ( | ) | `[virtual]`

Initialize AlgTool.

Definition at line 267 of file AlgTool.cpp.

                                      {
      //-----------------------------------------------------------------------------
      StatusCode sc;

      try {
        m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::INITIALIZE,m_state);
        Gaudi::Guards::AuditorGuard guard(this,
                                          // check if we want to audit the initialize
                                          (m_auditorInitialize) ? auditorSvc() : 0,
                                          IAuditor::Initialize);
        sc = initialize();
        if (sc.isSuccess())
          m_state = m_targetState;
        return sc;
      }
      catch( const GaudiException& Exception ) {
        MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
        log << MSG::FATAL << " Exception with tag=" << Exception.tag()
            << " is caught " << endmsg;
        log << MSG::ERROR << Exception  << endmsg;
      }
      catch( const std::exception& Exception ) {
        MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
        log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
        log << MSG::ERROR << Exception.what()  << endmsg;
      }
      catch( ... ) {
        MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
        log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
      }
      return StatusCode::FAILURE ;

    }

StatusCode AlgTool::sysReinitialize | ( | ) | `[virtual]`

Initialize AlgTool.

Definition at line 441 of file AlgTool.cpp.

                                        {
      //-----------------------------------------------------------------------------
      StatusCode sc;

      // Check that the current status is the correct one.
      if ( Gaudi::StateMachine::INITIALIZED != FSMState() ) {
        MsgStream log ( msgSvc() , name() );
        log << MSG::ERROR
            << "sysReinitialize(): cannot reinitialize tool not initialized"
            << endmsg;
        return StatusCode::FAILURE;
      }

      try {
        Gaudi::Guards::AuditorGuard guard(this,
                                          // check if we want to audit the initialize
                                          (m_auditorReinitialize) ? auditorSvc() : 0,
                                          IAuditor::ReInitialize);
        sc = reinitialize();
        return sc;
      }
      catch( const GaudiException& Exception ) {
        MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
        log << MSG::FATAL << " Exception with tag=" << Exception.tag()
            << " is caught" << endmsg;
        log << MSG::ERROR << Exception  << endmsg;
      }
      catch( const std::exception& Exception ) {
        MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
        log << MSG::FATAL << " Standard std::exception is caught" << endmsg;
        log << MSG::ERROR << Exception.what()  << endmsg;
      }
      catch( ... ) {
        MsgStream log ( msgSvc() , name() + ".sysReinitialize()" );
        log << MSG::FATAL << "UNKNOWN Exception is caught" << endmsg;
      }
      return StatusCode::FAILURE ;

    }

StatusCode AlgTool::sysRestart | ( | ) | `[virtual]`

Start AlgTool.

Definition at line 507 of file AlgTool.cpp.

                                   {
      //-----------------------------------------------------------------------------
      StatusCode sc;

      // Check that the current status is the correct one.
      if ( Gaudi::StateMachine::RUNNING != FSMState() ) {
        MsgStream log ( msgSvc() , name() );
        log << MSG::ERROR
            << "sysRestart(): cannot reinitialize tool not started"
            << endmsg;
        return StatusCode::FAILURE;
      }

      try {
        m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state);
        Gaudi::Guards::AuditorGuard guard(this,
                                          // check if we want to audit the initialize
                                          (m_auditorRestart) ? auditorSvc() : 0,
                                          IAuditor::ReStart);
        sc = restart();
        return sc;
      }
      catch( const GaudiException& Exception ) {
        MsgStream log ( msgSvc() , name() + ".sysRestart()" );
        log << MSG::FATAL << " Exception with tag=" << Exception.tag()
            << " is caught" << endmsg;
        log << MSG::ERROR << Exception  << endmsg;
      }
      catch( const std::exception& Exception ) {
        MsgStream log ( msgSvc() , name() + ".sysRestart()" );
        log << MSG::FATAL << " Standard std::exception is caught" << endmsg;
        log << MSG::ERROR << Exception.what()  << endmsg;
      }
      catch( ... ) {
        MsgStream log ( msgSvc() , name() + ".sysRestart()" );
        log << MSG::FATAL << "UNKNOWN Exception is caught" << endmsg;
      }
      return StatusCode::FAILURE ;

    }

StatusCode AlgTool::sysStart | ( | ) | `[virtual]`

Start AlgTool.

Definition at line 312 of file AlgTool.cpp.

                                 {
      //-----------------------------------------------------------------------------
      StatusCode sc;

      try {
        m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state);
        Gaudi::Guards::AuditorGuard guard(this,
                                          // check if we want to audit the initialize
                                          (m_auditorStart) ? auditorSvc() : 0,
                                          IAuditor::Start);
        sc = start();
        if (sc.isSuccess())
          m_state = m_targetState;
        return sc;
      }
      catch( const GaudiException& Exception ) {
        MsgStream log ( msgSvc() , name() + ".sysStart()" );
        log << MSG::FATAL << " Exception with tag=" << Exception.tag()
            << " is caught " << endmsg;
        log << MSG::ERROR << Exception  << endmsg;
      }
      catch( const std::exception& Exception ) {
        MsgStream log ( msgSvc() , name() + ".sysStart()" );
        log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
        log << MSG::ERROR << Exception.what()  << endmsg;
      }
      catch( ... ) {
        MsgStream log ( msgSvc() , name() + ".sysStart()" );
        log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
      }
      return StatusCode::FAILURE ;

    }

StatusCode AlgTool::sysStop | ( | ) | `[virtual]`

Stop AlgTool.

Definition at line 355 of file AlgTool.cpp.

                                {
      //-----------------------------------------------------------------------------
      StatusCode sc;

      try {
        m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::STOP,m_state);
        Gaudi::Guards::AuditorGuard guard(this,
                                          // check if we want to audit the initialize
                                          (m_auditorStop) ? auditorSvc() : 0,
                                          IAuditor::Stop);
        sc = stop();
        if (sc.isSuccess())
          m_state = m_targetState;
        return sc;
      }
      catch( const GaudiException& Exception ) {
        MsgStream log ( msgSvc() , name() + ".sysStop()" );
        log << MSG::FATAL << " Exception with tag=" << Exception.tag()
            << " is caught " << endmsg;
        log << MSG::ERROR << Exception  << endmsg;
      }
      catch( const std::exception& Exception ) {
        MsgStream log ( msgSvc() , name() + ".sysStop()" );
        log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
        log << MSG::ERROR << Exception.what()  << endmsg;
      }
      catch( ... ) {
        MsgStream log ( msgSvc() , name() + ".sysStop()" );
        log << MSG::FATAL << "UNKNOWN Exception is caught " << endmsg;
      }
      return StatusCode::FAILURE ;

    }

virtual Gaudi::StateMachine::State AlgTool::targetFSMState | ( | ) | const`[inline, virtual]`

Definition at line 59 of file AlgTool.h.

    { return m_targetState; }

virtual StatusCode AlgTool::terminate | ( | ) | `[inline, virtual]`

Definition at line 55 of file AlgTool.h.

    { return StatusCode::SUCCESS; }

IToolSvc * AlgTool::toolSvc | ( | ) | const

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

Definition at line 86 of file AlgTool.cpp.

    {
      if ( 0 == m_ptoolSvc ) {
        StatusCode sc = service( "ToolSvc", m_ptoolSvc, true );
        if( sc.isFailure() ) {
          throw GaudiException("Service [ToolSvc] not found", name(), sc);
        }
      }
      return m_ptoolSvc;
    }

const std::string & AlgTool::type | ( | ) | const`[virtual]`

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

Definition at line 58 of file AlgTool.cpp.

    {
      return m_type;
    }

## Friends And Related Function Documentation

friend class ToolSvc`[friend]`

Definition at line 34 of file AlgTool.h.

## Member Data Documentation

BooleanProperty AlgTool::m_auditInit`[private]`

Definition at line 340 of file AlgTool.h.

bool AlgTool::m_auditorFinalize`[private]`

flag for auditors in "finalize()"

Definition at line 344 of file AlgTool.h.

bool AlgTool::m_auditorInitialize`[private]`

flag for auditors in "initialize()"

Definition at line 341 of file AlgTool.h.

bool AlgTool::m_auditorReinitialize`[private]`

flag for auditors in "reinitialize()"

Definition at line 345 of file AlgTool.h.

bool AlgTool::m_auditorRestart`[private]`

flag for auditors in "restart()"

Definition at line 346 of file AlgTool.h.

bool AlgTool::m_auditorStart`[private]`

flag for auditors in "start()"

Definition at line 342 of file AlgTool.h.

bool AlgTool::m_auditorStop`[private]`

flag for auditors in "stop()"

Definition at line 343 of file AlgTool.h.

InterfaceList AlgTool::m_interfaceList`[private]`

Interface list.

Definition at line 325 of file AlgTool.h.

IMessageSvc* AlgTool::m_messageSvc`[mutable, private]`

Message service.

Definition at line 320 of file AlgTool.h.

std::string AlgTool::m_monitorSvcName`[private]`

Name to use for Monitor Service.

Definition at line 323 of file AlgTool.h.

const std::string AlgTool::m_name`[private]`

AlgTool full name.

Definition at line 317 of file AlgTool.h.

IntegerProperty AlgTool::m_outputLevel`[private]`

AlgTool output level.

Definition at line 315 of file AlgTool.h.

const IInterface* AlgTool::m_parent`[private]`

AlgTool parent.

Definition at line 318 of file AlgTool.h.

IAuditorSvc* AlgTool::m_pAuditorSvc`[mutable, private]`

Auditor Service.

Definition at line 338 of file AlgTool.h.

IMonitorSvc* AlgTool::m_pMonitorSvc`[mutable, private]`

Online Monitoring Service.

Definition at line 322 of file AlgTool.h.

PropertyMgr* AlgTool::m_propertyMgr`[private]`

Property Manager.

Definition at line 324 of file AlgTool.h.

IToolSvc* AlgTool::m_ptoolSvc`[mutable, private]`

Tool service.

Definition at line 321 of file AlgTool.h.

Gaudi::StateMachine::State AlgTool::m_state`[private]`

state of the Tool

Definition at line 348 of file AlgTool.h.

ISvcLocator* AlgTool::m_svcLocator`[mutable, private]`

Pointer to Service Locator service.

Definition at line 319 of file AlgTool.h.

Gaudi::StateMachine::State AlgTool::m_targetState`[private]`

state of the Tool

Definition at line 349 of file AlgTool.h.

std::string AlgTool::m_threadID`[private]`

Thread Id for Alg Tool.

Definition at line 326 of file AlgTool.h.

std::string AlgTool::m_type`[private]`

AlgTool type (concrete class name)

Reimplemented in EqSolver, and FuncMinimum.

Definition at line 316 of file AlgTool.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r1/GaudiKernel/GaudiKernel/AlgTool.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r1/GaudiKernel/src/Lib/AlgTool.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines