Class Concurrence

Inheritance Relationships

Base Type

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::shared_ptr<State>, std::string> StateMap
typedef std::map<std::string, StateMap> OutcomeMap

Public Functions

Concurrence(std::set<std::shared_ptr<State>> states, std::string default_outcome, OutcomeMap outcome_map)

Constructs a State with a set of possible outcomes.

Parameters:

outcomes – A set of possible outcomes for this state.

virtual std::string execute(std::shared_ptr<blackboard::Blackboard> blackboard) override

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.

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::set<std::shared_ptr<State>> states

The states to run concurrently.

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::shared_ptr<State>, std::shared_ptr<std::string>> intermediate_outcome_map

Stores the intermedaite outcomes of the concurrent states.

std::set<std::string> possible_outcomes

The set of possible outcomes.