PIP 5.6.1
Platform-Independent Primitives
Public Member Functions | List of all members
PITransitionBase Class Reference

Transition between states in PIStateMachine. More...

#include <pistatemachine_transition.h>

Inheritance diagram for PITransitionBase:
Inheritance graph
[legend]

Public Member Functions

 PITransitionBase (PIStateBase *source, PIStateBase *target, int event_id)
 Creates a transition from source to target for the specified event identifier.
 
virtual ~PITransitionBase ()
 Destroys the transition and its stored guard.
 
PIStateMachinemachine () const
 Returns the root state machine.
 
PIStateBasesource () const
 Returns the source state.
 
PIStateBasetarget () const
 Returns the target state.
 
template<typename R , typename... Args>
PITransitionBaseaddGuard (std::function< R(Args...)> f)
 Sets a guard function that must return bool.
 
template<typename L >
PITransitionBaseaddGuard (L f)
 Sets a guard from a lambda or other callable object.
 
template<typename... Args>
bool testGuard (Args... args)
 Tests the guard against event arguments passed to the transition.
 
PITransitionBaseaddAction (std::function< void()> a)
 Sets an action executed when the transition fires.
 
void makeAction ()
 Executes the transition action if it is set.
 
void trigger ()
 Triggers the transition and updates active states.
 

Detailed Description

Transition between states in PIStateMachine.

A transition can be triggered by an event or by a timeout. Optional guards are evaluated against arguments passed to PIStateMachine::postEvent().