17#ifndef YASMIN__CONCURRENCE_HPP_
18#define YASMIN__CONCURRENCE_HPP_
74 const State::SharedPtr &state);
132 std::
string execute(Blackboard::SharedPtr blackboard) override;
Runs a series of states in parallel.
Definition concurrence.hpp:40
const StateMap states
The states to run concurrently (name -> state).
Definition concurrence.hpp:44
std::string execute(Blackboard::SharedPtr blackboard) override
Executes the state's specific logic.
Definition concurrence.cpp:153
std::atomic_bool configured
Flag to indicate if this concurrence state has been configured.
Definition concurrence.hpp:66
ParameterMappingsMap parameter_mappings
Per-child parameter mappings applied during configure().
Definition concurrence.hpp:59
void configure() override
Configures this concurrence state and all of its children.
Definition concurrence.cpp:136
Outcomes possible_outcomes
The set of possible outcomes.
Definition concurrence.hpp:57
void set_parameter_mappings(const std::string &state_name, const ParameterMappings ¶meter_mappings)
Sets parameter mappings for a child state.
Definition concurrence.cpp:87
Concurrence(const StateMap &states, const std::string &default_outcome, const OutcomeMap &outcome_map, const ParameterMappingsMap ¶meter_mappings={})
Shared pointer type for Concurrence.
Definition concurrence.cpp:31
StateOutcomeMap intermediate_outcome_map
Stores the intermediate outcomes of the concurrent states.
Definition concurrence.hpp:54
std::string to_string() const override
Converts the state to a string representation.
Definition concurrence.cpp:266
const std::string & get_default_outcome() const noexcept
Returns the default outcome for this concurrence state.
Definition concurrence.cpp:248
void cancel_state() override
Cancels the current state execution.
Definition concurrence.cpp:233
const StateMap & get_states() const noexcept
Returns the map of states managed by this concurrence state.
Definition concurrence.cpp:240
std::mutex intermediate_outcome_mutex
Mutex for intermediate outcome map.
Definition concurrence.hpp:63
void apply_parameter_mappings(const std::string &state_name, const State::SharedPtr &state)
Applies this container's parameter mappings to a direct child.
Definition concurrence.cpp:105
const ParameterMappingsMap & get_parameter_mappings() const noexcept
Returns the parameter mappings for this concurrence state.
Definition concurrence.cpp:101
const std::string default_outcome
Default outcome.
Definition concurrence.hpp:47
OutcomeMap outcome_map
Definition concurrence.hpp:51
static Outcomes generate_possible_outcomes(const OutcomeMap &outcome_map, const std::string &default_outcome)
Helper function to generate a set of possible outcomes from an outcome map.
Definition concurrence.cpp:253
const OutcomeMap & get_outcome_map() const noexcept
Returns the outcome map for this concurrence state.
Definition concurrence.cpp:244
State(const Outcomes &outcomes)
Shared pointer type for State.
Definition state.cpp:64
Definition blackboard.hpp:34
std::unordered_map< std::string, StateOutcomeMap > OutcomeMap
Map of outcomes to state outcome maps.
Definition types.hpp:81
std::unordered_map< std::string, std::shared_ptr< State > > StateMap
Map of state names to state pointers.
Definition types.hpp:108
StringSet Outcomes
Set of possible outcomes for states.
Definition types.hpp:77
StringMap StateOutcomeMap
Map of state names to their outcomes.
Definition types.hpp:79
std::unordered_map< std::string, ParameterMappings > ParameterMappingsMap
Map of state names to parameter mappings.
Definition types.hpp:94
StringMap ParameterMappings
Map of child parameter names to parent parameter names.
Definition types.hpp:92
#define YASMIN_PTR_ALIASES(ClassName)
Macro to define all pointer aliases for a class.
Definition types.hpp:52