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

Trampoline class to enable Python classes to inherit from C++ State. More...

Inheritance diagram for yasmin::PyState:
Collaboration diagram for yasmin::PyState:

Public Member Functions

std::string execute (std::shared_ptr< blackboard::Blackboard > blackboard) override
 Override execute() to call Python implementation. We wrap the C++ Blackboard in BlackboardPyWrapper before passing to Python. The GIL must be acquired before calling into Python.
 
void cancel_state () override
 Override cancel_state() to call Python implementation if available. The GIL must be acquired before calling into Python.
 
std::string to_string () override
 Override to_string(). The GIL must be acquired before calling into Python.
 
 State (const std::set< std::string > &outcomes)
 Constructs a State with a set of possible outcomes.
 
- 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.
 
std::set< std::string > const & get_outcomes ()
 Gets the set of possible outcomes for this state.
 

Additional Inherited Members

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

Detailed Description

Trampoline class to enable Python classes to inherit from C++ State.

This class allows Python code to override the virtual methods of the State class, particularly the execute() method, while maintaining C++ type safety and performance.

Member Function Documentation

◆ cancel_state()

void yasmin::PyState::cancel_state ( )
inlineoverridevirtual

Override cancel_state() to call Python implementation if available. The GIL must be acquired before calling into Python.

Reimplemented from yasmin::State.

◆ execute()

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

Override execute() to call Python implementation. We wrap the C++ Blackboard in BlackboardPyWrapper before passing to Python. The GIL must be acquired before calling into Python.

Reimplemented from yasmin::State.

◆ State()

State::State ( const std::set< std::string > & outcomes)

Constructs a State with a set of possible outcomes.

Parameters
outcomesA set of possible outcomes for this state.

◆ to_string()

std::string yasmin::PyState::to_string ( )
inlineoverridevirtual

Override to_string(). The GIL must be acquired before calling into Python.

Reimplemented from yasmin::State.


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