C++ YASMIN (Yet Another State MachINe)
Loading...
Searching...
No Matches
yasmin::blackboard::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::blackboard::BlackboardPyWrapper:

Public Member Functions

 BlackboardPyWrapper ()
 
 BlackboardPyWrapper (Blackboard &&other)
 Construct from an existing C++ Blackboard (move constructor)
 
 BlackboardPyWrapper (std::shared_ptr< Blackboard > 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)
 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)
 Check if a key exists in the blackboard.
 
int size ()
 Get the number of key-value pairs in the blackboard.
 
std::string to_string ()
 Convert the contents of the blackboard to a string.
 
void set_remappings (const std::map< std::string, std::string > &remappings)
 Set the remappings of the blackboard.
 
std::map< std::string, std::string > get_remappings ()
 Get the remappings of the blackboard.
 
std::shared_ptr< Blackboardget_cpp_blackboard ()
 Get a shared pointer to the underlying C++ Blackboard.
 

Private Attributes

std::shared_ptr< Blackboardblackboard
 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::blackboard::BlackboardPyWrapper::BlackboardPyWrapper ( )
inline

◆ BlackboardPyWrapper() [2/3]

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

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

◆ BlackboardPyWrapper() [3/3]

yasmin::blackboard::BlackboardPyWrapper::BlackboardPyWrapper ( std::shared_ptr< Blackboard > bb_ptr)
inlineexplicit

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

Member Function Documentation

◆ contains()

bool yasmin::blackboard::BlackboardPyWrapper::contains ( const std::string & key)
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::blackboard::BlackboardPyWrapper::get ( const std::string & key)
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()

std::shared_ptr< Blackboard > yasmin::blackboard::BlackboardPyWrapper::get_cpp_blackboard ( )
inline

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

Returns
Shared pointer to the C++ Blackboard

◆ get_remappings()

std::map< std::string, std::string > yasmin::blackboard::BlackboardPyWrapper::get_remappings ( )
inline

Get the remappings of the blackboard.

Returns
The remappings of the blackboard.

◆ remove()

void yasmin::blackboard::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::blackboard::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::blackboard::BlackboardPyWrapper::set_remappings ( const std::map< std::string, std::string > & remappings)
inline

Set the remappings of the blackboard.

Parameters
remappingsThe remappings to set.

◆ size()

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

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

Returns
The size of the blackboard.

◆ to_string()

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

Convert the contents of the blackboard to a string.

Returns
A string representation of the blackboard.

Member Data Documentation

◆ blackboard

std::shared_ptr<Blackboard> yasmin::blackboard::BlackboardPyWrapper::blackboard
private

Underlying C++ Blackboard instance.


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