12 #ifndef RBBOOSTSTATEMACHINE_H_
13 #define RBBOOSTSTATEMACHINE_H_
18 #include "xdaq2rc/RcmsStateNotifier.h"
19 #include "xdata/String.h"
20 #include "xdata/Bag.h"
21 #include "xdaq/Application.h"
23 #include <boost/statechart/event.hpp>
24 #include <boost/statechart/in_state_reaction.hpp>
25 #include <boost/statechart/state_machine.hpp>
26 #include <boost/statechart/state.hpp>
27 #include <boost/statechart/transition.hpp>
28 #include <boost/mpl/list.hpp>
29 #include <boost/shared_ptr.hpp>
31 #include "toolbox/task/Action.h"
32 #include "toolbox/task/WorkLoop.h"
33 #include "toolbox/task/WorkLoopFactory.h"
38 #include <semaphore.h>
40 namespace bsc = boost::statechart;
44 namespace rb_statemachine {
137 <<
"RBStateMachine: current state does not support operation >>discardDataEvent<<"
148 <<
"RBStateMachine: current state does not support operation >>discardDqmEvent<<"
167 virtual int stateID()
const = 0;
228 inline xdaq::Application*
getApp()
const {
336 typedef bsc::transition<Fail, Failed>
FT;
367 typedef bsc::transition<Configure, Configuring>
RT;
399 typedef bsc::transition<ConfigureDone, Ready>
CR;
438 typedef bsc::transition<Halt, Halting>
HT;
470 typedef bsc::transition<Enable, Enabling>
ET;
500 public toolbox::lang::Class {
504 typedef bsc::transition<EnableDone, Enabled>
ED;
536 typedef bsc::transition<Stop, Stopping>
ST;
566 public toolbox::lang::Class {
602 typedef bsc::transition<StopDone, Stopped>
SD;
621 void emergencyStop()
const;
630 bool destructionIsDone()
const;
643 typedef bsc::transition<HaltDone, Halted>
HD;
667 bool destructionIsDone()
const;
669 void doAsync()
const;
boost::mpl::list< ED > reactions
xdata::Boolean * foundRcmsStateListener()
virtual void do_stateNotify()=0
void transitionWriteLock()
virtual bool discardDataEvent(MemRef_t *bufRef) const
virtual void do_stateAction() const
virtual int stateID() const =0
boost::mpl::list< RT > reactions
virtual int stateID() const
void transitionReadLock()
virtual int stateID() const
bsc::transition< HaltDone, Halted > HD
boost::shared_ptr< SharedResources > SharedResourcesPtr_t
virtual void do_entryActionWork()
bool firstTimeInHalted() const
toolbox::mem::Reference MemRef_t
virtual std::string do_stateName() const
virtual int stateID() const
virtual int stateID() const
boost::mpl::list< CR > reactions
xdaq2rc::RcmsStateNotifier rcmsStateNotifier_
boost::mpl::list< ET > reactions
void connectToBUandSM() const
RBStateMachine(xdaq::Application *app, SharedResourcesPtr_t sr)
SharedResourcesPtr_t getSharedResources() const
virtual std::string do_stateName() const
virtual int stateID() const
bsc::transition< Fail, Failed > FT
virtual void do_exitActionWork()=0
void rcmsStateChangeNotify()
virtual std::string do_stateName() const
virtual void do_entryActionWork()
virtual void do_entryActionWork()
virtual void do_moveToFailedState(xcept::Exception &exception) const
virtual std::string do_stateName() const
virtual void do_stateNotify()
bsc::transition< EnableDone, Enabled > ED
void updateWebGUIInternalState(std::string newStateName) const
void updateWebGUIExternalState(std::string newStateName) const
virtual void do_exitActionWork()
pthread_rwlock_t transitionLock_
bsc::transition< ConfigureDone, Ready > CR
BaseState & getCurrentStateNC() const
void findRcmsStateListener(xdaq::Application *app)
virtual int stateID() const
bsc::transition< StopDone, Stopped > SD
boost::mpl::list< HT > reactions
boost::mpl::list< SD > reactions
bsc::transition< Stop, Stopping > ST
virtual int stateID() const
SharedResourcesPtr_t sharedResources_
bsc::transition< Halt, Halting > HT
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual void do_moveToFailedState(xcept::Exception &exception) const
virtual int stateID() const
void moveToFailedState(xcept::Exception &exception) const
virtual std::string do_stateName() const =0
xdata::String * getExternallyVisibleStatePtr()
virtual void do_exitActionWork()
virtual bool discardDqmEvent(MemRef_t *bufRef) const
xdata::String visibleStateName_
virtual void do_moveToFailedState(xcept::Exception &exception) const =0
virtual void do_exitActionWork()
bsc::transition< Configure, Configuring > RT
std::string getInternalStateName()
xdata::Bag< xdaq2rc::ClassnameAndInstance > * rcmsStateListener()
std::string getExternallyVisibleState()
boost::shared_ptr< RBStateMachine > RBStateMachinePtr
void setInternalStateName(const std::string &s)
virtual void do_moveToFailedState(xcept::Exception &exception) const
virtual int stateID() const
virtual void do_exitActionWork()
virtual void do_stateNotify()
virtual void do_stateNotify()
boost::mpl::list< FT > reactions
void setExternallyVisibleState(const std::string &s)
xdaq::Application * getApp() const
virtual int stateID() const
BaseState const & getCurrentState() const
virtual void do_entryActionWork()
std::string internalStateName_
void setFirstTimeInHaltedFalse()
boost::mpl::list< ST > reactions
virtual void do_stateNotify()
virtual void do_moveToFailedState(xcept::Exception &exception) const
virtual void do_stateAction() const
virtual void do_entryActionWork()=0
bsc::transition< Enable, Enabling > ET
std::string stateName() const
boost::mpl::list< HD > reactions
virtual int stateID() const