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

#include <MachineEventTransition.h>

+ Inheritance diagram for MachineEventTransition:
+ Collaboration diagram for MachineEventTransition:

Public Types

using Guard = std::function< bool(const QGCStateMachineEvent *)>
 

Public Member Functions

 MachineEventTransition (const QString &eventName, QAbstractState *target)
 
 MachineEventTransition (const QString &eventName, QAbstractState *target, Guard guard)
 
QString eventName () const
 
QVariant eventData () const
 Access the event data from the last matched event.
 
- Public Member Functions inherited from QGCAbstractTransition
 QGCAbstractTransition (QState *sourceState=nullptr)
 
 QGCAbstractTransition (QAbstractState *target, 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
 
void onTransition (QEvent *event) override
 
- Protected Member Functions inherited from QGCAbstractTransition
void onTransition (QEvent *event) override
 

Detailed Description

Transition that fires when a named event is posted to the state machine Use this for events posted via QGCStateMachine::postEvent/postDelayedEvent. For events on watched objects, use NamedEventTransition instead.

Definition at line 12 of file MachineEventTransition.h.

Member Typedef Documentation

◆ Guard

using MachineEventTransition::Guard = std::function<bool(const QGCStateMachineEvent*)>

Definition at line 18 of file MachineEventTransition.h.

Constructor & Destructor Documentation

◆ MachineEventTransition() [1/2]

MachineEventTransition::MachineEventTransition ( const QString &  eventName,
QAbstractState *  target 
)

Create transition for a named machine event

Parameters
eventNameThe event name to match
targetTarget state for the transition

Definition at line 4 of file MachineEventTransition.cc.

◆ MachineEventTransition() [2/2]

MachineEventTransition::MachineEventTransition ( const QString &  eventName,
QAbstractState *  target,
Guard  guard 
)

Create transition for a named machine event with guard

Parameters
eventNameThe event name to match
targetTarget state for the transition
guardPredicate that must return true for transition to fire

Definition at line 10 of file MachineEventTransition.cc.

Member Function Documentation

◆ eventData()

QVariant MachineEventTransition::eventData ( ) const
inline

Access the event data from the last matched event.

Definition at line 34 of file MachineEventTransition.h.

◆ eventName()

QString MachineEventTransition::eventName ( ) const
inline

Definition at line 31 of file MachineEventTransition.h.

◆ eventTest()

bool MachineEventTransition::eventTest ( QEvent *  event)
overrideprotectedvirtual

Implements QGCAbstractTransition.

Definition at line 17 of file MachineEventTransition.cc.

References QGCStateMachineEvent::EventType.

◆ onTransition()

void MachineEventTransition::onTransition ( QEvent *  event)
overrideprotected

Definition at line 41 of file MachineEventTransition.cc.


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