Sequencer.h
Go to the documentation of this file.
1 #ifndef ALGORITHM_SEQUENCER_H
2 #define ALGORITHM_SEQUENCER_H
3 
4 // Include files
6 #include "GaudiKernel/Property.h"
7 
8 class MsgStream;
9 
24 {
25 public:
29  Sequencer( const std::string& name, // The path object's name
30  ISvcLocator* svcloc // A pointer to a service location service
31  );
32 
36  ~Sequencer() override = default;
37 
38  /*****************************
39  ** Public Function Members **
40  *****************************/
41 
48  StatusCode initialize() override;
49 
53  StatusCode reinitialize() override;
54 
58  StatusCode start() override;
59 
64  StatusCode execute() override;
65 
69  StatusCode stop() override;
70 
74  StatusCode finalize() override;
75 
79  StatusCode beginRun() override;
80 
84  StatusCode endRun() override;
85 
89  void resetExecuted() override;
90 
98  virtual bool branchFilterPassed() const;
99 
103  virtual StatusCode setBranchFilterPassed( bool state );
104 
108  virtual bool isStopOverride() const;
109 
113  StatusCode append( Algorithm* pAlgorithm );
114 
118  StatusCode appendToBranch( Algorithm* pAlgorithm );
119 
129  StatusCode createAndAppend( const std::string& type, // The concrete algorithm class of the algorithm
130  const std::string& name, // The name to be given to the algorithm
131  Algorithm*& pAlgorithm // Set to point to the newly created algorithm object
132  );
133 
143  StatusCode createAndAppendToBranch( const std::string& type, // The concrete algorithm class of the algorithm
144  const std::string& name, // The name to be given to the algorithm
145  Algorithm*& pAlgorithm // Set to point to the newly created algorithm object
146  );
147 
151  StatusCode remove( Algorithm* pAlgorithm );
152  StatusCode remove( const std::string& name );
153  StatusCode removeFromBranch( Algorithm* pAlgorithm );
154  StatusCode removeFromBranch( const std::string& name );
155 
162  const std::vector<Algorithm*>& branchAlgorithms() const;
163  std::vector<Algorithm*>& branchAlgorithms();
164 
166  StatusCode decodeMemberNames();
167 
169  StatusCode decodeBranchMemberNames();
170 
171 protected:
175  StatusCode append( Algorithm* pAlgorithm, std::vector<Algorithm*>& theAlgs );
176 
186  StatusCode createAndAppend( const std::string& type, // The concrete algorithm class of the algorithm
187  const std::string& name, // The name to be given to the algorithm
188  Algorithm*& pAlgorithm, // Set to point to the newly created algorithm object
189  std::vector<Algorithm*>& theAlgs );
190 
195  std::vector<bool>& theLogic );
196 
200  StatusCode execute( const std::vector<Algorithm*>& theAlgs, std::vector<bool>& theLogic, Algorithm*& lastAlgorithm,
201  unsigned int first = 0 );
202 
206  StatusCode executeMember( Algorithm* theAlgorithm );
207 
212  StatusCode remove( const std::string& algname, std::vector<Algorithm*>& theAlgs );
213 
214  // NO COPY / ASSIGNMENT ALLOWED
215  Sequencer( const Sequencer& a ) = delete;
216  Sequencer& operator=( const Sequencer& rhs ) = delete;
217 
218 public:
220  std::ostream& toControlFlowExpression( std::ostream& os ) const override;
221 
222 private:
223  /**************************
224  ** Private Data Members **
225  **************************/
226 
227  Gaudi::Property<std::vector<std::string>> m_names{this, "Members", {}, "member names"};
228  Gaudi::Property<std::vector<std::string>> m_branchNames{this, "BranchMembers", {}, "branch member names"};
229  Gaudi::Property<bool> m_stopOverride{this, "StopOverride", false, "stop on filter failure override"};
230 
231  std::vector<bool> m_isInverted; // Member logic inverted list
232  std::vector<Algorithm*> m_branchAlgs; // Branch algorithms
233  std::vector<bool> m_isBranchInverted; // Branch Member logic inverted list
234 
235  bool m_branchFilterPassed = false; // Branch filter passed flag
236 };
237 
238 #endif // ALGORITHM_SEQUENCER_H
StatusCode endRun() override
Algorithm end run. This method is called at the end of the event loop.
Definition: Algorithm.cpp:495
void resetExecuted() override
Reset the executed state of the Algorithm for the duration of the current event.
Definition: Algorithm.cpp:747
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:727
Implementation of property with value of concrete type.
Definition: Property.h:314
std::ostream & toControlFlowExpression(std::ostream &os) const override
Produce string represention of the control flow expression.
Definition: Algorithm.cpp:986
StatusCode execute() override final
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
Definition: Algorithm.h:184
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Algorithm & operator=(const Algorithm &rhs)
Private assignment operator: NO ASSIGNMENT ALLOWED.
StatusCode beginRun() override
Algorithm begin run.
Definition: Algorithm.cpp:444
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
std::vector< Algorithm * > m_branchAlgs
Definition: Sequencer.h:232
std::vector< bool > m_isInverted
Definition: Sequencer.h:231
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition: Algorithm.h:178
StatusCode start() override
the default (empty) implementation of IStateful::start() method
Definition: Algorithm.h:180
StatusCode stop() override
the default (empty) implementation of IStateful::stop() method
Definition: Algorithm.h:182
ClassName: Sequencer.
Definition: Sequencer.h:23
#define GAUDI_API
Definition: Kernel.h:107
StatusCode reinitialize() override
the default (empty) implementation of IStateful::reinitialize() method
Definition: Algorithm.cpp:690
STL class.
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:233