Represents a trigger that can transition between different modes in a state machine.
More...
#include <Trigger.hpp>
|
| void | execute (void) |
| | Executes the trigger and invokes its registered callback.
|
| std::string | get_name (void) |
| | Gets the name of the trigger.
|
| std::string | get_value (void) |
| | Gets the value of the trigger.
|
| bool | is_available (void) |
| | Checks if the trigger is available for execution.
|
| void | register_callback (const std::function< void()> &callback) |
| | Registers a callback function to be executed when the trigger fires.
|
| void | set_name (std::string new_name) |
| | Sets a new name for the trigger.
|
| void | set_next_modes (std::vector< Mode > modes) |
| | Sets the next modes for this trigger.
|
| void | set_previous_modes (std::vector< Mode > modes) |
| | Sets the previous modes for this trigger.
|
| void | set_value (std::string new_value) |
| | Sets a new value for the trigger.
|
| | Trigger (std::string name, std::string value, std::vector< Mode > previous, std::vector< Mode > next) |
| | Constructor for Trigger.
|
| virtual | ~Trigger ()=default |
| | Destructor.
|
|
| std::function< void()> | cb |
| | Callback function.
|
Represents a trigger that can transition between different modes in a state machine.
A Trigger encapsulates the logic for transitioning from one or more previous modes to one or more next modes. It supports callbacks and maintains availability status.
◆ Trigger()
| roboligo::Trigger::Trigger |
( |
std::string | name, |
|
|
std::string | value, |
|
|
std::vector< Mode > | previous, |
|
|
std::vector< Mode > | next ) |
|
inline |
Constructor for Trigger.
- Parameters
-
| name | The name identifier of the trigger. |
| value | The value associated with the trigger. |
| previous | Vector of modes that precede this trigger. |
| next | Vector of modes that follow this trigger. |
◆ ~Trigger()
| virtual roboligo::Trigger::~Trigger |
( |
| ) |
|
|
virtualdefault |
◆ execute()
| void roboligo::Trigger::execute |
( |
void | | ) |
|
Executes the trigger and invokes its registered callback.
◆ get_name()
| std::string roboligo::Trigger::get_name |
( |
void | | ) |
|
Gets the name of the trigger.
- Returns
- The trigger's name as a string.
◆ get_value()
| std::string roboligo::Trigger::get_value |
( |
void | | ) |
|
Gets the value of the trigger.
- Returns
- The trigger's value as a string.
◆ is_available()
| bool roboligo::Trigger::is_available |
( |
void | | ) |
|
Checks if the trigger is available for execution.
- Returns
- True if the trigger is available, false otherwise.
◆ register_callback()
| void roboligo::Trigger::register_callback |
( |
const std::function< void()> & | callback | ) |
|
Registers a callback function to be executed when the trigger fires.
- Parameters
-
| callback | The callback function to register. |
◆ set_name()
| void roboligo::Trigger::set_name |
( |
std::string | new_name | ) |
|
Sets a new name for the trigger.
- Parameters
-
| new_name | The new name to assign. |
◆ set_next_modes()
| void roboligo::Trigger::set_next_modes |
( |
std::vector< Mode > | modes | ) |
|
Sets the next modes for this trigger.
- Parameters
-
| modes | Vector of modes to set as next. |
◆ set_previous_modes()
| void roboligo::Trigger::set_previous_modes |
( |
std::vector< Mode > | modes | ) |
|
Sets the previous modes for this trigger.
- Parameters
-
| modes | Vector of modes to set as previous. |
◆ set_value()
| void roboligo::Trigger::set_value |
( |
std::string | new_value | ) |
|
Sets a new value for the trigger.
- Parameters
-
| new_value | The new value to assign. |
◆ available_
| bool roboligo::Trigger::available_ {false} |
|
protected |
◆ cb
| std::function<void()> roboligo::Trigger::cb |
◆ name_
| std::string roboligo::Trigger::name_ |
|
protected |
◆ next_
| std::vector<Mode> roboligo::Trigger::next_ |
|
protected |
◆ previous_
| std::vector<Mode> roboligo::Trigger::previous_ |
|
protected |
Vector of previous modes.
◆ value_
| std::string roboligo::Trigger::value_ |
|
protected |
The documentation for this class was generated from the following files:
- roboligo_common/include/roboligo_common/classification/Trigger.hpp
- roboligo_common/src/roboligo_common/classification/Trigger.cpp