Name

Back-end classes — the types provided by the back-end (boost::msm::back)

state_machine.hpp

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 {
}

methods

start

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();

process_event

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&);

current_state

Returns the ids of currently active states. You will typically need it only for debugging or logging purposes.

const int* current_state const();

get_state_by_id

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);

is_contained

Helper returning true if the state machine is contained as a submachine of another state machine.

bool is_contained const();

get_state

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();

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();

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 (using OR as BinaryOp) or active states of all regions (using AND as BinaryOp)

template <class Flag,class BinaryOp> bool is_flag_active();

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();

visit_current_states

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();

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,...);

defer_event

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&);

Types

entry_pt

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 {
}

exit_pt

This nested type provides the necessary typedef for exit point pseudostates. state_machine<...>::exit_pt<state_name> is a transition's valid source inside the containing state machine's transition table.

 exit_pt {
}

direct

This nested type provides the necessary typedef for an explicit entry inside a submachine. state_machine<...>::direct<state_name> is a transition's valid target inside the containing state machine's transition table.

 direct {
}

args.hpp

This header provides one type, args. which provides the necessary types for a visitor implementation.

history_policies.hpp

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:

set_initial_states

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) ;
 

history_exit

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) ;
 

history_entry

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&) ;
 

NoHistory

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.

AlwaysHistory

This policy is a non-UML-standard extension. The active state(s) of a submachine is (are) always remembered at every new activation of the submachine.

ShallowHistory

This policy activates the active state(s) of a submachine if the event is found in the policy's event list.