The Blackboard class - grail's universal data container.
More...
#include <Blackboard.hh>
|
| Blackboard (const Blackboard &other) |
|
| Blackboard (Blackboard &&other)=delete |
|
Blackboard & | operator= (const Blackboard &other) |
|
Blackboard & | operator= (Blackboard &&other)=delete |
|
void | Merge (const Blackboard &other, std::function< const std::any &(const std::any &, const std::any &)> mergeStrategy=OursStrategy) |
| Merge - Merges data from other blackboard into this one. All conflicts are solved in favor of other blackboard. More...
|
|
void | RemoveEntry (const std::string &key) |
| RemoveValue - Deletes value keyed with given name from this blackboard. More...
|
|
bool | ContainsKey (const std::string &key) const |
| ContainsKey - Checks whether this blackboard contains given key. More...
|
|
size_t | Size () const |
| Size. More...
|
|
template<typename T > |
void | SetValue (const std::string &key, const T &value) |
| SetValue - Inserts value keyed with name into this blackboard. If key already exists new value is assigned. More...
|
|
template<typename T , std::enable_if_t<!std::is_reference< T >::value > * = nullptr> |
void | SetValue (const std::string &key, T &&value) |
| SetValue - Inserts value keyed with name into this blackboard. If key already exists new value is assigned. More...
|
|
template<typename T > |
void | SetDefaultValue (const std::string &key) |
| SetDefaultValue - Inserts default value of given type keyed with name into this blackboard. If key already exists new value is assigned. More...
|
|
template<typename T > |
const T & | GetValue (const std::string &key) const |
| GetValue - Returns value keyed with name. This method assumes that this blackboard contains given key! More...
|
|
template<typename T > |
T & | GetOrAddValue (const std::string &key) |
| GetOrAddValue - Returns value keyed with name. If blackboard does not contain key, new entry is created. More...
|
|
template<typename T > |
bool | TryGetValue (const std::string &key, T &outValue) const |
| TryGetValue - Checks whether blackboard contains given key. If it does, assigns keyed value to reference parameter outValue. More...
|
|
void | AddDataToNameMap (std::map< std::string, std::string > &outMap) const |
|
|
static void | TwoWayMerge (Blackboard &first, Blackboard &second, std::function< const std::any &(const std::any &, const std::any &)> firstStrategy=OursStrategy, std::function< const std::any &(const std::any &, const std::any &)> secondStrategy=OursStrategy) |
| TwoWayMerge - merges second blackboard into first and first into second, uses provided merge strategies. More...
|
|
static const std::any & | OursStrategy (const std::any &ours, const std::any &theirs) |
| OursStrategy. More...
|
|
static const std::any & | TheirsStrategy (const std::any &ours, const std::any &theirs) |
| TheirsStrategy. More...
|
|
The Blackboard class - grail's universal data container.
◆ ContainsKey()
bool grail::Blackboard::ContainsKey |
( |
const std::string & |
key | ) |
const |
ContainsKey - Checks whether this blackboard contains given key.
- Parameters
-
- Returns
- true if key exists, false if not
◆ GetOrAddValue()
template<typename T >
T& grail::Blackboard::GetOrAddValue |
( |
const std::string & |
key | ) |
|
|
inline |
GetOrAddValue - Returns value keyed with name. If blackboard does not contain key, new entry is created.
- Parameters
-
- Returns
- value paired with given key
◆ GetValue()
template<typename T >
const T& grail::Blackboard::GetValue |
( |
const std::string & |
key | ) |
const |
|
inline |
GetValue - Returns value keyed with name. This method assumes that this blackboard contains given key!
- Parameters
-
- Returns
- value paired with given key
◆ Merge()
void grail::Blackboard::Merge |
( |
const Blackboard & |
other, |
|
|
std::function< const std::any &(const std::any &, const std::any &)> |
mergeStrategy = OursStrategy |
|
) |
| |
Merge - Merges data from other blackboard into this one. All conflicts are solved in favor of other blackboard.
- Parameters
-
other | |
mergeStrategy | - determines how conflicts will be resolved |
◆ OursStrategy()
const std::any & grail::Blackboard::OursStrategy |
( |
const std::any & |
ours, |
|
|
const std::any & |
theirs |
|
) |
| |
|
static |
OursStrategy.
- Parameters
-
- Returns
- ours
◆ RemoveEntry()
void grail::Blackboard::RemoveEntry |
( |
const std::string & |
key | ) |
|
RemoveValue - Deletes value keyed with given name from this blackboard.
- Parameters
-
◆ SetDefaultValue()
template<typename T >
void grail::Blackboard::SetDefaultValue |
( |
const std::string & |
key | ) |
|
|
inline |
SetDefaultValue - Inserts default value of given type keyed with name into this blackboard. If key already exists new value is assigned.
- Parameters
-
◆ SetValue() [1/2]
template<typename T >
void grail::Blackboard::SetValue |
( |
const std::string & |
key, |
|
|
const T & |
value |
|
) |
| |
|
inline |
SetValue - Inserts value keyed with name into this blackboard. If key already exists new value is assigned.
- Parameters
-
◆ SetValue() [2/2]
template<typename T , std::enable_if_t<!std::is_reference< T >::value > * = nullptr>
void grail::Blackboard::SetValue |
( |
const std::string & |
key, |
|
|
T && |
value |
|
) |
| |
|
inline |
SetValue - Inserts value keyed with name into this blackboard. If key already exists new value is assigned.
- Parameters
-
◆ Size()
size_t grail::Blackboard::Size |
( |
| ) |
const |
Size.
- Returns
- blackboard's data size
◆ TheirsStrategy()
const std::any & grail::Blackboard::TheirsStrategy |
( |
const std::any & |
ours, |
|
|
const std::any & |
theirs |
|
) |
| |
|
static |
TheirsStrategy.
- Parameters
-
- Returns
- theirs
◆ TryGetValue()
template<typename T >
bool grail::Blackboard::TryGetValue |
( |
const std::string & |
key, |
|
|
T & |
outValue |
|
) |
| const |
|
inline |
TryGetValue - Checks whether blackboard contains given key. If it does, assigns keyed value to reference parameter outValue.
- Parameters
-
- Returns
- true if key exists, false if it does not
◆ TwoWayMerge()
void grail::Blackboard::TwoWayMerge |
( |
Blackboard & |
first, |
|
|
Blackboard & |
second, |
|
|
std::function< const std::any &(const std::any &, const std::any &)> |
firstStrategy = OursStrategy , |
|
|
std::function< const std::any &(const std::any &, const std::any &)> |
secondStrategy = OursStrategy |
|
) |
| |
|
static |
TwoWayMerge - merges second blackboard into first and first into second, uses provided merge strategies.
- Parameters
-
first | |
second | |
firstStrategy | |
secondStrategy | |
The documentation for this class was generated from the following files: