Back-end classes — the types provided by the back-end (boost::msm::back)
This header provides one type, state_machine, MSM's state machine engine implementation.
template <class Derived,class HistoryPolicy=NoHistory,class CompilePolicy=favor_runtime_speed> state_machine {
}
The start methods must be called before any call to process_event. It activates the entry action of the initial state(s). This allows you to choose when a state machine can start. (TODO in user guide)
void start();The event processing method implements the double-dispatch. Each call to this function with a new event type instantiates a new dispatch algorithm and increases compile-time.
template <class Event> HandledEnum
process_event(Event const&);Returns the ids of currently active states. You will typically need it only for debugging or logging purposes.
const int* current_state const();Returns the state whose id is given. As all states of a concrete state machine share a common base state, the return value is a base state. If the id corresponds to no state, a null pointer is returned.
const BaseState* get_state_by_id const(int id);Helper returning true if the state machine is contained as a submachine of another state machine.
bool is_contained const();Returns the required state of the state machine as a pointer. A compile error will occur if the state is not to be found in the state machine.
template <class State> State* get_state();Returns the required state of the state machine as a reference. A compile error will occur if the state is not to be found in the state machine.
template <class State> State&
get_state();Returns true if the given flag is currently active. A flag is active if the active state of one region is tagged with this flag (using OR as BinaryOp) or active states of all regions (using AND as BinaryOp)
template <class Flag,class BinaryOp> bool
is_flag_active();Returns true if the given flag is currently active. A flag is active if the active state of one region is tagged with this flag.
template <class Flag> bool
is_flag_active();Visits all active states and their substates. A state is visited
using the accept method without argument. The base
class of all states must provide an accept_sig
type.
void visit_current_states();Visits all active states and their substates. A state is visited
using the accept method with arguments. The base class
of all states must provide an accept_sig type defining
the signature and thus the number and type of the parameters.
void visit_current_states(any-type param1, any-type param2,...); Defers the provided event. This method can be called only if at
least one state defers an event or if the state machine provides the
activate_deferred_events(TODO example) type either
directly or using the deferred_events configuration of eUML
(configure_ << deferred_events)
template <class Event> void defer_event(Event const&);This nested type provides the necessary typedef for entry point
pseudostates.
state_machine<...>::entry_pt<state_name> is a
transition's valid target inside the containing state machine's
transition table.
entry_pt {
}
This header provides one type, args. which provides the necessary types for a visitor implementation.
This header provides the out-of-the-box history policies supported by MSM. There are 3 such policies. Every history policy must implement the following methods:
This method is called by msm::back::state_machine when constructed. It gives the policy a chance to save the ids of all initial states (passed as array).
void set_initial_states( | ); |
(int* const)
;This method is called by msm::back::state_machine when the submachine is exited. It gives the policy a chance to remember the ids of the last active substates of this submachine states (passed as array).
void history_exit( | ); |
(int* const)
;This method is called by msm::back::state_machine when the submachine is entered. It gives the policy a chance to set the the active states according to the policy's aim. The policy gets as parameter the event which activated the submachine and returns an array of active states ids.
template <class Event> int* const history_exit( | ); |
(Event const&)
;This policy is the default used by state_machine. No active state of a submachine is remembered and at every new activation of the submachine, the initial state(s) are activated.