The Gaudi Framework  v30r4 (9b837755)
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:
30  /*****************************
31  ** Public Function Members **
32  *****************************/
33 
40  StatusCode initialize() override;
41 
45  StatusCode reinitialize() override;
46 
50  StatusCode start() override;
51 
56  StatusCode execute() override;
57 
61  StatusCode stop() override;
62 
66  StatusCode finalize() override;
67 
71  void resetExecuted() override;
72 
80  bool isSequence() const override final { return true; }
81 
85  virtual bool branchFilterPassed() const;
86 
90  virtual StatusCode setBranchFilterPassed( bool state );
91 
95  virtual bool isStopOverride() const;
96 
100  StatusCode append( Algorithm* pAlgorithm );
101 
105  StatusCode appendToBranch( Algorithm* pAlgorithm );
106 
116  StatusCode createAndAppend( const std::string& type, // The concrete algorithm class of the algorithm
117  const std::string& name, // The name to be given to the algorithm
118  Algorithm*& pAlgorithm // Set to point to the newly created algorithm object
119  );
120 
130  StatusCode createAndAppendToBranch( const std::string& type, // The concrete algorithm class of the algorithm
131  const std::string& name, // The name to be given to the algorithm
132  Algorithm*& pAlgorithm // Set to point to the newly created algorithm object
133  );
134 
138  StatusCode remove( Algorithm* pAlgorithm );
139  StatusCode remove( const std::string& name );
140  StatusCode removeFromBranch( Algorithm* pAlgorithm );
141  StatusCode removeFromBranch( const std::string& name );
142 
149  const std::vector<Algorithm*>& branchAlgorithms() const;
150  std::vector<Algorithm*>& branchAlgorithms();
151 
153  StatusCode decodeMemberNames();
154 
156  StatusCode decodeBranchMemberNames();
157 
158 protected:
162  StatusCode append( Algorithm* pAlgorithm, std::vector<Algorithm*>& theAlgs );
163 
173  StatusCode createAndAppend( const std::string& type, // The concrete algorithm class of the algorithm
174  const std::string& name, // The name to be given to the algorithm
175  Algorithm*& pAlgorithm, // Set to point to the newly created algorithm object
176  std::vector<Algorithm*>& theAlgs );
177 
182  std::vector<bool>& theLogic );
183 
187  StatusCode execute( const std::vector<Algorithm*>& theAlgs, std::vector<bool>& theLogic, Algorithm*& lastAlgorithm,
188  unsigned int first = 0 );
189 
193  StatusCode executeMember( Algorithm* theAlgorithm );
194 
199  StatusCode remove( const std::string& algname, std::vector<Algorithm*>& theAlgs );
200 
201  // NO COPY / ASSIGNMENT ALLOWED
202  Sequencer( const Sequencer& a ) = delete;
203  Sequencer& operator=( const Sequencer& rhs ) = delete;
204 
205 public:
207  std::ostream& toControlFlowExpression( std::ostream& os ) const override;
208 
209 private:
210  /**************************
211  ** Private Data Members **
212  **************************/
213 
215  "Members",
216  {},
217  [this]( auto& ) {
218  if ( this->isInitialized() ) this->decodeMemberNames().ignore();
219 
220  },
221  "member names"};
223  "BranchMembers",
224  {},
225  [this]( auto& ) {
226  if ( this->isInitialized() )
227  this->decodeBranchMemberNames().ignore();
228  },
229  "branch member names"};
230  Gaudi::Property<bool> m_stopOverride{this, "StopOverride", false, "stop on filter failure override"};
231 
232  std::vector<bool> m_isInverted; // Member logic inverted list
233  std::vector<Algorithm*> m_branchAlgs; // Branch algorithms
234  std::vector<bool> m_isBranchInverted; // Branch Member logic inverted list
235 
236  bool m_branchFilterPassed = false; // Branch filter passed flag
237 };
238 
239 #endif // ALGORITHM_SEQUENCER_H
void resetExecuted() override
Reset the executed state of the Algorithm for the duration of the current event.
Definition: Algorithm.cpp:767
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isSequence() const override final
additional interface methods
Definition: Sequencer.h:80
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:747
Implementation of property with value of concrete type.
Definition: Property.h:383
std::ostream & toControlFlowExpression(std::ostream &os) const override
Produce string represention of the control flow expression.
Definition: Algorithm.cpp:979
StatusCode execute() override final
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
Definition: Algorithm.h:186
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
Algorithm(const std::string &name, ISvcLocator *svcloc, const std::string &version=PACKAGE_VERSION)
Constructor.
Definition: Algorithm.cpp:49
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
std::vector< Algorithm * > m_branchAlgs
Definition: Sequencer.h:233
std::vector< bool > m_isInverted
Definition: Sequencer.h:232
bool isInitialized() const override
Has the Algorithm already been initialized?
Definition: Algorithm.h:499
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition: Algorithm.h:180
StatusCode start() override
the default (empty) implementation of IStateful::start() method
Definition: Algorithm.h:182
Algorithm & operator=(const Algorithm &rhs)=delete
Private assignment operator: NO ASSIGNMENT ALLOWED.
StatusCode stop() override
the default (empty) implementation of IStateful::stop() method
Definition: Algorithm.h:184
ClassName: Sequencer.
Definition: Sequencer.h:23
#define GAUDI_API
Definition: Kernel.h:71
StatusCode reinitialize() override
the default (empty) implementation of IStateful::reinitialize() method
Definition: Algorithm.cpp:710
STL class.
std::vector< bool > m_isBranchInverted
Definition: Sequencer.h:234