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
14
21class AuditorTestAlg : public Algorithm {
22public:
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
32protected:
33private:
34};
35
36//-----------------------------------------------------------------------------
37// Implementation for class : AuditorTestAlg
38//
39// Apr 2, 2008 : Marco Clemencic
40//-----------------------------------------------------------------------------
41
42// Declaration of the Algorithm Factory
44
45//=============================================================================
46// Standard constructor, initializes variables
47//=============================================================================
48AuditorTestAlg::AuditorTestAlg( const std::string& name, ISvcLocator* pSvcLocator ) : Algorithm( name, pSvcLocator ) {}
49//=============================================================================
50// Destructor
51//=============================================================================
53
54//=============================================================================
55// Initialization
56//=============================================================================
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
64}
65
66//=============================================================================
67// Main execution
68//=============================================================================
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
78}
79
80//=============================================================================
81// Finalize
82//=============================================================================
84
85 debug() << "==> Finalize" << endmsg;
86
87 return Algorithm::finalize(); // must be called after all other actions
88}
89
90//=============================================================================
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
#define DECLARE_COMPONENT(type)
~AuditorTestAlg() override
Destructor.
StatusCode execute() override
Algorithm execution.
StatusCode initialize() override
Algorithm initialization.
StatusCode finalize() override
Algorithm finalization.
AuditorTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard constructor.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
This class represents an entry point to all the event specific data.
SmartIF< IAuditorSvc > & auditorSvc() const
The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition Algorithm.h:98
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition Algorithm.h:175
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
Definition Algorithm.h:181
const std::string & name() const override
The identifying name of the algorithm object.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
bool isFailure() const
Definition StatusCode.h:129
constexpr static const auto SUCCESS
Definition StatusCode.h:99
STL namespace.