QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GuardedTransition Class Reference

#include <GuardedTransition.h>

+ Inheritance diagram for GuardedTransition:
+ Collaboration diagram for GuardedTransition:

Public Types

using Guard = std::function< bool()>
 

Public Member Functions

template<typename Func >
 GuardedTransition (const typename QtPrivate::FunctionPointer< Func >::Object *sender, Func signalFn, QAbstractState *target, Guard guard)
 
template<typename Func >
 GuardedTransition (const typename QtPrivate::FunctionPointer< Func >::Object *sender, Func signalFn, Guard guard)
 
void setGuard (Guard guard)
 Set the guard predicate.
 
Guard guard () const
 Get the current guard predicate.
 
- Public Member Functions inherited from QGCSignalTransition
 QGCSignalTransition (QState *sourceState=nullptr)
 
 QGCSignalTransition (const QObject *sender, const char *signal, QState *sourceState=nullptr)
 
template<typename Func >
 QGCSignalTransition (const typename QtPrivate::FunctionPointer< Func >::Object *sender, Func signalFn, QState *sourceState=nullptr)
 
QGCStateMachinemachine () const
 Get the QGCStateMachine this transition belongs to.
 
Vehiclevehicle () const
 Get the Vehicle associated with the state machine.
 

Protected Member Functions

bool eventTest (QEvent *event) override
 Override to check guard before allowing transition.
 

Detailed Description

A transition that only fires if a guard predicate returns true Useful for conditional transitions based on runtime state

Definition at line 9 of file GuardedTransition.h.

Member Typedef Documentation

◆ Guard

using GuardedTransition::Guard = std::function<bool()>

Definition at line 15 of file GuardedTransition.h.

Constructor & Destructor Documentation

◆ GuardedTransition() [1/2]

template<typename Func >
GuardedTransition::GuardedTransition ( const typename QtPrivate::FunctionPointer< Func >::Object *  sender,
Func  signalFn,
QAbstractState *  target,
Guard  guard 
)
inline

Create a guarded transition

Parameters
senderObject that emits the signal
signalSignal that triggers the transition
targetTarget state
guardPredicate that must return true for transition to fire

Definition at line 23 of file GuardedTransition.h.

◆ GuardedTransition() [2/2]

template<typename Func >
GuardedTransition::GuardedTransition ( const typename QtPrivate::FunctionPointer< Func >::Object *  sender,
Func  signalFn,
Guard  guard 
)
inline

Create a guarded transition without target (set later)

Parameters
senderObject that emits the signal
signalSignal that triggers the transition
guardPredicate that must return true for transition to fire

Definition at line 38 of file GuardedTransition.h.

Member Function Documentation

◆ eventTest()

bool GuardedTransition::eventTest ( QEvent *  event)
overrideprotected

Override to check guard before allowing transition.

Definition at line 4 of file GuardedTransition.cc.

◆ guard()

Guard GuardedTransition::guard ( ) const
inline

Get the current guard predicate.

Definition at line 50 of file GuardedTransition.h.

Referenced by setGuard().

◆ setGuard()

void GuardedTransition::setGuard ( Guard  guard)
inline

Set the guard predicate.

Definition at line 47 of file GuardedTransition.h.

References guard().


The documentation for this class was generated from the following files: