Class Concurrence
Defined in File concurrence.hpp
Inheritance Relationships
Base Type
public yasmin::State
(Class State)
Class Documentation
-
class Concurrence : public yasmin::State
Runs a series of states in parallel.
The Concurrence class runs a set of states concurrently, waiting for the termination of each, and then returns a single output according to a provided rule map, or a default outcome if no rule is satisfied.
Public Types
-
typedef std::map<std::string, std::string> StateOutcomeMap
-
typedef std::map<std::string, StateOutcomeMap> OutcomeMap
Public Functions
Constructs a State with a set of possible outcomes.
- Parameters:
states – A map of state names to states that will run concurrently.
default_outcome – The default outcome to return if no outcome map rules are satisfied.
outcome_map – A map of outcome names to requirements for achieving that outcome.
Executes the state’s specific logic.
This method is intended to be overridden by derived classes to provide specific execution logic.
- Parameters:
blackboard – A shared pointer to the Blackboard to use during execution.
- Returns:
A string representing the outcome of the execution.
-
virtual void cancel_state() override
Cancels the current state execution.
This method sets the canceled flag to true and logs the action.
-
std::map<std::string, std::shared_ptr<State>> get_states() const
Returns the map of states managed by this concurrence state.
- Returns:
A map of state names to states.
-
OutcomeMap get_outcome_map() const
Returns the outcome map for this concurrence state.
- Returns:
A map of outcome names to their requirements.
-
std::string get_default_outcome() const
Returns the default outcome for this concurrence state.
- Returns:
The default outcome as a string.
-
inline virtual std::string to_string() override
Converts the state to a string representation.
This method retrieves the demangled name of the class for a readable string representation.
- Returns:
A string representation of the state.
Protected Attributes
-
const std::map<std::string, std::shared_ptr<State>> states
The states to run concurrently (name -> state)
-
const std::string default_outcome
Default outcome.
-
OutcomeMap outcome_map
Specifies which combination of state outputs should produce a given overall output
-
std::map<std::string, std::shared_ptr<std::string>> intermediate_outcome_map
Stores the intermediate outcomes of the concurrent states.
-
std::set<std::string> possible_outcomes
The set of possible outcomes.
-
typedef std::map<std::string, std::string> StateOutcomeMap