Gaudi Framework, version v22r2

Home   Generated: Tue May 10 2011
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:
Inheritance graph
[legend]
Collaboration diagram for AlgTool:
Collaboration graph
[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::stringname () const
 Retrieve full identifying name of the concrete tool object.
virtual const std::stringtype () const
 Retrieve type (concrete class) of the sub-algtool.
virtual const IInterfaceparent () 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 PropertygetProperty (const std::string &name) const
virtual StatusCode getProperty (const std::string &n, std::string &v) const
virtual const std::vector
< Property * > & 
getProperties () const
PropertyMgrgetPropertyMgr ()
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.
ISvcLocatorserviceLocator () const
 Retrieve pointer to service locator.
ISvcLocatorsvcLoc () const
 shortcut for the method service locator
IMessageSvcmsgSvc () const
 Retrieve pointer to message service.
IToolSvctoolSvc () 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.
void declInterface (const InterfaceID &, void *)
 declare interface
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties.
IAuditorSvcauditorSvc () const
 Access the auditor service.
IMonitorSvcmonitorSvc () 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
IntegerPropertyoutputLevelProperty ()
 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 IInterfacem_parent
 AlgTool parent.
ISvcLocatorm_svcLocator
 Pointer to Service Locator service.
IMessageSvcm_messageSvc
 Message service.
IToolSvcm_ptoolSvc
 Tool service.
IMonitorSvcm_pMonitorSvc
 Online Monitoring Service.
std::string m_monitorSvcName
 Name to use for Monitor Service.
PropertyMgrm_propertyMgr
 Property Manager.
InterfaceList m_interfaceList
 Interface list.
std::string m_threadID
 Thread Id for Alg Tool.
IAuditorSvcm_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 35 of file AlgTool.h.


Member Typedef Documentation

Definition at line 313 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 181 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 571 of file AlgTool.cpp.


Member Function Documentation

IAuditorSvc * AlgTool::auditorSvc (  ) const

Access the auditor service.

Definition at line 602 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 52 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:
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 269 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:
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 284 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:
namethe property name
propertythe property itself,
docthe documentation string
Returns:
the actual property objects

Definition at line 226 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 234 of file AlgTool.h.

  {
    return m_propertyMgr-> declareRemoteProperty ( name , rsvc , rname ) ;
  }
void AlgTool::declInterface ( const InterfaceID iid,
void *  ii 
)

declare interface

Definition at line 45 of file AlgTool.cpp.

StatusCode AlgTool::finalize ( void   ) [virtual]
virtual Gaudi::StateMachine::State AlgTool::FSMState (  ) const [inline, virtual]

Definition at line 60 of file AlgTool.h.

{ return m_state; }
const std::vector< Property * > & AlgTool::getProperties (  ) const [virtual]

Definition at line 142 of file AlgTool.cpp.

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

Definition at line 129 of file AlgTool.cpp.

{
  return m_propertyMgr->getProperty(n);
}
StatusCode AlgTool::getProperty ( Property p ) const [virtual]

Definition at line 122 of file AlgTool.cpp.

{
  return m_propertyMgr->getProperty(p);
}
StatusCode AlgTool::getProperty ( const std::string n,
std::string v 
) const [virtual]

Definition at line 135 of file AlgTool.cpp.

{
  return m_propertyMgr->getProperty(n,v);
}
PropertyMgr* AlgTool::getPropertyMgr (  ) [inline]

Definition at line 90 of file AlgTool.h.

{ return m_propertyMgr; }
StatusCode AlgTool::initialize (  ) [virtual]

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

Definition at line 304 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 615 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:
NULLNo monitor service is present
non-NULLA monitor service is present and available to be used

Definition at line 253 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 81 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 53 of file AlgTool.cpp.

{
  return m_name;
}
int AlgTool::outputLevel (  ) const [inline, protected]

get tool's output level

Definition at line 297 of file AlgTool.h.

{ return (int)m_outputLevel ; }
IntegerProperty& AlgTool::outputLevelProperty (  ) [inline, protected]

Accessor for the Message level property.

Definition at line 300 of file AlgTool.h.

{ return m_outputLevel; }
const IInterface * AlgTool::parent (  ) const [virtual]

Retrieve parent of the sub-algtool.

Definition at line 67 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 >, and extends2< AlgTool, IDataStoreLeaves, IIncidentListener >.

Definition at line 20 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 484 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 551 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 174 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 181 of file AlgTool.h.

                                                                                   {
    return service_i(type, name, T::interfaceID(), (void**)&svc);
  }
StatusCode AlgTool::service_i ( const std::string algName,
bool  createIf,
const InterfaceID iid,
void **  ppSvc 
) const [private]

implementation of service method

Definition at line 583 of file AlgTool.cpp.

                                       {
  const ServiceLocatorHelper helper(*serviceLocator(), *this);
  return helper.getService(svcName, createIf, iid, ppSvc);
}
StatusCode AlgTool::service_i ( const std::string svcType,
const std::string svcName,
const InterfaceID iid,
void **  ppS 
) const [private]

Definition at line 593 of file AlgTool.cpp.

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

Retrieve pointer to service locator.

Definition at line 74 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 149 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 Property p ) [virtual]

Default implementations for IProperty interface.

Definition at line 101 of file AlgTool.cpp.

{
  return m_propertyMgr->setProperty(p);
}
StatusCode AlgTool::setProperty ( const std::string n,
const std::string v 
) [virtual]

Definition at line 115 of file AlgTool.cpp.

{
  return m_propertyMgr->setProperty(n,v);
}
StatusCode AlgTool::setProperty ( const std::string s ) [virtual]

Definition at line 108 of file AlgTool.cpp.

{
  return m_propertyMgr->setProperty(s);
}
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 ibelyaev@physics.syr.edu
Date:
2007-05-13

Definition at line 136 of file AlgTool.h.

  { return Gaudi::Utils::setProperty ( m_propertyMgr , name , value ) ; }
StatusCode AlgTool::start (  ) [virtual]

Definition at line 349 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 392 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 154 of file AlgTool.h.

{ return serviceLocator() ; }
StatusCode AlgTool::sysFinalize (  ) [virtual]

Finalize AlgTool.

Definition at line 400 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 269 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 443 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 509 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 314 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 357 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 61 of file AlgTool.h.

{ return m_targetState; }
virtual StatusCode AlgTool::terminate (  ) [inline, virtual]

Definition at line 57 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 88 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 60 of file AlgTool.cpp.

{
  return m_type;
}

Friends And Related Function Documentation

friend class ToolSvc [friend]

Definition at line 36 of file AlgTool.h.


Member Data Documentation

Definition at line 339 of file AlgTool.h.

flag for auditors in "finalize()"

Definition at line 343 of file AlgTool.h.

flag for auditors in "initialize()"

Definition at line 340 of file AlgTool.h.

flag for auditors in "reinitialize()"

Definition at line 344 of file AlgTool.h.

bool AlgTool::m_auditorRestart [private]

flag for auditors in "restart()"

Definition at line 345 of file AlgTool.h.

bool AlgTool::m_auditorStart [private]

flag for auditors in "start()"

Definition at line 341 of file AlgTool.h.

bool AlgTool::m_auditorStop [private]

flag for auditors in "stop()"

Definition at line 342 of file AlgTool.h.

Interface list.

Definition at line 324 of file AlgTool.h.

IMessageSvc* AlgTool::m_messageSvc [mutable, private]

Message service.

Definition at line 319 of file AlgTool.h.

Name to use for Monitor Service.

Definition at line 322 of file AlgTool.h.

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

AlgTool full name.

Definition at line 316 of file AlgTool.h.

AlgTool output level.

Definition at line 314 of file AlgTool.h.

const IInterface* AlgTool::m_parent [private]

AlgTool parent.

Definition at line 317 of file AlgTool.h.

IAuditorSvc* AlgTool::m_pAuditorSvc [mutable, private]

Auditor Service.

Definition at line 337 of file AlgTool.h.

IMonitorSvc* AlgTool::m_pMonitorSvc [mutable, private]

Online Monitoring Service.

Definition at line 321 of file AlgTool.h.

Property Manager.

Definition at line 323 of file AlgTool.h.

IToolSvc* AlgTool::m_ptoolSvc [mutable, private]

Tool service.

Definition at line 320 of file AlgTool.h.

state of the Tool

Definition at line 347 of file AlgTool.h.

ISvcLocator* AlgTool::m_svcLocator [mutable, private]

Pointer to Service Locator service.

Definition at line 318 of file AlgTool.h.

state of the Tool

Definition at line 348 of file AlgTool.h.

Thread Id for Alg Tool.

Definition at line 325 of file AlgTool.h.

AlgTool type (concrete class name)

Reimplemented in EqSolver, and FuncMinimum.

Definition at line 315 of file AlgTool.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Tue May 10 2011 18:54:34 for Gaudi Framework, version v22r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004