C++ YASMIN (Yet Another State MachINe)
Loading...
Searching...
No Matches
FooState Class Reference

Represents the "Foo" state in the state machine. More...

Inheritance diagram for FooState:
Collaboration diagram for FooState:

Public Member Functions

 FooState ()
 Represents the "Foo" state in the state machine.
 
std::string execute (std::shared_ptr< blackboard::Blackboard > blackboard) override
 Executes the Foo state logic.
 
 FooState ()
 
std::string execute (std::shared_ptr< blackboard::Blackboard > blackboard) override
 Executes the state's specific logic.
 
 FooState ()
 
std::string execute (std::shared_ptr< blackboard::Blackboard > blackboard) override
 Executes the state's specific logic.
 
 FooState ()
 Constructs a FooState object, initializing the counter.
 
std::string execute (std::shared_ptr< yasmin::blackboard::Blackboard > blackboard) override
 Executes the Foo state logic.
 
 FooState ()
 Constructs a FooState object, initializing the counter.
 
std::string execute (std::shared_ptr< yasmin::blackboard::Blackboard > blackboard) override
 Executes the Foo state logic.
 
 FooState ()
 Constructs a FooState object, initializing the counter.
 
std::string execute (std::shared_ptr< yasmin::blackboard::Blackboard > blackboard) override
 Executes the Foo state logic.
 
 FooState ()
 Constructs a FooState object, initializing the counter.
 
std::string execute (std::shared_ptr< yasmin::blackboard::Blackboard > blackboard) override
 Executes the Foo state logic.
 
- Public Member Functions inherited from yasmin::State
 State (const std::set< std::string > &outcomes)
 Constructs a State with a set of possible outcomes.
 
StateStatus get_status () const
 Gets the current status of the state.
 
bool is_idle () const
 Checks if the state is idle.
 
bool is_running () const
 Checks if the state is currently running.
 
bool is_canceled () const
 Checks if the state has been canceled.
 
bool is_completed () const
 Checks if the state has completed execution.
 
std::string operator() (std::shared_ptr< blackboard::Blackboard > blackboard)
 Executes the state and returns the outcome.
 
virtual void cancel_state ()
 Cancels the current state execution.
 
std::set< std::string > const & get_outcomes ()
 Gets the set of possible outcomes for this state.
 
virtual std::string to_string ()
 Converts the state to a string representation.
 

Private Attributes

int counter
 Counter to track the number of executions.
 

Additional Inherited Members

- Protected Attributes inherited from yasmin::State
std::set< std::string > outcomes
 The possible outcomes of this state.
 

Detailed Description

Represents the "Foo" state in the state machine.

This state increments a counter each time it is executed and communicates the current count via the blackboard.

Constructor & Destructor Documentation

◆ FooState() [1/7]

FooState::FooState ( )
inline

Represents the "Foo" state in the state machine.

This state increments a counter each time it is executed and communicates the current count via the blackboard.

◆ FooState() [2/7]

FooState::FooState ( )
inline

◆ FooState() [3/7]

FooState::FooState ( )
inline

◆ FooState() [4/7]

FooState::FooState ( )
inline

Constructs a FooState object, initializing the counter.

◆ FooState() [5/7]

FooState::FooState ( )
inline

Constructs a FooState object, initializing the counter.

◆ FooState() [6/7]

FooState::FooState ( )
inline

Constructs a FooState object, initializing the counter.

◆ FooState() [7/7]

FooState::FooState ( )
inline

Constructs a FooState object, initializing the counter.

Member Function Documentation

◆ execute() [1/7]

std::string FooState::execute ( std::shared_ptr< blackboard::Blackboard > blackboard)
inlineoverridevirtual

Executes the Foo state logic.

This method logs the execution, waits for 3 seconds, increments the counter, and sets a string in the blackboard. The state will transition to either "outcome1" or "outcome2" based on the current value of the counter.

Parameters
blackboardShared pointer to the blackboard for state communication.
Returns
std::string The outcome of the execution: "outcome1" or "outcome2".

Reimplemented from yasmin::State.

◆ execute() [2/7]

std::string FooState::execute ( std::shared_ptr< blackboard::Blackboard > blackboard)
inlineoverridevirtual

Executes the state's specific logic.

Parameters
blackboardA shared pointer to the Blackboard to use during execution.
Returns
A string representing the outcome of the execution.

This method is intended to be overridden by derived classes to provide specific execution logic.

Reimplemented from yasmin::State.

◆ execute() [3/7]

std::string FooState::execute ( std::shared_ptr< blackboard::Blackboard > blackboard)
inlineoverridevirtual

Executes the state's specific logic.

Parameters
blackboardA shared pointer to the Blackboard to use during execution.
Returns
A string representing the outcome of the execution.

This method is intended to be overridden by derived classes to provide specific execution logic.

Reimplemented from yasmin::State.

◆ execute() [4/7]

std::string FooState::execute ( std::shared_ptr< yasmin::blackboard::Blackboard > blackboard)
inlineoverridevirtual

Executes the Foo state logic.

This method logs the execution, waits for 3 seconds, increments the counter, and sets a string in the blackboard. The state will transition to either "outcome1" or "outcome2" based on the current value of the counter.

Parameters
blackboardShared pointer to the blackboard for state communication.
Returns
std::string The outcome of the execution: "outcome1" or "outcome2".

Reimplemented from yasmin::State.

◆ execute() [5/7]

std::string FooState::execute ( std::shared_ptr< yasmin::blackboard::Blackboard > blackboard)
inlineoverridevirtual

Executes the Foo state logic.

This method logs the execution, waits for 3 seconds, increments the counter, and sets a string in the blackboard. The state will transition to either "outcome1" or "outcome2" based on the current value of the counter.

Parameters
blackboardShared pointer to the blackboard for state communication.
Returns
std::string The outcome of the execution: "outcome1" or "outcome2".

Reimplemented from yasmin::State.

◆ execute() [6/7]

std::string FooState::execute ( std::shared_ptr< yasmin::blackboard::Blackboard > blackboard)
inlineoverridevirtual

Executes the Foo state logic.

Executes the logic for the Foo state.

Parameters
blackboardShared pointer to the blackboard for state communication.
Returns
std::string The outcome of the execution, which can be SUCCEED.

Reimplemented from yasmin::State.

◆ execute() [7/7]

std::string FooState::execute ( std::shared_ptr< yasmin::blackboard::Blackboard > blackboard)
inlineoverridevirtual

Executes the Foo state logic.

This method logs the execution, waits for 3 seconds, increments the counter, and sets a string in the blackboard. The state will transition to either "outcome1" or "outcome2" based on the current value of the counter.

Parameters
blackboardShared pointer to the blackboard for state communication.
Returns
std::string The outcome of the execution: "outcome1" or "outcome2".

Reimplemented from yasmin::State.

Member Data Documentation

◆ counter

int FooState::counter
private

Counter to track the number of executions.


The documentation for this class was generated from the following files: