The Gaudi Framework
master (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
Auditor.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#pragma once
12
13
#include <
Gaudi/IAuditor.h
>
14
#include <
Gaudi/PluginService.h
>
15
#include <
Gaudi/PropertyFwd.h
>
16
#include <
GaudiKernel/CommonMessaging.h
>
17
#include <
GaudiKernel/IProperty.h
>
18
#include <
GaudiKernel/IService.h
>
19
#include <
GaudiKernel/ISvcLocator.h
>
/*used by service(..)*/
20
#include <
GaudiKernel/PropertyHolder.h
>
21
#include <string>
22
23
namespace
Gaudi
{
24
33
class
GAUDI_API
Auditor
:
public
PropertyHolder
<CommonMessaging<implements<IAuditor, IProperty>>> {
34
public
:
35
using
Factory
= Gaudi::PluginService::Factory<
IAuditor
*(
const
std::string&,
ISvcLocator
* )>;
36
37
Auditor
( std::string
name
,
ISvcLocator
* svcloc ) :
m_name
(
std
::move(
name
) ),
m_pSvcLocator
( svcloc ){};
38
Auditor
(
const
Auditor
& a ) =
delete
;
39
Auditor
&
operator=
(
const
Auditor
& rhs ) =
delete
;
40
41
StatusCode
sysInitialize
()
override
;
42
StatusCode
sysFinalize
()
override
;
43
44
void
before
( std::string
const
&, std::string
const
&,
EventContext
const
& )
override
{}
45
void
after
( std::string
const
&, std::string
const
&,
EventContext
const
&,
46
StatusCode
const
& =
StatusCode::SUCCESS
)
override
{}
47
48
virtual
StatusCode
initialize
() {
return
StatusCode::SUCCESS
; }
49
virtual
StatusCode
finalize
() {
return
StatusCode::SUCCESS
; }
50
51
const
std::string&
name
()
const override
{
return
m_name
; }
52
bool
isEnabled
()
const override
{
return
m_isEnabled
; }
53
59
SmartIF<ISvcLocator>
&
serviceLocator
()
const override
{
return
m_pSvcLocator
; }
60
62
template
<
class
T = IService>
63
SmartIF<T>
service
( std::string_view
name
,
bool
createIf =
false
)
const
{
64
return
serviceLocator
()->service<T>(
name
, createIf );
65
}
66
67
private
:
68
std::string
m_name
;
69
70
mutable
SmartIF<ISvcLocator>
m_pSvcLocator
;
71
72
Gaudi::Property<int>
m_outputLevel
{
73
this
,
"OutputLevel"
,
MSG::NIL
,
74
[
this
](
Gaudi::Details::PropertyBase
& ) { this->
updateMsgStreamOutputLevel
( this->m_outputLevel ); },
75
"output level"
};
76
Gaudi::Property<bool>
m_isEnabled
{
this
,
"Enable"
,
true
,
"should the auditor be used or not"
};
77
78
bool
m_isInitialized
=
false
;
79
bool
m_isFinalized
=
false
;
80
};
81
82
}
// namespace Gaudi
CommonMessaging.h
IAuditor.h
IProperty.h
IService.h
ISvcLocator.h
GAUDI_API
#define GAUDI_API
Definition
Kernel.h:49
PluginService.h
PropertyFwd.h
PropertyHolder.h
CommonMessaging< implements< IAuditor, IProperty > >::updateMsgStreamOutputLevel
void updateMsgStreamOutputLevel(int level)
Definition
CommonMessaging.h:187
EventContext
This class represents an entry point to all the event specific data.
Definition
EventContext.h:35
Gaudi::Auditor::before
void before(std::string const &, std::string const &, EventContext const &) override
Definition
Auditor.h:44
Gaudi::Auditor::m_outputLevel
Gaudi::Property< int > m_outputLevel
Pointer to service locator service.
Definition
Auditor.h:72
Gaudi::Auditor::m_isFinalized
bool m_isFinalized
Auditor has been initialized flag.
Definition
Auditor.h:79
Gaudi::Auditor::after
void after(std::string const &, std::string const &, EventContext const &, StatusCode const &=StatusCode::SUCCESS) override
Definition
Auditor.h:45
Gaudi::Auditor::m_pSvcLocator
SmartIF< ISvcLocator > m_pSvcLocator
Auditor's name for identification.
Definition
Auditor.h:70
Gaudi::Auditor::name
const std::string & name() const override
Definition
Auditor.h:51
Gaudi::Auditor::service
SmartIF< T > service(std::string_view name, bool createIf=false) const
Access a service by name, creating it if it doesn't already exist.
Definition
Auditor.h:63
Gaudi::Auditor::m_isInitialized
bool m_isInitialized
Definition
Auditor.h:78
Gaudi::Auditor::initialize
virtual StatusCode initialize()
Definition
Auditor.h:48
Gaudi::Auditor::m_isEnabled
Gaudi::Property< bool > m_isEnabled
Definition
Auditor.h:76
Gaudi::Auditor::Auditor
Auditor(std::string name, ISvcLocator *svcloc)
Definition
Auditor.h:37
Gaudi::Auditor::Auditor
Auditor(const Auditor &a)=delete
Gaudi::Auditor::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
Definition
Auditor.h:59
Gaudi::Auditor::Factory
Gaudi::PluginService::Factory< IAuditor *(const std::string &, ISvcLocator *)> Factory
Definition
Auditor.h:35
Gaudi::Auditor::m_name
std::string m_name
Definition
Auditor.h:68
Gaudi::Auditor::sysFinalize
StatusCode sysFinalize() override
Definition
Auditor.cpp:53
Gaudi::Auditor::operator=
Auditor & operator=(const Auditor &rhs)=delete
Gaudi::Auditor::isEnabled
bool isEnabled() const override
Definition
Auditor.h:52
Gaudi::Auditor::finalize
virtual StatusCode finalize()
Definition
Auditor.h:49
Gaudi::Auditor::sysInitialize
StatusCode sysInitialize() override
Definition
Auditor.cpp:16
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition
PropertyBase.h:34
Gaudi::IAuditor
The IAuditor is the interface implemented by the Auditor base class.
Definition
IAuditor.h:26
Gaudi::Property
Implementation of property with value of concrete type.
Definition
Property.h:35
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition
ISvcLocator.h:42
PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >::PropertyHolder
PropertyHolder()=default
SmartIF
Small smart pointer class with automatic reference counting for IInterface.
Definition
SmartIF.h:28
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition
__init__.py:1
MSG::NIL
@ NIL
Definition
IMessageSvc.h:22
std
STL namespace.
GaudiKernel
include
Gaudi
Auditor.h
Generated on
for The Gaudi Framework by
1.17.0