| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

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.

Public Types

 SUCCESS = 1
 Normal successful completion.
 NO_INTERFACE
 Requested interface is not available.
 VERSMISMATCH
 Requested interface version is incompatible.
 LAST_ERROR
 Last error.
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...

Public Member Functions

virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 Query for a given interface.
virtual unsigned long addRef ()
 Reference Interface instance.
virtual unsigned long release ()
 Release Interface instance.
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 IInterfaceparent () const
 Retrieve parent of the sub-algtool.
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED).
virtual StatusCode initialize ()
 Initialization (from CONFIGURED to INITIALIZED).
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING).
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED).
virtual StatusCode finalize ()
 Finalize (from INITIALIZED to CONFIGURED).
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE).
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED).
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state.
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us.
virtual StatusCode 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)
 Set the property by string.
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string.
virtual StatusCode getProperty (Property *p) const
 Get the property by property.
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name.
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string.
virtual const std::vector<
Property * > & 
getProperties () const
 Get list of properties.
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 methos 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).

Static Public Member Functions

static const InterfaceIDinterfaceID ()
 Retrieve interface ID.
static const InterfaceIDinterfaceID ()
 Retrieve interface ID.
static const InterfaceIDinterfaceID ()
 Retrieve interface ID.

Protected Member Functions

int outputLevel () const
 get tool's output level
virtual unsigned long refCount () const
 Current number of refCounts.
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.
unsigned long m_refCount
 Reference counter.
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

Classes

class  declareInterface

Detailed Description

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

Specific methods for doing something usefull should be implemented in the concrete tools. Sub-types of this class could implement an additional interface for behaviour 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

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

Definition at line 327 of file AlgTool.h.


Member Enumeration Documentation

enum IInterface::Status [inherited]

Return status.

Enumerator:
SUCCESS  Normal successful completion.
NO_INTERFACE  Requested interface is not available.
VERSMISMATCH  Requested interface version is incompatible.
LAST_ERROR  Last error.

Reimplemented in IConversionSvc, IConverter, and IDataProviderSvc.

Definition at line 113 of file IInterface.h.

00113                 {
00115     SUCCESS = 1,
00117     NO_INTERFACE,
00119     VERSMISMATCH,
00121     LAST_ERROR
00122   };


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

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


Member Function Documentation

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

Query for a given interface.

Implements IInterface.

virtual unsigned long AlgTool::addRef (  )  [virtual]

Reference Interface instance.

Implements IInterface.

virtual unsigned long AlgTool::release (  )  [virtual]

Release Interface instance.

Implements IInterface.

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

Retrieve full identifying name of the concrete tool object.

Implements INamedInterface.

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

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

Implements IAlgTool.

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

Retrieve parent of the sub-algtool.

Implements IAlgTool.

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

Configuration (from OFFLINE to CONFIGURED).

Implements IAlgTool.

Definition at line 60 of file AlgTool.h.

00060 { return StatusCode::SUCCESS; }

virtual StatusCode AlgTool::initialize (  )  [virtual]

Initialization (from CONFIGURED to INITIALIZED).

Implements IAlgTool.

Reimplemented in DataStreamTool.

virtual StatusCode AlgTool::start (  )  [virtual]

Start (from INITIALIZED to RUNNING).

Implements IAlgTool.

virtual StatusCode AlgTool::stop (  )  [virtual]

Stop (from RUNNING to INITIALIZED).

Implements IAlgTool.

virtual StatusCode AlgTool::finalize (  )  [virtual]

Finalize (from INITIALIZED to CONFIGURED).

Implements IAlgTool.

Reimplemented in DataStreamTool.

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

Initialization (from CONFIGURED to OFFLINE).

Implements IAlgTool.

Definition at line 65 of file AlgTool.h.

00065 { return StatusCode::SUCCESS; }

virtual StatusCode AlgTool::reinitialize (  )  [virtual]

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

Implements IAlgTool.

virtual StatusCode AlgTool::restart (  )  [virtual]

Initialization (from RUNNING to RUNNING, via INITIALIZED).

Implements IAlgTool.

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

Get the current state.

Implements IAlgTool.

Definition at line 68 of file AlgTool.h.

00068 { return m_state; }

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

When we are in the middle of a transition, get the state where the transition is leading us.

Otherwise it returns the same state as state().

Implements IStateful.

Definition at line 69 of file AlgTool.h.

00069 { return m_targetState; }

virtual StatusCode AlgTool::sysInitialize (  )  [virtual]

Initialize AlgTool.

Implements IAlgTool.

virtual StatusCode AlgTool::sysStart (  )  [virtual]

Start AlgTool.

Implements IAlgTool.

virtual StatusCode AlgTool::sysStop (  )  [virtual]

Stop AlgTool.

Implements IAlgTool.

virtual StatusCode AlgTool::sysFinalize (  )  [virtual]

Finalize AlgTool.

Implements IAlgTool.

virtual StatusCode AlgTool::sysReinitialize (  )  [virtual]

Initialize AlgTool.

Implements IAlgTool.

virtual StatusCode AlgTool::sysRestart (  )  [virtual]

Start AlgTool.

Implements IAlgTool.

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

Default implementations for IProperty interface.

Implements IProperty.

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

Set the property by string.

Implements IProperty.

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

Set the property by std::string.

Implements IProperty.

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

Get the property by property.

Implements IProperty.

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

Get the property by name.

Implements IProperty.

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

Get the property by std::string.

Implements IProperty.

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

Get list of properties.

Implements IProperty.

PropertyMgr* AlgTool::getPropertyMgr (  )  [inline]

Definition at line 98 of file AlgTool.h.

00098 { return m_propertyMgr; }

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 convinient in resetting of the default properties in the derived classes. E.g. without this method one needs to convert everything into strings to use IProperty::setProperty

    setProperty ( "OutputLevel" , "1"    ) ;
    setProperty ( "Enable"      , "True" ) ;
    setProperty ( "ErrorMax"    , "10"   ) ;

For simple cases it is more or less ok, but for complicated properties it is just ugly..

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

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

ISvcLocator* AlgTool::serviceLocator (  )  const

Retrieve pointer to service locator.

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

shortcut for the methos service locator

Definition at line 162 of file AlgTool.h.

00162 { return serviceLocator() ; }

IMessageSvc* AlgTool::msgSvc (  )  const

Retrieve pointer to message service.

IToolSvc* AlgTool::toolSvc (  )  const

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

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.

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

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

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

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

void AlgTool::declInterface ( const InterfaceID ,
void *   
)

declare interface

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

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

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

Declare remote named properties.

Definition at line 242 of file AlgTool.h.

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

IAuditorSvc* AlgTool::auditorSvc (  )  const

Access the auditor service.

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

00262   {
00263     // If not already located try to locate it without forcing a creation
00264     if ( !m_pMonitorSvc ){
00265       service_i( m_monitorSvcName, false,
00266                  IMonitorSvc::interfaceID(), pp_cast<void>(&m_pMonitorSvc) );
00267     }
00268     return m_pMonitorSvc;
00269   }

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

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

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

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

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

get tool's output level

Definition at line 305 of file AlgTool.h.

00305 { return (int)m_outputLevel ; }

virtual unsigned long AlgTool::refCount (  )  const [inline, protected, virtual]

Current number of refCounts.

Avoids having to call addRef() + release() to get current refCount. Used in ToolSvc.

Implements IAlgTool.

Definition at line 311 of file AlgTool.h.

00311 { return m_refCount; }

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

Accessor for the Message level property.

Definition at line 314 of file AlgTool.h.

00314 { return m_outputLevel; }

void AlgTool::initOutputLevel ( Property prop  )  [protected]

callback for output level property

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

implementation of service method

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

static const InterfaceID& IAlgTool::interfaceID (  )  [inline, static, inherited]

Retrieve interface ID.

Reimplemented from INamedInterface.

Reimplemented in IDataStreamTool, and IEventTimeDecoder.

Definition at line 30 of file IAlgTool.h.

00030 { return IID_IAlgTool; }

static const InterfaceID& IProperty::interfaceID (  )  [inline, static, inherited]

Retrieve interface ID.

Reimplemented from IInterface.

Definition at line 28 of file IProperty.h.

00028 { return IID_IProperty; }

static const InterfaceID& IStateful::interfaceID (  )  [inline, static, inherited]

Retrieve interface ID.

Reimplemented from IInterface.

Definition at line 23 of file IStateful.h.

00023 { return IID_IStateful; }


Friends And Related Function Documentation

friend class ToolSvc [friend]

Definition at line 38 of file AlgTool.h.


Member Data Documentation

IntegerProperty AlgTool::m_outputLevel [private]

AlgTool output level.

Definition at line 328 of file AlgTool.h.

std::string AlgTool::m_type [private]

AlgTool type (concrete class name).

Definition at line 329 of file AlgTool.h.

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

AlgTool full name.

Definition at line 330 of file AlgTool.h.

const IInterface* AlgTool::m_parent [private]

AlgTool parent.

Definition at line 331 of file AlgTool.h.

unsigned long AlgTool::m_refCount [private]

Reference counter.

Definition at line 332 of file AlgTool.h.

ISvcLocator* AlgTool::m_svcLocator [mutable, private]

Pointer to Service Locator service.

Definition at line 333 of file AlgTool.h.

IMessageSvc* AlgTool::m_messageSvc [mutable, private]

Message service.

Definition at line 334 of file AlgTool.h.

IToolSvc* AlgTool::m_ptoolSvc [mutable, private]

Tool service.

Definition at line 335 of file AlgTool.h.

IMonitorSvc* AlgTool::m_pMonitorSvc [mutable, private]

Online Monitoring Service.

Definition at line 336 of file AlgTool.h.

std::string AlgTool::m_monitorSvcName [private]

Name to use for Monitor Service.

Definition at line 337 of file AlgTool.h.

PropertyMgr* AlgTool::m_propertyMgr [private]

Property Manager.

Definition at line 338 of file AlgTool.h.

InterfaceList AlgTool::m_interfaceList [private]

Interface list.

Definition at line 339 of file AlgTool.h.

std::string AlgTool::m_threadID [private]

Thread Id for Alg Tool.

Definition at line 340 of file AlgTool.h.

IAuditorSvc* AlgTool::m_pAuditorSvc [mutable, private]

Auditor Service.

Definition at line 352 of file AlgTool.h.

BooleanProperty AlgTool::m_auditInit [private]

Definition at line 354 of file AlgTool.h.

bool AlgTool::m_auditorInitialize [private]

flag for auditors in "initialize()"

Definition at line 355 of file AlgTool.h.

bool AlgTool::m_auditorStart [private]

flag for auditors in "start()"

Definition at line 356 of file AlgTool.h.

bool AlgTool::m_auditorStop [private]

flag for auditors in "stop()"

Definition at line 357 of file AlgTool.h.

bool AlgTool::m_auditorFinalize [private]

flag for auditors in "finalize()"

Definition at line 358 of file AlgTool.h.

bool AlgTool::m_auditorReinitialize [private]

flag for auditors in "reinitialize()"

Definition at line 359 of file AlgTool.h.

bool AlgTool::m_auditorRestart [private]

flag for auditors in "restart()"

Definition at line 360 of file AlgTool.h.

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

state of the Tool

Definition at line 362 of file AlgTool.h.

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

state of the Tool

Definition at line 363 of file AlgTool.h.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:57:05 2011 for GaudiKernel by doxygen 1.4.7