15 #define ON_DEBUG if (UNLIKELY(outputLevel() <= MSG::DEBUG))
16 #define ON_VERBOSE if (UNLIKELY(outputLevel() <= MSG::VERBOSE))
23 m_branchFilterPassed( false )
54 std::vector<Algorithm*>* theAlgs;
55 std::vector<Algorithm*>::iterator it;
56 std::vector<Algorithm*>::iterator itend;
60 log <<
MSG::ERROR <<
"Unable to configure one or more sequencer members " <<
endmsg;
65 log <<
MSG::ERROR <<
"Unable to configure one or more branch members " <<
endmsg;
71 itend = theAlgs->end( );
72 for (it = theAlgs->begin(); it != itend; it++) {
83 itend = theAlgs->end( );
84 for (it = theAlgs->begin(); it != itend; it++) {
105 std::vector<Algorithm*>::iterator it;
106 std::vector<Algorithm*>::iterator itend = theAlgms->end( );
107 for (it = theAlgms->begin(); it != itend; it++) {
116 itend = theAlgms->end( );
117 for (it = theAlgms->begin(); it != itend; it++) {
150 if ( theAlgs->size( ) > 0 ) {
151 Algorithm* branchAlgorithm = (*theAlgs)[0];
152 if ( lastAlgorithm == branchAlgorithm ) {
184 std::vector<Algorithm*>::iterator it;
185 std::vector<Algorithm*>::iterator itend = theAlgs->end( );
186 for (it = theAlgs->begin(); it != itend; it++) {
190 log <<
MSG::ERROR <<
"Unable to finalize Algorithm "
203 std::vector<Algorithm*>* theAlgs;
204 std::vector<Algorithm*>::iterator it;
205 std::vector<Algorithm*>::iterator itend;
209 itend = theAlgs->end( );
210 for (it = theAlgs->begin(); it != itend; it++) {
221 itend = theAlgs->end( );
222 for (it = theAlgs->begin(); it != itend; it++) {
239 std::vector<Algorithm*>* theAlgs;
240 std::vector<Algorithm*>::iterator it;
241 std::vector<Algorithm*>::iterator itend;
244 itend = theAlgs->end( );
245 for (it = theAlgs->begin(); it != itend; it++) {
249 log <<
MSG::ERROR <<
"Unable to stop Algorithm "
255 itend = theAlgs->end( );
256 for (it = theAlgs->begin(); it != itend; it++) {
260 log <<
MSG::ERROR <<
"Unable to stop Algorithm "
281 std::vector<Algorithm*>::iterator it;
282 std::vector<Algorithm*>::iterator itend = theAlgs->end( );
283 for (it = theAlgs->begin(); it != itend; it++) {
299 for (it = theAlgs->begin(); it != itend; it++) {
311 itend = theAlgs->end( );
312 for (it = theAlgs->begin(); it != itend; it++) {
328 for (it = theAlgs->begin(); it != itend; it++) {
347 std::vector<Algorithm*>::iterator it;
348 std::vector<Algorithm*>::iterator itend = theAlgms->end( );
349 for (it = theAlgms->begin(); it != itend; it++) {
358 itend = theAlgms->end( );
359 for (it = theAlgms->begin(); it != itend; it++) {
377 std::vector<Algorithm*>::iterator it;
378 std::vector<Algorithm*>::iterator itend = subAlgms->end( );
379 for (it = subAlgms->begin(); it != itend; it++) {
387 itend = subAlgms->end( );
388 for (it = subAlgms->begin(); it != itend; it++) {
432 const std::string& name,
441 const std::string& name,
451 std::string theName = pAlgorithm->
name( );
466 std::string theName = pAlgorithm->
name( );
478 std::vector<Algorithm*>*
527 std::vector<Algorithm*>* theAlgs )
531 std::vector<Algorithm*>::iterator it;
532 std::vector<Algorithm*>::iterator itend = theAlgs->end( );
533 for (it = theAlgs->begin(); it != itend; it++) {
535 if ( theAlgorithm == pAlgorithm ) {
541 theAlgs->push_back( pAlgorithm );
549 const std::string& algName,
551 std::vector<Algorithm*>* theAlgs )
558 result = theAlgMgr->createAlgorithm( type, algName, tmp );
561 pAlgorithm =
dynamic_cast<Algorithm*
>(tmp);
562 theAlgs->push_back( pAlgorithm );
574 std::vector<Algorithm*>* theAlgs,
575 std::vector<bool>& theLogic )
586 const std::vector<std::string>& theNameVector = theNames.
value( );
587 std::vector<std::string>::const_iterator it;
588 std::vector<std::string>::const_iterator itend = theNameVector.end( );
589 for (it = theNameVector.begin(); it != itend; it++) {
598 std::string theName = typeName.
name();
599 std::string theType = typeName.
type();
607 bool isInverted =
false;
608 std::string::size_type invert = theName.find_first_of(
":" );
610 while ( std::string::npos != invert
611 && invert < (theName.size() - 1) && theName[invert+1] ==
':' )
612 invert = theName.find_first_of(
":", invert+2 );
613 if ( std::string::npos != invert ) {
614 if ( theName == theType ) {
617 theType = theType.substr( 0, invert );
619 theName = theName.substr( 0, invert );
631 log <<
MSG::WARNING << theName <<
" is not an Algorithm - Failed dynamic cast" <<
endmsg;
635 if ( theAlgorithm ) {
638 status =
append( theAlgorithm, theAlgs );
658 theLogic.push_back( isInverted );
664 if ( result.
isSuccess() && theAlgs->size() != 0 ) {
666 std::vector<Algorithm*>::iterator ai = theAlgs->begin();
667 std::vector<bool>::iterator li = theLogic.begin();
668 for ( ; ai != theAlgs->end(); ++ai, ++li ) {
670 if ( ai != theAlgs->begin() ) log <<
", ";
673 log << (*ai)->name();
677 if (*li) log <<
":invert";
686 std::vector<bool>& theLogic,
696 unsigned int size = theAlgs->size( );
697 for (
unsigned int i = first;
i < size;
i++) {
698 lastAlgorithm = (*theAlgs)[
i];
705 bool isInverted = theLogic[
i];
715 if ( ! passed )
break;
747 std::vector<Algorithm*>::iterator it;
748 std::vector<Algorithm*>::iterator itend = theAlgs->end( );
749 for (it = theAlgs->begin(); it != itend; it++) {
751 if ( theAlgorithm->
name( ) == algname ) {
755 log <<
MSG::INFO <<
"Sequencer::remove( ) isn't implemented yet!!!!!" <<
endmsg;
virtual bool isStopOverride() const
Has the StopOverride mode been set?
std::vector< Algorithm * > * subAlgorithms() const
List of sub-algorithms. Returns a pointer to a vector of (sub) Algorithms.
StatusCode append(Algorithm *pAlgorithm)
Append an algorithm to the sequencer.
Definition of the MsgStream class used to transmit messages.
virtual void setExecuted(bool state)
Set the executed flag to the specified state.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
StatusCode remove(Algorithm *pAlgorithm)
Remove the specified algorithm from the sequencer.
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
StatusCode removeFromBranch(Algorithm *pAlgorithm)
virtual bool filterPassed() const
Did this algorithm pass or fail its filter criterion for the last event?
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
virtual StatusCode sysExecute()
The actions to be performed by the algorithm on an event.
bool isSuccess() const
Test for a status code of SUCCESS.
void resetExecuted()
Reset the Sequencer executed state for the current event.
Sequencer(const std::string &name, ISvcLocator *svcloc)
Constructor(s)
virtual bool isEnabled() const
Is this algorithm enabled or disabled?
virtual StatusCode stop()
Sequencer finalization.
virtual bool branchFilterPassed() const
Was the branch filter passed for the last event?
virtual bool isExecuted() const
Has this algorithm been executed since the last reset?
virtual StatusCode beginRun()
Sequencer beginRun.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
void branchMembershipHandler(Property &theProp)
"BranchMembers" property handler
bool m_branchFilterPassed
BooleanProperty m_stopOverride
virtual StatusCode finalize()
Sequencer finalization.
virtual StatusCode sysStart()
Reinitialization method invoked by the framework.
StatusCode executeMember(Algorithm *theAlgorithm)
Execute member algorithm.
virtual StatusCode beginRun()
Algorithm begin run.
bool isFailure() const
Test for a status code of FAILURE.
StringArrayProperty m_branchNames
virtual StatusCode endRun()
Sequencer endRun.
virtual StatusCode reinitialize()
the default (empty) implementation of IStateful::reinitialize() method
virtual StatusCode endRun()
Algorithm end run. This method is called at the end of the event loop.
virtual StatusCode sysFinalize()
System finalization.
StatusCode decodeBranchMemberNames()
Decode branch member name list.
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
virtual StatusCode setBranchFilterPassed(bool state)
Set the branch filter passed flag for the last event.
Helper class to parse a string of format "type/name".
virtual void resetExecuted()
Reset the executed state of the Algorithm for the duration of the current event.
StatusCode decodeMemberNames()
Decode Member Name list.
bool isValid() const
Allow for check if smart pointer is valid.
StatusCode createAndAppendToBranch(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer branch.
This class is used for returning status codes from appropriate routines.
virtual void setFilterPassed(bool state)
Set the filter passed flag to the specified state.
virtual const std::string & name() const
The identifying name of the algorithm object.
virtual StatusCode start()
Sequencer finalization.
bool isInitialized() const
Has the Algorithm already been initialized?
virtual StatusCode initialize()
Initialization of a sequencer.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
TYPE * get() const
Get interface pointer.
The IAlgorithm is the interface implemented by the Algorithm base class.
const TYPE & value() const
explicit conversion
StatusCode decodeNames(StringArrayProperty &theNames, std::vector< Algorithm * > *theAlgs, std::vector< bool > &theLogic)
Decode algorithm names, creating or appending algorithms as appropriate.
virtual StatusCode reinitialize()
Sequencer Reinitialization.
std::vector< Algorithm * > * m_branchAlgs
Base class from which all concrete algorithm classes should be derived.
virtual StatusCode sysInitialize()
Initialization method invoked by the framework.
Property base class allowing Property* collections to be "homogeneous".
void membershipHandler(Property &theProp)
"Members" property handler
std::vector< bool > m_isInverted
StatusCode createAndAppend(const std::string &type, const std::string &name, Algorithm *&pAlgorithm)
Create a algorithm and append it to the sequencer.
const std::string & type() const
StatusCode appendToBranch(Algorithm *pAlgorithm)
Append an algorithm to the sequencer branch.
virtual ~Sequencer()
Destructor.
std::vector< Algorithm * > * branchAlgorithms() const
List of branch algorithms.
StringArrayProperty m_names
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual StatusCode sysStop()
System stop.
const std::string & name() const
StatusCode service(const std::string &name, T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
std::string typeName(const std::type_info &typ)
virtual StatusCode execute()
The actions to be performed by the sequencer on an event.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
std::vector< bool > m_isBranchInverted