A thread-safe storage for key-value pairs of varying types.
More...
#include <blackboard.hpp>
|
| | Blackboard () |
| | Default constructor for Blackboard.
|
| |
| | Blackboard (const Blackboard &other) |
| | Copy constructor for Blackboard.
|
| |
| virtual | ~Blackboard () |
| | Virtual destructor for Blackboard.
|
| |
| template<class T> |
| void | set (const std::string &name, T value) |
| | Set a value in the blackboard.
|
| |
| template<class T> |
| T | get (const std::string &key) |
| | Retrieve a value 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 | get_type (const std::string &key) |
| | Get the type of a value stored 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.
|
| |
| const std::map< std::string, std::string > & | get_remappings () |
| | Get the remappings of the blackboard.
|
| |
|
| const std::string & | remap (const std::string &key) |
| | Internal method that acquires the maped key. In the case the key is not remaped, retruns the arg key.
|
| |
|
| std::recursive_mutex | mutex |
| | Mutex for thread safety.
|
| |
| std::map< std::string, BlackboardValueInterface * > | values |
| | Storage for key-value pairs.
|
| |
| std::map< std::string, std::string > | type_registry |
| | Storage for type information for each key.
|
| |
| std::map< std::string, std::string > | remappings |
| | Storage for key remappings.
|
| |
A thread-safe storage for key-value pairs of varying types.
The Blackboard class allows storing, retrieving, and managing values associated with string keys in a thread-safe manner using a recursive mutex. Values are stored as pointers to BlackboardValueInterface instances.
◆ Blackboard() [1/2]
| Blackboard::Blackboard |
( |
| ) |
|
◆ Blackboard() [2/2]
| Blackboard::Blackboard |
( |
const Blackboard & | other | ) |
|
Copy constructor for Blackboard.
- Parameters
-
| other | The instance to copy from. |
◆ ~Blackboard()
| Blackboard::~Blackboard |
( |
| ) |
|
|
virtual |
◆ contains()
| bool Blackboard::contains |
( |
const std::string & | key | ) |
|
Check if a key exists in the blackboard.
- Parameters
-
- Returns
- True if the key exists, false otherwise.
◆ get()
template<class T>
| T yasmin::blackboard::Blackboard::get |
( |
const std::string & | key | ) |
|
|
inline |
Retrieve a value from the blackboard.
- Template Parameters
-
| T | The type of the value to retrieve. |
- Parameters
-
| name | The key associated with the value. |
- Returns
- The value associated with the specified key.
- Exceptions
-
| std::runtime_error | if the key does not exist. |
◆ get_remappings()
| const std::map< std::string, std::string > & Blackboard::get_remappings |
( |
| ) |
|
Get the remappings of the blackboard.
- Returns
- The remappings of the blackboard.
◆ get_type()
| std::string Blackboard::get_type |
( |
const std::string & | key | ) |
|
Get the type of a value stored in the blackboard.
- Parameters
-
| key | The key associated with the value. |
- Returns
- A string representation of the type.
- Exceptions
-
| std::runtime_error | if the key does not exist. |
◆ remap()
| const std::string & Blackboard::remap |
( |
const std::string & | key | ) |
|
|
private |
Internal method that acquires the maped key. In the case the key is not remaped, retruns the arg key.
- Parameters
-
| other | The instance to copy from. |
◆ remove()
| void Blackboard::remove |
( |
const std::string & | key | ) |
|
Remove a value from the blackboard.
- Parameters
-
| key | The key associated with the value to remove. |
◆ set()
template<class T>
| void yasmin::blackboard::Blackboard::set |
( |
const std::string & | name, |
|
|
T | value ) |
|
inline |
Set a value in the blackboard.
- Template Parameters
-
| T | The type of the value to store. |
- Parameters
-
| name | The key to associate with the value. |
| value | The value to store. |
◆ set_remappings()
| void Blackboard::set_remappings |
( |
const std::map< std::string, std::string > & | remappings | ) |
|
Set the remappings of the blackboard.
- Parameters
-
| remappings | The remappings to set. |
◆ size()
Get the number of key-value pairs in the blackboard.
- Returns
- The size of the blackboard.
◆ to_string()
| std::string Blackboard::to_string |
( |
| ) |
|
Convert the contents of the blackboard to a string.
- Returns
- A string representation of the blackboard.
◆ mutex
| std::recursive_mutex yasmin::blackboard::Blackboard::mutex |
|
private |
◆ remappings
| std::map<std::string, std::string> yasmin::blackboard::Blackboard::remappings |
|
private |
Storage for key remappings.
◆ type_registry
| std::map<std::string, std::string> yasmin::blackboard::Blackboard::type_registry |
|
private |
Storage for type information for each key.
◆ values
Storage for key-value pairs.
The documentation for this class was generated from the following files: