|
C++ YASMIN (Yet Another State MachINe)
|
Represents a state that executes a callback function. More...
#include <cb_state.hpp>


Public Member Functions | |
| CbState (const Outcomes &outcomes, CbStateCallback callback) | |
| Shared pointer type for CbState. | |
| std::string | execute (Blackboard::SharedPtr blackboard) override |
| Executes the callback function. | |
Public Member Functions inherited from yasmin::State | |
| State (const Outcomes &outcomes) | |
| Shared pointer type for State. | |
| virtual | ~State ()=default |
| Virtual destructor for proper polymorphic destruction. | |
| bool | is_idle () const noexcept |
| Checks if the state is idle. | |
| bool | is_running () const noexcept |
| Checks if the state is currently running. | |
| bool | is_canceled () const noexcept |
| Checks if the state has been canceled. | |
| bool | is_completed () const noexcept |
| Checks if the state has completed execution. | |
| std::string | operator() (Blackboard::SharedPtr blackboard) |
| Executes the state and returns the outcome. | |
| virtual void | cancel_state () |
| Cancels the current state execution. | |
| Outcomes const & | get_outcomes () const noexcept |
| Gets the set of possible outcomes for this state. | |
| virtual std::string | to_string () const |
| Converts the state to a string representation. | |
Private Attributes | |
| CbStateCallback | callback |
| Pointer to the callback function to be executed. | |
Additional Inherited Members | |
Protected Attributes inherited from yasmin::State | |
| Outcomes | outcomes |
| The possible outcomes of this state. | |
Represents a state that executes a callback function.
The CbState class inherits from the State class and is designed to execute a user-defined callback function, utilizing a shared pointer to a Blackboard object to obtain necessary data.
| yasmin::CbState::CbState | ( | const Outcomes & | outcomes, |
| CbStateCallback | callback ) |
|
overridevirtual |
Executes the callback function.
This function is called to execute the callback and retrieve the result. It may use the provided Blackboard for additional data.
| blackboard | A shared pointer to the Blackboard object used during execution. |
| std::runtime_error | If the callback execution fails. |
Reimplemented from yasmin::State.
|
private |
Pointer to the callback function to be executed.