16#ifndef YASMIN__STATE_HPP_
17#define YASMIN__STATE_HPP_
120 std::
string operator()(
Blackboard::SharedPtr blackboard);
A thread-safe storage for key-value pairs of varying types.
Definition blackboard.hpp:64
Represents a state in a state machine.
Definition state.hpp:46
bool is_running() const noexcept
Checks if the state is currently running.
Definition state.cpp:48
StateStatus get_status() const
Gets the current status of the state.
Definition state.cpp:42
Outcomes outcomes
The possible outcomes of this state.
Definition state.hpp:50
bool is_idle() const noexcept
Checks if the state is idle.
Definition state.cpp:44
virtual ~State()=default
Virtual destructor for proper polymorphic destruction.
State(const Outcomes &outcomes)
Shared pointer type for State.
Definition state.cpp:32
virtual std::string execute(Blackboard::SharedPtr blackboard)
Executes the state's specific logic.
Definition state.hpp:131
std::atomic< StateStatus > status
Current status of the state.
Definition state.hpp:54
bool is_canceled() const noexcept
Checks if the state has been canceled.
Definition state.cpp:52
void set_status(StateStatus new_status)
Sets the current status of the state.
Definition state.cpp:38
bool is_completed() const noexcept
Checks if the state has completed execution.
Definition state.cpp:56
virtual std::string to_string() const
Converts the state to a string representation.
Definition state.cpp:108
Outcomes const & get_outcomes() const noexcept
Gets the set of possible outcomes for this state.
Definition state.cpp:106
virtual void cancel_state()
Cancels the current state execution.
Definition state.hpp:141
#define YASMIN_LOG_INFO(text,...)
Definition logs.hpp:169
Definition blackboard.hpp:31
StringSet Outcomes
Set of possible outcomes for states.
Definition types.hpp:77
StateStatus
Enumeration representing the current status of a state.
Definition state.hpp:31
@ RUNNING
State is currently executing.
Definition state.hpp:33
@ COMPLETED
State execution has completed successfully.
Definition state.hpp:35
@ IDLE
State is idle and ready to execute.
Definition state.hpp:32
@ CANCELED
State execution has been canceled.
Definition state.hpp:34
#define YASMIN_PTR_ALIASES(ClassName)
Macro to define all pointer aliases for a class.
Definition types.hpp:52