The Gaudi Framework  v29r0 (ff2e7097)
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  bool isSequence() const override final { return true; }
99 
103  virtual bool branchFilterPassed() const;
104 
108  virtual StatusCode setBranchFilterPassed( bool state );
109 
113  virtual bool isStopOverride() const;
114 
118  StatusCode append( Algorithm* pAlgorithm );
119 
123  StatusCode appendToBranch( Algorithm* pAlgorithm );
124 
134  StatusCode createAndAppend( const std::string& type, // The concrete algorithm class of the algorithm
135  const std::string& name, // The name to be given to the algorithm
136  Algorithm*& pAlgorithm // Set to point to the newly created algorithm object
137  );
138 
148  StatusCode createAndAppendToBranch( const std::string& type, // The concrete algorithm class of the algorithm
149  const std::string& name, // The name to be given to the algorithm
150  Algorithm*& pAlgorithm // Set to point to the newly created algorithm object
151  );
152 
156  StatusCode remove( Algorithm* pAlgorithm );
157  StatusCode remove( const std::string& name );
158  StatusCode removeFromBranch( Algorithm* pAlgorithm );
159  StatusCode removeFromBranch( const std::string& name );
160 
167  const std::vector<Algorithm*>& branchAlgorithms() const;
168  std::vector<Algorithm*>& branchAlgorithms();
169 
171  StatusCode decodeMemberNames();
172 
174  StatusCode decodeBranchMemberNames();
175 
176 protected:
180  StatusCode append( Algorithm* pAlgorithm, std::vector<Algorithm*>& theAlgs );
181 
191  StatusCode createAndAppend( const std::string& type, // The concrete algorithm class of the algorithm
192  const std::string& name, // The name to be given to the algorithm
193  Algorithm*& pAlgorithm, // Set to point to the newly created algorithm object
194  std::vector<Algorithm*>& theAlgs );
195 
200  std::vector<bool>& theLogic );
201 
205  StatusCode execute( const std::vector<Algorithm*>& theAlgs, std::vector<bool>& theLogic, Algorithm*& lastAlgorithm,
206  unsigned int first = 0 );
207 
211  StatusCode executeMember( Algorithm* theAlgorithm );
212 
217  StatusCode remove( const std::string& algname, std::vector<Algorithm*>& theAlgs );
218 
219  // NO COPY / ASSIGNMENT ALLOWED
220  Sequencer( const Sequencer& a ) = delete;
221  Sequencer& operator=( const Sequencer& rhs ) = delete;
222 
223 public:
225  std::ostream& toControlFlowExpression( std::ostream& os ) const override;
226 
227 private:
228  /**************************
229  ** Private Data Members **
230  **************************/
231 
232  Gaudi::Property<std::vector<std::string>> m_names{this, "Members", {}, "member names"};
233  Gaudi::Property<std::vector<std::string>> m_branchNames{this, "BranchMembers", {}, "branch member names"};
234  Gaudi::Property<bool> m_stopOverride{this, "StopOverride", false, "stop on filter failure override"};
235 
236  std::vector<bool> m_isInverted; // Member logic inverted list
237  std::vector<Algorithm*> m_branchAlgs; // Branch algorithms
238  std::vector<bool> m_isBranchInverted; // Branch Member logic inverted list
239 
240  bool m_branchFilterPassed = false; // Branch filter passed flag
241 };
242 
243 #endif // ALGORITHM_SEQUENCER_H
StatusCode endRun() override
Algorithm end run. This method is called at the end of the event loop.
Definition: Algorithm.cpp:500
void resetExecuted() override
Reset the executed state of the Algorithm for the duration of the current event.
Definition: Algorithm.cpp:754
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isSequence() const override final
additional interface methods
Definition: Sequencer.h:98
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:731
Implementation of property with value of concrete type.
Definition: Property.h:319
std::ostream & toControlFlowExpression(std::ostream &os) const override
Produce string represention of the control flow expression.
Definition: Algorithm.cpp:996
StatusCode execute() override final
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
Definition: Algorithm.h:185
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Algorithm & operator=(const Algorithm &rhs)
Private assignment operator: NO ASSIGNMENT ALLOWED.
StatusCode beginRun() override
Algorithm begin run.
Definition: Algorithm.cpp:452
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
std::vector< Algorithm * > m_branchAlgs
Definition: Sequencer.h:237
std::vector< bool > m_isInverted
Definition: Sequencer.h:236
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition: Algorithm.h:179
StatusCode start() override
the default (empty) implementation of IStateful::start() method
Definition: Algorithm.h:181
StatusCode stop() override
the default (empty) implementation of IStateful::stop() method
Definition: Algorithm.h:183
ClassName: Sequencer.
Definition: Sequencer.h:23
#define GAUDI_API
Definition: Kernel.h:110
StatusCode reinitialize() override
the default (empty) implementation of IStateful::reinitialize() method
Definition: Algorithm.cpp:694
STL class.
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:238