|
| Transition ()=default |
| Default constructor.
|
|
| Transition (const Transition &)=delete |
|
Transition & | operator= (const Transition &)=delete |
|
| Transition (Transition &&)=default |
| Move constructor (defaulted)
|
|
Transition & | operator= (Transition &&)=default |
| Move assignment operator (defaulted)
|
|
void | addPredicate (Predicate pred) |
| Adds a predicate (guard condition) to this transition.
|
|
void | addAction (Action action) |
| Adds an action to execute when this transition occurs.
|
|
void | setTargetState (std::string_view state) |
| Sets the target state for this transition.
|
|
bool | predicatesPass (const TEvent &event) const |
| Evaluates all predicates for this transition.
|
|
void | executeActions (const TEvent &event) const |
| Executes all actions associated with this transition.
|
|
std::string_view | getTargetState () const |
| Gets the target state for this transition.
|
|
const std::vector< Action > & | getActions () const |
| Gets all actions associated with this transition.
|
|
bool | hasPredicates () const |
| Checks if this transition has any predicates.
|
|
bool | hasActions () const |
| Checks if this transition has any actions.
|
|
bool | hasTargetState () const |
| Checks if this transition has a target state.
|
|
template<typename TEvent>
class fsmgine::Transition< TEvent >
Represents a transition between states in a finite state machine.
- Template Parameters
-
TEvent | The event type that triggers transitions |
A Transition encapsulates:
- Zero or more predicates (guard conditions) that must all pass for the transition to occur
- Zero or more actions to execute when the transition occurs
- The target state to transition to
Transitions are typically created using the FSMBuilder fluent API rather than directly.
- Predicate Evaluation
- If no predicates are added, the transition always passes
- If multiple predicates are added, ALL must return true (AND logic)
- Predicates are evaluated in the order they were added
- Action Execution
- Actions are executed in the order they were added
- Actions are only executed if all predicates pass
- Actions are executed before the state change occurs