The Gaudi Framework
master (181af51f)
Loading...
Searching...
No Matches
AuditorTestAlg.cpp
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
// Include files
12
// from Gaudi
13
#include <
GaudiKernel/Algorithm.h
>
14
21
class
AuditorTestAlg
:
public
Algorithm
{
22
public
:
24
AuditorTestAlg
(
const
std::string&
name
,
ISvcLocator
* pSvcLocator );
25
26
~AuditorTestAlg
()
override
;
27
28
StatusCode
initialize
()
override
;
29
StatusCode
execute
()
override
;
30
StatusCode
finalize
()
override
;
31
32
protected
:
33
private
:
34
};
35
36
//-----------------------------------------------------------------------------
37
// Implementation for class : AuditorTestAlg
38
//
39
// Apr 2, 2008 : Marco Clemencic
40
//-----------------------------------------------------------------------------
41
42
// Declaration of the Algorithm Factory
43
DECLARE_COMPONENT
(
AuditorTestAlg
)
44
45
//=============================================================================
46
// Standard constructor, initializes variables
47
//=============================================================================
48
AuditorTestAlg
::
AuditorTestAlg
( const
std
::
string
&
name
,
ISvcLocator
* pSvcLocator ) :
Algorithm
(
name
, pSvcLocator ) {}
49
//=============================================================================
50
// Destructor
51
//=============================================================================
52
AuditorTestAlg::~AuditorTestAlg
() {}
53
54
//=============================================================================
55
// Initialization
56
//=============================================================================
57
StatusCode
AuditorTestAlg::initialize
() {
58
StatusCode
sc =
Algorithm::initialize
();
// must be executed first
59
if
( sc.
isFailure
() )
return
sc;
// error printed already by Algorithm
60
61
debug
() <<
"==> Initialize"
<<
endmsg
;
62
63
return
StatusCode::SUCCESS
;
64
}
65
66
//=============================================================================
67
// Main execution
68
//=============================================================================
69
StatusCode
AuditorTestAlg::execute
() {
70
71
debug
() <<
"==> Execute"
<<
endmsg
;
72
73
auditorSvc
()->before(
"loop"
,
name
(),
EventContext
{} );
74
for
(
long
i = 0; i < 1000000; ++i ) {}
75
auditorSvc
()->after(
"loop"
,
name
(),
EventContext
{} );
76
77
return
StatusCode::SUCCESS
;
78
}
79
80
//=============================================================================
81
// Finalize
82
//=============================================================================
83
StatusCode
AuditorTestAlg::finalize
() {
84
85
debug
() <<
"==> Finalize"
<<
endmsg
;
86
87
return
Algorithm::finalize
();
// must be called after all other actions
88
}
89
90
//=============================================================================
Algorithm.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition
MsgStream.h:198
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition
PluginServiceV1.h:45
AuditorTestAlg
Definition
AuditorTestAlg.cpp:21
AuditorTestAlg::~AuditorTestAlg
~AuditorTestAlg() override
Destructor.
Definition
AuditorTestAlg.cpp:52
AuditorTestAlg::execute
StatusCode execute() override
Algorithm execution.
Definition
AuditorTestAlg.cpp:69
AuditorTestAlg::initialize
StatusCode initialize() override
Algorithm initialization.
Definition
AuditorTestAlg.cpp:57
AuditorTestAlg::finalize
StatusCode finalize() override
Algorithm finalization.
Definition
AuditorTestAlg.cpp:83
AuditorTestAlg::AuditorTestAlg
AuditorTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard constructor.
Definition
AuditorTestAlg.cpp:48
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition
CommonMessaging.h:116
EventContext
This class represents an entry point to all the event specific data.
Definition
EventContext.h:34
Gaudi::Algorithm::auditorSvc
SmartIF< IAuditorSvc > & auditorSvc() const
The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Definition
Algorithm.cpp:558
Gaudi::Algorithm::Algorithm
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition
Algorithm.h:98
Gaudi::Algorithm::initialize
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition
Algorithm.h:175
Gaudi::Algorithm::finalize
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
Definition
Algorithm.h:181
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition
Algorithm.cpp:529
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition
ISvcLocator.h:42
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::isFailure
bool isFailure() const
Definition
StatusCode.h:129
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
std
STL namespace.
GaudiTestSuite
src
Auditors
AuditorTestAlg.cpp
Generated on Wed Oct 8 2025 09:53:38 for The Gaudi Framework by
1.13.1