The Gaudi Framework  v30r3 (a5ef0a68)
CommonAuditor.cpp
Go to the documentation of this file.
1 #include "CommonAuditor.h"
3 
4 CommonAuditor::CommonAuditor( const std::string& name, ISvcLocator* svcloc ) : Auditor( name, svcloc )
5 {
6  auto deprecated_property = [this]( Gaudi::Details::PropertyBase& p ) {
7  if ( m_customTypes.size() > 0 ) {
8  if ( m_types.size() > 0 ) {
9  error() << p.name() << " is deprecated, but both " << m_customTypes.name() << " and " << m_types.name()
10  << " used." << endmsg;
11  throw GaudiException( "Property CustomEventTypes is deprecated, but both CustomEventTypes and EventTypes used",
12  this->name(), StatusCode::FAILURE );
13  } else {
14  warning() << p.name() << " " << p.documentation() << endmsg;
16  }
17  }
18  };
19  m_customTypes.declareUpdateHandler( deprecated_property );
20 }
21 
22 void CommonAuditor::before( StandardEventType evt, INamedInterface* caller )
23 {
24  if ( caller ) before( toStr( evt ), caller->name() );
25 }
26 void CommonAuditor::before( StandardEventType evt, const std::string& caller ) { before( toStr( evt ), caller ); }
27 void CommonAuditor::before( CustomEventTypeRef evt, INamedInterface* caller )
28 {
29  if ( caller ) before( evt, caller->name() );
30 }
31 void CommonAuditor::before( CustomEventTypeRef evt, const std::string& caller )
32 {
33  if ( i_auditEventType( evt ) ) i_before( evt, caller );
34 }
35 
36 void CommonAuditor::after( StandardEventType evt, INamedInterface* caller, const StatusCode& sc )
37 {
38  if ( caller ) after( toStr( evt ), caller->name(), sc );
39 }
40 void CommonAuditor::after( StandardEventType evt, const std::string& caller, const StatusCode& sc )
41 {
42  after( toStr( evt ), caller, sc );
43 }
44 void CommonAuditor::after( CustomEventTypeRef evt, INamedInterface* caller, const StatusCode& sc )
45 {
46  if ( caller ) after( evt, caller->name(), sc );
47 }
48 void CommonAuditor::after( CustomEventTypeRef evt, const std::string& caller, const StatusCode& sc )
49 {
50  if ( i_auditEventType( evt ) ) i_after( evt, caller, sc );
51 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:100
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Gaudi::Property< std::vector< std::string > > m_types
Definition: CommonAuditor.h:53
void before(StandardEventType evt, const std::string &caller) override
STL class.
bool i_auditEventType(const std::string &evt)
Check if we are requested to audit the passed event type.
Definition: CommonAuditor.h:43
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
IInterface compliant class extending IInterface with the name() method.
Gaudi::Property< std::vector< std::string > > m_customTypes
Definition: CommonAuditor.h:55
CommonAuditor(const std::string &name, ISvcLocator *svcloc)
Constructor.
virtual void i_before(CustomEventTypeRef evt, const std::string &caller)=0
catch all "before" method, implemented in the derived class
void after(StandardEventType evt, const std::string &caller, const StatusCode &sc) override
virtual void i_after(CustomEventTypeRef evt, const std::string &caller, const StatusCode &sc)=0
catch all "after" method, implemented in the derived class
const std::string & name() const override
Definition: Auditor.cpp:202
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
virtual const std::string & name() const =0
Retrieve the name of the instance.
evt
Definition: IOTest.py:96
Base class from which all concrete auditor classes should be derived.
Definition: Auditor.h:35