ATLAS Offline Software
AlgorithmWrapper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 #ifndef EVENT_LOOP__ALGORITHM_WRAPPER_H
10 #define EVENT_LOOP__ALGORITHM_WRAPPER_H
11 
12 #include <EventLoop/Global.h>
13 
17 
18 namespace EL
19 {
21 
22  class AlgorithmWrapper final : public IAlgorithmWrapper
23  {
24  public:
25 
28 
30  void testInvariant () const;
31 
34 
36  AlgorithmWrapper (std::unique_ptr<Algorithm>&& val_algorithm);
37 
38 
39 
42 
43  virtual std::string_view getName () const override;
44 
45  virtual bool hasName (const std::string& name) const override;
46 
47  virtual std::unique_ptr<IAlgorithmWrapper> makeClone() const override;
48 
49  virtual Algorithm *getLegacyAlg () override;
50 
51  virtual StatusCode initialize (const AlgorithmWorkerData& workerData) override;
52 
53  virtual StatusCode execute () override;
54 
55  virtual StatusCode postExecute () override;
56 
57  virtual StatusCode finalize () override;
58 
60 
62 
64 
65 
66 
69 
70  private:
71 
73  std::unique_ptr<Algorithm> m_algorithm;
74 
76  bool m_firstFile {true};
77 
79  bool m_isInitialized {false};
80  };
81 }
82 
83 #endif
EL::AlgorithmWrapper::initialize
virtual StatusCode initialize(const AlgorithmWorkerData &workerData) override
call initialize on the algorithm
Definition: AlgorithmWrapper.cxx:88
EL::AlgorithmWrapper::makeClone
virtual std::unique_ptr< IAlgorithmWrapper > makeClone() const override
make a clone of this algorithm
Definition: AlgorithmWrapper.cxx:64
EL::AlgorithmWrapper::finalize
virtual StatusCode finalize() override
call finalize on the algorithm
Definition: AlgorithmWrapper.cxx:138
EL::AlgorithmWrapper::beginInputFile
virtual ::StatusCode beginInputFile() override
call beginInputFile on the algorithm
Definition: AlgorithmWrapper.cxx:178
EL::AlgorithmWrapper::m_firstFile
bool m_firstFile
whether this is the first file we encounter
Definition: AlgorithmWrapper.h:76
EL::AlgorithmWrapper::execute
virtual StatusCode execute() override
call execute on the algorithm
Definition: AlgorithmWrapper.cxx:106
EL::AlgorithmWrapper::getName
virtual std::string_view getName() const override
Definition: AlgorithmWrapper.cxx:46
EL::AlgorithmWrapper::fileExecute
virtual ::StatusCode fileExecute() override
call fileExecute on the algorithm
Definition: AlgorithmWrapper.cxx:162
EL::AlgorithmWrapper::testInvariant
void testInvariant() const
test the invariant of this object
Definition: AlgorithmWrapper.cxx:30
EL::AlgorithmWrapper::endInputFile
virtual ::StatusCode endInputFile() override
call endInputFile on the algorithm
Definition: AlgorithmWrapper.cxx:206
EL::AlgorithmWrapper::m_isInitialized
bool m_isInitialized
whether Algorithm::initialize has been called
Definition: AlgorithmWrapper.h:79
EL::AlgorithmWrapper::getLegacyAlg
virtual Algorithm * getLegacyAlg() override
get the legacy algorithm, if we wrap one
Definition: AlgorithmWrapper.cxx:79
EL::AlgorithmWrapper::m_algorithm
std::unique_ptr< Algorithm > m_algorithm
the actual algorithm
Definition: AlgorithmWrapper.h:73
AnaAlgorithm.h
EL::AlgorithmWrapper::postExecute
virtual StatusCode postExecute() override
call postExecute on the algorithm
Definition: AlgorithmWrapper.cxx:122
EL::Algorithm
Definition: Algorithm.h:22
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
EL::AlgorithmWorkerData
all the external components an algorithm needs before initialization (in EventLoop)
Definition: AlgorithmWorkerData.h:34
EL::IAlgorithmWrapper
a wrapper around a generic algorithm for use within EventLoop
Definition: IAlgorithmWrapper.h:48
EL::AlgorithmWrapper::hasName
virtual bool hasName(const std::string &name) const override
whether this algorithm has the given name
Definition: AlgorithmWrapper.cxx:55
EL::AlgorithmWrapper::AlgorithmWrapper
AlgorithmWrapper()
standard default constructor for serialization
Definition: AlgorithmWrapper.h:33
Global.h
IAlgorithmWrapper.h
EL::AlgorithmWrapper
an IAlgorithmWrapper for AnaAlgorithm
Definition: AlgorithmWrapper.h:23
AnaAlgorithmConfig.h