Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
BT::Blackboard Class Reference

The Blackboard is the mechanism used by BehaviorTrees to exchange typed data. More...

#include <blackboard.h>

Classes

struct  Entry
 

Public Types

typedef std::shared_ptr< BlackboardPtr
 

Public Member Functions

void addSubtreeRemapping (StringView internal, StringView external)
 
void clear ()
 
void debugMessage () const
 
template<typename T >
bool get (const std::string &key, T &value) const
 
template<typename T >
get (const std::string &key) const
 
const AnygetAny (const std::string &key) const
 The method getAny allow the user to access directly the type erased value. More...
 
AnygetAny (const std::string &key)
 
std::vector< StringViewgetKeys () const
 
const PortInfoportInfo (const std::string &key)
 
template<typename T >
void set (const std::string &key, const T &value)
 Update the entry with the given key. More...
 
void setPortInfo (std::string key, const PortInfo &info)
 
virtual ~Blackboard ()=default
 

Static Public Member Functions

static Blackboard::Ptr create (Blackboard::Ptr parent={})
 

Protected Member Functions

 Blackboard (Blackboard::Ptr parent)
 

Private Attributes

std::unordered_map< std::string, std::string > internal_to_external_
 
std::mutex mutex_
 
std::weak_ptr< Blackboardparent_bb_
 
std::unordered_map< std::string, Entrystorage_
 

Detailed Description

The Blackboard is the mechanism used by BehaviorTrees to exchange typed data.

Definition at line 23 of file blackboard.h.

Member Typedef Documentation

typedef std::shared_ptr<Blackboard> BT::Blackboard::Ptr

Definition at line 26 of file blackboard.h.

Constructor & Destructor Documentation

BT::Blackboard::Blackboard ( Blackboard::Ptr  parent)
inlineprotected

Definition at line 30 of file blackboard.h.

virtual BT::Blackboard::~Blackboard ( )
virtualdefault

Member Function Documentation

void BT::Blackboard::addSubtreeRemapping ( StringView  internal,
StringView  external 
)

Definition at line 45 of file blackboard.cpp.

void BT::Blackboard::clear ( )
inline

Definition at line 192 of file blackboard.h.

static Blackboard::Ptr BT::Blackboard::create ( Blackboard::Ptr  parent = {})
inlinestatic

Use this static method to create an instance of the BlackBoard to share among all your NodeTrees.

Definition at line 38 of file blackboard.h.

void BT::Blackboard::debugMessage ( ) const

Definition at line 50 of file blackboard.cpp.

template<typename T >
bool BT::Blackboard::get ( const std::string &  key,
T &  value 
) const
inline

Return true if the entry with the given key was found. Note that this method may throw an exception if the cast to T failed.

Definition at line 87 of file blackboard.h.

template<typename T >
T BT::Blackboard::get ( const std::string &  key) const
inline

Version of get() that throws if it fails.

Definition at line 101 of file blackboard.h.

const Any* BT::Blackboard::getAny ( const std::string &  key) const
inline

The method getAny allow the user to access directly the type erased value.

Returns
the pointer or nullptr if it fails.

Definition at line 51 of file blackboard.h.

Any* BT::Blackboard::getAny ( const std::string &  key)
inline

Definition at line 67 of file blackboard.h.

std::vector< StringView > BT::Blackboard::getKeys ( ) const

Definition at line 75 of file blackboard.cpp.

const PortInfo * BT::Blackboard::portInfo ( const std::string &  key)

Definition at line 34 of file blackboard.cpp.

template<typename T >
void BT::Blackboard::set ( const std::string &  key,
const T &  value 
)
inline

Update the entry with the given key.

Definition at line 117 of file blackboard.h.

void BT::Blackboard::setPortInfo ( std::string  key,
const PortInfo info 
)

Definition at line 5 of file blackboard.cpp.

Member Data Documentation

std::unordered_map<std::string,std::string> BT::Blackboard::internal_to_external_
private

Definition at line 218 of file blackboard.h.

std::mutex BT::Blackboard::mutex_
mutableprivate

Definition at line 215 of file blackboard.h.

std::weak_ptr<Blackboard> BT::Blackboard::parent_bb_
private

Definition at line 217 of file blackboard.h.

std::unordered_map<std::string, Entry> BT::Blackboard::storage_
private

Definition at line 216 of file blackboard.h.


The documentation for this class was generated from the following files:


behaviotree_cpp_v3
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Tue May 4 2021 02:56:26