|
C++ YASMIN (Yet Another State MachINe)
|
A thread-safe storage for key-value pairs of varying types. More...
#include <blackboard.hpp>

Public Types | |
| using | SharedPtr = std::shared_ptr<Blackboard> |
| Shared pointer type for Blackboard. | |
| using | ConstSharedPtr = std::shared_ptr<const Blackboard> |
| using | UniquePtr = std::unique_ptr<Blackboard> |
| Unique pointer type for Blackboard. | |
| using | WeakPtr = std::weak_ptr<Blackboard> |
| Weak pointer type for Blackboard. | |
| using | ConstWeakPtr = std::weak_ptr<const Blackboard> |
Public Member Functions | |
| Blackboard () | |
| Default constructor for Blackboard. | |
| Blackboard (const Blackboard &other) | |
| Copy constructor 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) const |
| Retrieve a value 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 | get_type (const std::string &key) const |
| Get the type of a value stored 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 Remappings & | get_remappings () const noexcept |
| Get the remappings of the blackboard. | |
Static Public Member Functions | |
| template<typename... Args> | |
| static std::shared_ptr< Blackboard > | make_shared (Args &&...args) |
| template<typename... Args> | |
| static std::unique_ptr< Blackboard > | make_unique (Args &&...args) |
Private Member Functions | |
| const std::string & | remap (const std::string &key) const |
| Internal method that acquires the maped key. In the case the key is not remaped, retruns the arg key. | |
Private Attributes | |
| std::recursive_mutex | mutex |
| Mutex for thread safety. | |
| std::unordered_map< std::string, std::shared_ptr< void > > | values |
| Storage for key-value pairs. | |
| TypeRegistry | type_registry |
| Storage for type information for each key. | |
| Remappings | 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.
| using yasmin::Blackboard::ConstSharedPtr = std::shared_ptr<const Blackboard> |
| using yasmin::Blackboard::ConstWeakPtr = std::weak_ptr<const Blackboard> |
| using yasmin::Blackboard::SharedPtr = std::shared_ptr<Blackboard> |
Shared pointer type for Blackboard.
| using yasmin::Blackboard::UniquePtr = std::unique_ptr<Blackboard> |
Unique pointer type for Blackboard.
| using yasmin::Blackboard::WeakPtr = std::weak_ptr<Blackboard> |
Weak pointer type for Blackboard.
|
default |
Default constructor for Blackboard.
| Blackboard::Blackboard | ( | const Blackboard & | other | ) |
Copy constructor for Blackboard.
| other | The instance to copy from. |
| bool Blackboard::contains | ( | const std::string & | key | ) | const |
Check if a key exists in the blackboard.
| key | The key to check. |
|
inline |
Retrieve a value from the blackboard.
| T | The type of the value to retrieve. |
| name | The key associated with the value. |
| std::runtime_error | if the key does not exist. |
|
noexcept |
Get the remappings of the blackboard.
| std::string Blackboard::get_type | ( | const std::string & | key | ) | const |
Get the type of a value stored in the blackboard.
| key | The key associated with the value. |
| std::runtime_error | if the key does not exist. |
|
inlinestatic |
|
inlinestatic |
|
private |
Internal method that acquires the maped key. In the case the key is not remaped, retruns the arg key.
| other | The instance to copy from. |
| void Blackboard::remove | ( | const std::string & | key | ) |
Remove a value from the blackboard.
| key | The key associated with the value to remove. |
|
inline |
Set a value in the blackboard.
| T | The type of the value to store. |
| name | The key to associate with the value. |
| value | The value to store. |
| void Blackboard::set_remappings | ( | const Remappings & | remappings | ) |
Set the remappings of the blackboard.
| remappings | The remappings to set. |
| int Blackboard::size | ( | ) | const |
Get the number of key-value pairs in the blackboard.
| std::string Blackboard::to_string | ( | ) | const |
Convert the contents of the blackboard to a string.
|
mutableprivate |
Mutex for thread safety.
|
private |
Storage for key remappings.
|
private |
Storage for type information for each key.
|
private |
Storage for key-value pairs.