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

Description: Register/Unregister the AlgContext of each algorithm before entering the algorithm and after leaving it. More...

#include <src/AlgContextAuditor.h>

Inheritance diagram for AlgContextAuditor:
Collaboration diagram for AlgContextAuditor:

Public Member Functions

virtual void beforeInitialize (INamedInterface *a)
 
virtual void afterInitialize (INamedInterface *a)
 
virtual void beforeExecute (INamedInterface *a)
 
virtual void afterExecute (INamedInterface *a, const StatusCode &s)
 
virtual void beforeFinalize (INamedInterface *a)
 
virtual void afterFinalize (INamedInterface *a)
 
 AlgContextAuditor (const std::string &name, ISvcLocator *pSvc)
 standard constructor More...
 
virtual ~AlgContextAuditor ()
 virtual destructor More...
 
virtual StatusCode initialize ()
 standard initialization, More...
 
virtual StatusCode finalize ()
 standard finalization, More...
 
- Public Member Functions inherited from Auditor
 Auditor (const std::string &name, ISvcLocator *svcloc)
 Constructor. More...
 
virtual ~Auditor ()
 Destructor. More...
 
StatusCode sysInitialize ()
 Initialization method invoked by the framework. More...
 
StatusCode sysFinalize ()
 Finalization method invoked by the framework. More...
 
virtual void before (StandardEventType, INamedInterface *)
 The following methods are meant to be implemented by the child class... More...
 
virtual void before (StandardEventType, const std::string &)
 Audit the start of a standard "event" for callers that do not implement INamedInterface. More...
 
virtual void before (CustomEventTypeRef, INamedInterface *)
 Audit the start of a custom "event". More...
 
virtual void before (CustomEventTypeRef, const std::string &)
 Audit the start of a custom "event" for callers that do not implement INamedInterface. More...
 
virtual void after (StandardEventType, INamedInterface *, const StatusCode &)
 Audit the end of a standard "event". More...
 
virtual void after (StandardEventType, const std::string &, const StatusCode &)
 Audit the end of a standard "event" for callers that do not implement INamedInterface. More...
 
virtual void after (CustomEventTypeRef, INamedInterface *, const StatusCode &)
 Audit the end of a custom "event". More...
 
virtual void after (CustomEventTypeRef, const std::string &, const StatusCode &)
 Audit the end of a custom "event" for callers that do not implement INamedInterface. More...
 
virtual void beforeReinitialize (INamedInterface *)
 
virtual void afterReinitialize (INamedInterface *)
 
virtual void beforeBeginRun (INamedInterface *)
 
virtual void afterBeginRun (INamedInterface *)
 
virtual void beforeEndRun (INamedInterface *)
 
virtual void afterEndRun (INamedInterface *)
 
virtual const std::string & name () const
 Retrieve the name of the instance. More...
 
virtual bool isEnabled () const
 Tell if the auditor is enabled or not. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
int outputLevel () const
 Retrieve the output level of current auditor. More...
 
void setOutputLevel (int level)
 Set the output level for current auditor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 The standard service locator. More...
 
template<class T >
StatusCode service (const std::string &name, T *&svc, bool createIf=false) const
 Access a service by name, creating it if it doesn't already exist. More...
 
virtual StatusCode setProperty (const Property &p)
 Set a value of a property of an auditor. More...
 
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the value of a property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty. More...
 
const std::vector< Property * > & getProperties () const
 Get all properties. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode setProperties ()
 Set the auditor's properties. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
- Public Member Functions inherited from extend_interfaces2< IAuditor, IProperty >
virtual ~extend_interfaces2 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IAuditor
 DeclareInterfaceID (IAuditor, 3, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 

Private Member Functions

 AlgContextAuditor ()
 the default constructor is disabled More...
 
 AlgContextAuditor (const AlgContextAuditor &)
 copy constructor is disabled More...
 
AlgContextAuditoroperator= (const AlgContextAuditor &)
 assignment operator is disabled More...
 

Private Attributes

IAlgContextSvcm_svc
 the pointer to Algorithm Context Service More...
 

Additional Inherited Members

- Public Types inherited from Auditor
typedef
Gaudi::PluginService::Factory2
< IAuditor *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from implements2< IAuditor, IProperty >
typedef implements2 base_class
 Typedef to this class. More...
 
typedef extend_interfaces2
< IAuditor, IProperty
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces2< IAuditor, IProperty >
typedef mpl::fold< typename
IAuditor::iid::iids::type,
typename
IProperty::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IAuditor
enum  StandardEventType {
  Initialize, ReInitialize, Execute, BeginRun,
  EndRun, Finalize, Start, Stop,
  ReStart
}
 Defines the standard (= used by the framework) auditable event types. More...
 
typedef std::string CustomEventType
 Type used to allow users to specify a custom event to be audit. More...
 
typedef const CustomEventTypeCustomEventTypeRef
 Used in function calls for optimization purposes. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 

Detailed Description

Description: Register/Unregister the AlgContext of each algorithm before entering the algorithm and after leaving it.

Author
M. Shapiro, LBNL
modified by Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Definition at line 22 of file AlgContextAuditor.h.

Constructor & Destructor Documentation

AlgContextAuditor::AlgContextAuditor ( const std::string &  name,
ISvcLocator pSvc 
)

standard constructor

See also
Auditor

Definition at line 42 of file AlgContextAuditor.cpp.

44  : Auditor( name , pSvc )
45  , m_svc ( 0 )
46 {}
virtual const std::string & name() const
Retrieve the name of the instance.
Definition: Auditor.cpp:218
IAlgContextSvc * m_svc
the pointer to Algorithm Context Service
Auditor(const std::string &name, ISvcLocator *svcloc)
Constructor.
Definition: Auditor.cpp:14
AlgContextAuditor::~AlgContextAuditor ( )
virtual

virtual destructor

Definition at line 50 of file AlgContextAuditor.cpp.

50 {}
AlgContextAuditor::AlgContextAuditor ( )
private

the default constructor is disabled

AlgContextAuditor::AlgContextAuditor ( const AlgContextAuditor )
private

copy constructor is disabled

Member Function Documentation

void AlgContextAuditor::afterExecute ( INamedInterface ,
const StatusCode  
)
virtual
Deprecated:
use after

Reimplemented from Auditor.

Definition at line 121 of file AlgContextAuditor.cpp.

122  {
123  if ( 0 != m_svc ) {
124  IAlgorithm* alg = toAlg(a);
125  if (alg != 0) m_svc -> unSetCurrentAlg ( alg ).ignore() ;
126  }
127 }
IAlgContextSvc * m_svc
the pointer to Algorithm Context Service
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
void AlgContextAuditor::afterFinalize ( INamedInterface )
virtual
Deprecated:
use after

Reimplemented from Auditor.

Definition at line 107 of file AlgContextAuditor.cpp.

107  {
108  if ( 0 != m_svc ) {
109  IAlgorithm* alg = toAlg(a);
110  if (alg != 0) m_svc -> unSetCurrentAlg ( alg ).ignore() ;
111  }
112 }
IAlgContextSvc * m_svc
the pointer to Algorithm Context Service
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
void AlgContextAuditor::afterInitialize ( INamedInterface )
virtual
Deprecated:
use after

Reimplemented from Auditor.

Definition at line 93 of file AlgContextAuditor.cpp.

93  {
94  if ( 0 != m_svc ) {
95  IAlgorithm* alg = toAlg(a);
96  if (alg != 0) m_svc -> unSetCurrentAlg ( alg ).ignore() ;
97  }
98 }
IAlgContextSvc * m_svc
the pointer to Algorithm Context Service
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
void AlgContextAuditor::beforeExecute ( INamedInterface )
virtual
Deprecated:
use before

Reimplemented from Auditor.

Definition at line 114 of file AlgContextAuditor.cpp.

114  {
115  if ( 0 != m_svc ) {
116  IAlgorithm* alg = toAlg(a);
117  if (alg != 0) m_svc -> setCurrentAlg ( alg ).ignore() ;
118  }
119 }
IAlgContextSvc * m_svc
the pointer to Algorithm Context Service
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
void AlgContextAuditor::beforeFinalize ( INamedInterface )
virtual
Deprecated:
use before

Reimplemented from Auditor.

Definition at line 100 of file AlgContextAuditor.cpp.

100  {
101  if ( 0 != m_svc ) {
102  IAlgorithm* alg = toAlg(a);
103  if (alg != 0) m_svc -> setCurrentAlg ( alg ).ignore() ;
104  }
105 }
IAlgContextSvc * m_svc
the pointer to Algorithm Context Service
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
void AlgContextAuditor::beforeInitialize ( INamedInterface )
virtual
Deprecated:
use before

Reimplemented from Auditor.

Definition at line 86 of file AlgContextAuditor.cpp.

86  {
87  if ( 0 != m_svc ) {
88  IAlgorithm* alg = toAlg(a);
89  if (alg != 0) m_svc -> setCurrentAlg ( alg ).ignore() ;
90  }
91 }
IAlgContextSvc * m_svc
the pointer to Algorithm Context Service
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
StatusCode AlgContextAuditor::finalize ( )
virtual

standard finalization,

See also
IAuditor

Reimplemented from Auditor.

Definition at line 79 of file AlgContextAuditor.cpp.

80 {
81  if ( 0 != m_svc ) { m_svc-> release() ; m_svc = 0 ; }
82  // finalize the base class
83  return Auditor::finalize () ;
84 }
virtual StatusCode finalize()
Definition: Auditor.cpp:213
IAlgContextSvc * m_svc
the pointer to Algorithm Context Service
virtual unsigned long release()=0
Release Interface instance.
StatusCode AlgContextAuditor::initialize ( )
virtual

standard initialization,

See also
IAuditor

Reimplemented from Auditor.

Definition at line 54 of file AlgContextAuditor.cpp.

55 {
56  // initialize the base class
58  if ( sc.isFailure() ) { return sc ; } // RETURN
59  if ( 0 != m_svc ) { m_svc -> release() ; m_svc = 0 ; }
60  sc = Auditor::service ( "AlgContextSvc" , m_svc , true ) ;
61  if ( sc.isFailure() )
62  {
63  MsgStream log ( msgSvc() , name() ) ;
64  log << MSG::ERROR << "Unable to locate 'AlgContextSvc'" << sc << endmsg ;
65  m_svc = 0 ;
66  return sc ; // RETURN
67  }
68  if ( 0 == m_svc )
69  {
70  MsgStream log ( msgSvc() , name() ) ;
71  log << MSG::ERROR << "Invalid pointer to IAlgContextSvc" << endmsg ;
72  return StatusCode::FAILURE ; // RETURN
73  }
74  return StatusCode::SUCCESS ;
75 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode service(const std::string &name, T *&svc, bool createIf=false) const
Access a service by name, creating it if it doesn't already exist.
Definition: Auditor.h:117
virtual const std::string & name() const
Retrieve the name of the instance.
Definition: Auditor.cpp:218
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Auditor.cpp:226
IAlgContextSvc * m_svc
the pointer to Algorithm Context Service
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual unsigned long release()=0
Release Interface instance.
virtual StatusCode initialize()
Definition: Auditor.cpp:97
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:243
AlgContextAuditor& AlgContextAuditor::operator= ( const AlgContextAuditor )
private

assignment operator is disabled

Member Data Documentation

IAlgContextSvc* AlgContextAuditor::m_svc
private

the pointer to Algorithm Context Service

Definition at line 56 of file AlgContextAuditor.h.


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