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

void beforeInitialize (INamedInterface *a) override
 
void afterInitialize (INamedInterface *a) override
 
void beforeExecute (INamedInterface *a) override
 
void afterExecute (INamedInterface *a, const StatusCode &s) override
 
void beforeFinalize (INamedInterface *a) override
 
void afterFinalize (INamedInterface *a) override
 
 AlgContextAuditor (const std::string &name, ISvcLocator *pSvc)
 standard constructor/destructor More...
 
 ~AlgContextAuditor () override=default
 
StatusCode initialize () override
 standard initialization, More...
 
StatusCode finalize () override
 standard finalization, More...
 
- Public Member Functions inherited from Auditor
 Auditor (const std::string &name, ISvcLocator *svcloc)
 Constructor. More...
 
 ~Auditor () override=default
 Destructor. More...
 
StatusCode sysInitialize () override
 Initialization method invoked by the framework. More...
 
StatusCode sysFinalize () override
 Finalization method invoked by the framework. More...
 
void before (StandardEventType, INamedInterface *) override
 The following methods are meant to be implemented by the child class... More...
 
void before (StandardEventType, const std::string &) override
 
void before (CustomEventTypeRef, INamedInterface *) override
 
void before (CustomEventTypeRef, const std::string &) override
 
void after (StandardEventType, INamedInterface *, const StatusCode &) override
 
void after (StandardEventType, const std::string &, const StatusCode &) override
 
void after (CustomEventTypeRef, INamedInterface *, const StatusCode &) override
 
void after (CustomEventTypeRef, const std::string &, const StatusCode &) override
 
void beforeInitialize (INamedInterface *) override
 
void afterInitialize (INamedInterface *) override
 
void beforeReinitialize (INamedInterface *) override
 
void afterReinitialize (INamedInterface *) override
 
void beforeExecute (INamedInterface *) override
 
void afterExecute (INamedInterface *, const StatusCode &) override
 
void beforeFinalize (INamedInterface *) override
 
void afterFinalize (INamedInterface *) override
 
void beforeBeginRun (INamedInterface *) override
 
void afterBeginRun (INamedInterface *) override
 
void beforeEndRun (INamedInterface *) override
 
void afterEndRun (INamedInterface *) override
 
const std::string & name () const override
 
bool isEnabled () const override
 
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...
 
template<class T = IService>
SmartIF< T > service (const std::string &name, bool createIf=false) const
 
StatusCode setProperty (const Property &p) override
 Set a value of a property of an auditor. More...
 
StatusCode setProperty (const std::string &s) override
 Implementation of IProperty::setProperty. More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 Implementation of IProperty::setProperty. More...
 
StatusCode getProperty (Property *p) const override
 Get the value of a property. More...
 
const PropertygetProperty (const std::string &name) const override
 Get the property by name. More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 Implementation of IProperty::getProperty. More...
 
const std::vector< Property * > & getProperties () const override
 Get all properties. More...
 
bool hasProperty (const std::string &name) const override
 Implementation of IProperty::hasProperty. 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...
 
 Auditor (const std::string &name, ISvcLocator *svcloc)
 Constructor. More...
 
 ~Auditor () override=default
 Destructor. More...
 
StatusCode sysInitialize () override
 Initialization method invoked by the framework. More...
 
StatusCode sysFinalize () override
 Finalization method invoked by the framework. More...
 
void before (StandardEventType, INamedInterface *) override
 The following methods are meant to be implemented by the child class... More...
 
void before (StandardEventType, const std::string &) override
 
void before (CustomEventTypeRef, INamedInterface *) override
 
void before (CustomEventTypeRef, const std::string &) override
 
void after (StandardEventType, INamedInterface *, const StatusCode &) override
 
void after (StandardEventType, const std::string &, const StatusCode &) override
 
void after (CustomEventTypeRef, INamedInterface *, const StatusCode &) override
 
void after (CustomEventTypeRef, const std::string &, const StatusCode &) override
 
void beforeInitialize (INamedInterface *) override
 
void afterInitialize (INamedInterface *) override
 
void beforeReinitialize (INamedInterface *) override
 
void afterReinitialize (INamedInterface *) override
 
void beforeExecute (INamedInterface *) override
 
void afterExecute (INamedInterface *, const StatusCode &) override
 
void beforeFinalize (INamedInterface *) override
 
void afterFinalize (INamedInterface *) override
 
void beforeBeginRun (INamedInterface *) override
 
void afterBeginRun (INamedInterface *) override
 
void beforeEndRun (INamedInterface *) override
 
void afterEndRun (INamedInterface *) override
 
const std::string & name () const override
 
bool isEnabled () const override
 
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...
 
template<class T = IService>
SmartIF< T > service (const std::string &name, bool createIf=false) const
 
StatusCode setProperty (const Property &p) override
 Set a value of a property of an auditor. More...
 
StatusCode setProperty (const std::string &s) override
 Implementation of IProperty::setProperty. More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 Implementation of IProperty::setProperty. More...
 
StatusCode getProperty (Property *p) const override
 Get the value of a property. More...
 
const PropertygetProperty (const std::string &name) const override
 Get the property by name. More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 Implementation of IProperty::getProperty. More...
 
const std::vector< Property * > & getProperties () const override
 Get all properties. More...
 
bool hasProperty (const std::string &name) const override
 Implementation of IProperty::hasProperty. 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 implements< Interfaces >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces...>
 ~extend_interfaces () override=default
 Virtual destructor. More...
 
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Private Member Functions

 AlgContextAuditor ()=delete
 delete the default/copy constructor and assignment More...
 
 AlgContextAuditor (const AlgContextAuditor &)=delete
 
AlgContextAuditoroperator= (const AlgContextAuditor &)=delete
 

Private Attributes

SmartIF< IAlgContextSvcm_svc
 the pointer to Algorithm Context Service More...
 

Additional Inherited Members

- Public Types inherited from Auditor
typedef Gaudi::PluginService::Factory< IAuditor *, const std::string &, ISvcLocator * > Factory
 
typedef Gaudi::PluginService::Factory< IAuditor *, const std::string &, ISvcLocator * > Factory
 
- Public Types inherited from implements< Interfaces >
using base_class = implements< Interfaces...>
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
using base_class = implements< Interfaces...>
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
- Public Types inherited from extend_interfaces< Interfaces...>
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 
- Protected Attributes inherited from implements< Interfaces >
std::atomic_ulong m_refCount = {0}
 Reference counter. 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 21 of file AlgContextAuditor.h.

Constructor & Destructor Documentation

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

standard constructor/destructor

See also
Auditor

Definition at line 34 of file AlgContextAuditor.cpp.

35  : Auditor( name , pSvc )
36 {}
Auditor(const std::string &name, ISvcLocator *svcloc)
Constructor.
Definition: Auditor.cpp:12
const std::string & name() const override
Definition: Auditor.cpp:212
AlgContextAuditor::~AlgContextAuditor ( )
overridedefault
AlgContextAuditor::AlgContextAuditor ( )
privatedelete

delete the default/copy constructor and assignment

AlgContextAuditor::AlgContextAuditor ( const AlgContextAuditor )
privatedelete

Member Function Documentation

void AlgContextAuditor::afterExecute ( INamedInterface a,
const StatusCode s 
)
override

Definition at line 83 of file AlgContextAuditor.cpp.

84  {
85  call<&IAlgContextSvc::unSetCurrentAlg>(m_svc,a);
86 }
SmartIF< IAlgContextSvc > m_svc
the pointer to Algorithm Context Service
void AlgContextAuditor::afterFinalize ( INamedInterface a)
override

Definition at line 75 of file AlgContextAuditor.cpp.

75  {
76  call<&IAlgContextSvc::unSetCurrentAlg>(m_svc,a);
77 }
SmartIF< IAlgContextSvc > m_svc
the pointer to Algorithm Context Service
void AlgContextAuditor::afterInitialize ( INamedInterface a)
override

Definition at line 67 of file AlgContextAuditor.cpp.

67  {
68  call<&IAlgContextSvc::unSetCurrentAlg>(m_svc,a);
69 }
SmartIF< IAlgContextSvc > m_svc
the pointer to Algorithm Context Service
void AlgContextAuditor::beforeExecute ( INamedInterface a)
override

Definition at line 79 of file AlgContextAuditor.cpp.

79  {
80  call<&IAlgContextSvc::setCurrentAlg>(m_svc,a);
81 }
SmartIF< IAlgContextSvc > m_svc
the pointer to Algorithm Context Service
void AlgContextAuditor::beforeFinalize ( INamedInterface a)
override

Definition at line 71 of file AlgContextAuditor.cpp.

71  {
72  call<&IAlgContextSvc::setCurrentAlg>(m_svc,a);
73 }
SmartIF< IAlgContextSvc > m_svc
the pointer to Algorithm Context Service
void AlgContextAuditor::beforeInitialize ( INamedInterface a)
override

Definition at line 63 of file AlgContextAuditor.cpp.

63  {
64  call<&IAlgContextSvc::setCurrentAlg>(m_svc,a);
65 }
SmartIF< IAlgContextSvc > m_svc
the pointer to Algorithm Context Service
StatusCode AlgContextAuditor::finalize ( )
overridevirtual

standard finalization,

See also
IAuditor

Reimplemented from Auditor.

Definition at line 56 of file AlgContextAuditor.cpp.

57 {
58  m_svc.reset();
59  // finalize the base class
60  return Auditor::finalize () ;
61 }
virtual StatusCode finalize()
Definition: Auditor.cpp:207
SmartIF< IAlgContextSvc > m_svc
the pointer to Algorithm Context Service
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
StatusCode AlgContextAuditor::initialize ( )
overridevirtual

standard initialization,

See also
IAuditor

Reimplemented from Auditor.

Definition at line 40 of file AlgContextAuditor.cpp.

41 {
42  // initialize the base class
44  if ( sc.isFailure() ) { return sc ; } // RETURN
45  m_svc = service( "AlgContextSvc" , true ) ;
46  if ( !m_svc ) {
47  MsgStream log ( msgSvc() , name() ) ;
48  log << MSG::ERROR << "Invalid pointer to IAlgContextSvc" << endmsg ;
49  return StatusCode::FAILURE ; // RETURN
50  }
51  return StatusCode::SUCCESS ;
52 }
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:119
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Auditor.cpp:220
SmartIF< IAlgContextSvc > m_svc
the pointer to Algorithm Context Service
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
const std::string & name() const override
Definition: Auditor.cpp:212
virtual StatusCode initialize()
Definition: Auditor.cpp:91
AlgContextAuditor& AlgContextAuditor::operator= ( const AlgContextAuditor )
privatedelete

Member Data Documentation

SmartIF<IAlgContextSvc> AlgContextAuditor::m_svc
private

the pointer to Algorithm Context Service

Definition at line 53 of file AlgContextAuditor.h.


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