| The Gaudi Framework v32r1 (f65d50dc)

Algorithm.h
Go to the documentation of this file.
1 #pragma once
2 #include <Gaudi/Algorithm.h>
3 #include <GaudiKernel/ThreadLocalContext.h>
4
5 namespace Gaudi {
6 namespace details {
7 #pragma GCC diagnostic push
8 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
9 class LegacyAlgorithmAdapter : public Gaudi::Algorithm {
10 public:
11 LegacyAlgorithmAdapter( const std::string& name, ISvcLocator* svcloc,
12 const std::string& version = PACKAGE_VERSION )
13 : Gaudi::Algorithm( name, svcloc, version ) {
14 // default cardinality for non-reentrant algorithms
15 setProperty( "Cardinality", 1 );
16 }
17
18 virtual StatusCode execute() = 0;
19
20 const EventContext& getContext() const { return Gaudi::Hive::currentContext(); }
21
23 bool isExecuted() const;
24
26 void setExecuted( bool state ) const;
27
31 [[deprecated( "resetExecuted should be triggered globally via the AlgExecStateSvc, not individually for each "
32 "Algorithm" )]] void
33 resetExecuted();
34
36 bool filterPassed() const;
37
39 void setFilterPassed( bool state ) const;
40
41 protected:
42 bool isReEntrant() const override { return false; }
43
44 private:
45 StatusCode execute( const EventContext& ) const override final {
46 return const_cast<LegacyAlgorithmAdapter*>( this )->execute();
47 }
48 };
49 #pragma GCC diagnostic pop
50 } // namespace details
51 } // namespace Gaudi
52
53 #pragma GCC diagnostic push
54 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
55 class Algorithm : public Gaudi::details::LegacyAlgorithmAdapter {
57 public:
58 using Gaudi::details::LegacyAlgorithmAdapter::LegacyAlgorithmAdapter;
59 // this is to explicitly hide the other signature of `execute`
60 StatusCode execute() override = 0;
61 };
62 #pragma GCC diagnostic pop
Gaudi::details::LegacyAlgorithmAdapter::LegacyAlgorithmAdapter
LegacyAlgorithmAdapter(const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
Definition: Algorithm.h:11
Gaudi::details::LegacyAlgorithmAdapter::isReEntrant
bool isReEntrant() const override
Definition: Algorithm.h:42
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Gaudi::details::LegacyAlgorithmAdapter::resetExecuted
void resetExecuted()
Reset the executed state of the Algorithm for the duration of the current event.
Definition: LegacyAlgorithm.cpp:16
Gaudi::details::LegacyAlgorithmAdapter::setFilterPassed
void setFilterPassed(bool state) const
Set the filter passed flag to the specified state.
Definition: LegacyAlgorithm.cpp:22
PropertyHolder< CommonMessaging< implements< IAlgorithm, IDataHandleHolder, IProperty, IStateful > > >::setProperty
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
Definition: PropertyHolder.h:145
ThreadLocalContext.h
Gaudi::Algorithm::version
const std::string & version() const override
Definition: Algorithm.cpp:649
Gaudi::details::LegacyAlgorithmAdapter
Definition: Algorithm.h:9
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
std::string
STL class.
Gaudi::details::LegacyAlgorithmAdapter::execute
virtual StatusCode execute()=0
PACKAGE_VERSION
#define PACKAGE_VERSION
Definition: Algorithm.h:49
Gaudi::details::LegacyAlgorithmAdapter::getContext
const EventContext & getContext() const
Definition: Algorithm.h:20
details
Definition: AnyDataWrapper.h:10
Algorithm.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
compareRootHistos.state
def state
Definition: compareRootHistos.py:455
Gaudi::Hive::currentContext
GAUDI_API const EventContext & currentContext()
Definition: ThreadLocalContext.cpp:20
Algorithm::execute
StatusCode execute() override=0
Algorithm
Alias for backward compatibility.
Definition: Algorithm.h:56
Gaudi::details::LegacyAlgorithmAdapter::setExecuted
void setExecuted(bool state) const
Set the executed flag to the specified state.
Definition: LegacyAlgorithm.cpp:11
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
Gaudi::details::LegacyAlgorithmAdapter::execute
StatusCode execute(const EventContext &) const override final
Definition: Algorithm.h:45
Gaudi::details::LegacyAlgorithmAdapter::isExecuted
bool isExecuted() const
Has this algorithm been executed since the last reset?
Definition: LegacyAlgorithm.cpp:7
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
Gaudi::details::LegacyAlgorithmAdapter::filterPassed
bool filterPassed() const
Did this algorithm pass or fail its filter criterion for the last event?
Definition: LegacyAlgorithm.cpp:18
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:645