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

A wrapper around the C++ Blackboard that stores Python objects and native types. More...

#include <blackboard_pywrapper.hpp>

Collaboration diagram for yasmin::BlackboardPyWrapper:

Public Member Functions

 BlackboardPyWrapper ()
 
 BlackboardPyWrapper (Blackboard &&other)
 Construct from an existing C++ Blackboard (move constructor)
 
 BlackboardPyWrapper (Blackboard::SharedPtr bb_ptr)
 Construct by wrapping a shared_ptr to a C++ Blackboard.
 
void set (const std::string &key, py::object value)
 Set a Python object in the blackboard.
 
py::object get (const std::string &key) const
 Get a Python object from the blackboard.
 
void remove (const std::string &key)
 Remove a value from the blackboard.
 
bool contains (const std::string &key) const
 Check if a key exists in the blackboard.
 
int size () const
 Get the number of key-value pairs in the blackboard.
 
std::string to_string () const
 Convert the contents of the blackboard to a string.
 
void set_remappings (const Remappings &remappings)
 Set the remappings of the blackboard.
 
const Remappingsget_remappings () const
 Get the remappings of the blackboard.
 
Blackboard::SharedPtr get_cpp_blackboard () const
 Get a shared pointer to the underlying C++ Blackboard.
 

Private Attributes

Blackboard::SharedPtr blackboard
 Underlying C++ Blackboard instance.
 

Detailed Description

A wrapper around the C++ Blackboard that stores Python objects and native types.

This wrapper provides a Python-friendly interface to the C++ Blackboard, automatically converting between C++ types (like std::string) and Python objects when accessing blackboard values.

Constructor & Destructor Documentation

◆ BlackboardPyWrapper() [1/3]

yasmin::BlackboardPyWrapper::BlackboardPyWrapper ( )
inline

◆ BlackboardPyWrapper() [2/3]

yasmin::BlackboardPyWrapper::BlackboardPyWrapper ( Blackboard && other)
inline

Construct from an existing C++ Blackboard (move constructor)

◆ BlackboardPyWrapper() [3/3]

yasmin::BlackboardPyWrapper::BlackboardPyWrapper ( Blackboard::SharedPtr bb_ptr)
inlineexplicit

Construct by wrapping a shared_ptr to a C++ Blackboard.

Member Function Documentation

◆ contains()

bool yasmin::BlackboardPyWrapper::contains ( const std::string & key) const
inline

Check if a key exists in the blackboard.

Parameters
keyThe key to check.
Returns
True if the key exists, false otherwise.

◆ get()

py::object yasmin::BlackboardPyWrapper::get ( const std::string & key) const
inline

Get a Python object from the blackboard.

Parameters
keyThe key associated with the value.
Returns
The Python object.
Exceptions
std::runtime_errorif the key does not exist.

◆ get_cpp_blackboard()

Blackboard::SharedPtr yasmin::BlackboardPyWrapper::get_cpp_blackboard ( ) const
inline

Get a shared pointer to the underlying C++ Blackboard.

Returns
Shared pointer to the C++ Blackboard

◆ get_remappings()

const Remappings & yasmin::BlackboardPyWrapper::get_remappings ( ) const
inline

Get the remappings of the blackboard.

Returns
The remappings of the blackboard.

◆ remove()

void yasmin::BlackboardPyWrapper::remove ( const std::string & key)
inline

Remove a value from the blackboard.

Parameters
keyThe key associated with the value to remove.

◆ set()

void yasmin::BlackboardPyWrapper::set ( const std::string & key,
py::object value )
inline

Set a Python object in the blackboard.

Parameters
keyThe key to associate with the value.
valueThe Python object to store.

◆ set_remappings()

void yasmin::BlackboardPyWrapper::set_remappings ( const Remappings & remappings)
inline

Set the remappings of the blackboard.

Parameters
remappingsThe remappings to set.

◆ size()

int yasmin::BlackboardPyWrapper::size ( ) const
inline

Get the number of key-value pairs in the blackboard.

Returns
The size of the blackboard.

◆ to_string()

std::string yasmin::BlackboardPyWrapper::to_string ( ) const
inline

Convert the contents of the blackboard to a string.

Returns
A string representation of the blackboard.

Member Data Documentation

◆ blackboard

Blackboard::SharedPtr yasmin::BlackboardPyWrapper::blackboard
private

Underlying C++ Blackboard instance.


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