(C++)  1.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::Blackboard Class Reference

The Blackboard class - grail's universal data container. More...

#include <Blackboard.hh>

Public Member Functions

 Blackboard (const Blackboard &other)
 
 Blackboard (Blackboard &&other)
 
Blackboardoperator= (const Blackboard &other)
 
Blackboardoperator= (Blackboard &&other)
 
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...
 
void Merge (const Blackboard &other, std::function< const Any &(const Any &, const Any &)> mergeStrategy=OursStrategy)
 Merge - Merges data from other blackboard into this one. All conflicts are solved in favor of other blackboard. 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 >
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 Public Member Functions

static void TwoWayMerge (Blackboard &first, Blackboard &second, std::function< const Any &(const Any &, const Any &)> firstStrategy=OursStrategy, std::function< const Any &(const Any &, const Any &)> secondStrategy=OursStrategy)
 TwoWayMerge - merges second blackboard into first and first into second, uses provided merge strategies. More...
 
static const Any & OursStrategy (const Any &ours, const Any &theirs)
 OursStrategy. More...
 
static const Any & TheirsStrategy (const Any &ours, const Any &theirs)
 TheirsStrategy. More...
 

Friends

bool operator< (const grail::Blackboard &first, const grail::Blackboard &second)
 

Detailed Description

The Blackboard class - grail's universal data container.

Member Function Documentation

bool grail::Blackboard::ContainsKey ( const std::string &  key) const

ContainsKey - Checks whether this blackboard contains given key.

Parameters
key
Returns
true if key exists, false if not
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
name
Returns
value paired with given key
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
name
Returns
value paired with given key
void grail::Blackboard::Merge ( const Blackboard other,
std::function< const Any &(const Any &, const 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
const Any & grail::Blackboard::OursStrategy ( const Any &  ours,
const Any &  theirs 
)
static

OursStrategy.

Parameters
ours
theirs
Returns
ours
void grail::Blackboard::RemoveEntry ( const std::string &  key)

RemoveValue - Deletes value keyed with given name from this blackboard.

Parameters
name
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
name
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
name
value
size_t grail::Blackboard::Size ( ) const

Size.

Returns
blackboard's data size
const Any & grail::Blackboard::TheirsStrategy ( const Any &  ours,
const Any &  theirs 
)
static

TheirsStrategy.

Parameters
ours
theirs
Returns
theirs
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
name
outValue
Returns
true if key exists, false if it does not
void grail::Blackboard::TwoWayMerge ( Blackboard first,
Blackboard second,
std::function< const Any &(const Any &, const Any &)>  firstStrategy = OursStrategy,
std::function< const Any &(const Any &, const 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: