Class BlackboardPyWrapper

Class Documentation

class BlackboardPyWrapper

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.

Public Functions

inline BlackboardPyWrapper()
inline BlackboardPyWrapper(Blackboard &&other)

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

inline explicit BlackboardPyWrapper(std::shared_ptr<Blackboard> bb_ptr)

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

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

Set a Python object in the blackboard.

Parameters:
  • key – The key to associate with the value.

  • value – The Python object to store.

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

Get a Python object from the blackboard.

Parameters:

key – The key associated with the value.

Throws:

std::runtime_error – if the key does not exist.

Returns:

The Python object.

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

Remove a value from the blackboard.

Parameters:

key – The key associated with the value to remove.

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

Check if a key exists in the blackboard.

Parameters:

key – The key to check.

Returns:

True if the key exists, false otherwise.

inline int size()

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

Returns:

The size of the blackboard.

inline std::string to_string()

Convert the contents of the blackboard to a string.

Returns:

A string representation of the blackboard.

inline void set_remappings(const std::map<std::string, std::string> &remappings)

Set the remappings of the blackboard.

Parameters:

remappings – The remappings to set.

inline std::map<std::string, std::string> get_remappings()

Get the remappings of the blackboard.

Returns:

The remappings of the blackboard.

inline std::shared_ptr<Blackboard> get_cpp_blackboard()

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

Returns:

Shared pointer to the C++ Blackboard