Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private 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 createEntry (const std::string &key, const PortInfo &info)
 
void debugMessage () const
 
void enableAutoRemapping (bool remapping)
 
std::mutex & entryMutex ()
 
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...
 
virtual ~Blackboard ()=default
 

Static Public Member Functions

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

Protected Member Functions

 Blackboard (Blackboard::Ptr parent)
 

Private Member Functions

std::shared_ptr< EntrycreateEntryImpl (const std::string &key, const PortInfo &info)
 

Private Attributes

bool autoremapping_ = false
 
std::mutex entry_mutex_
 
std::unordered_map< std::string, std::string > internal_to_external_
 
std::mutex mutex_
 
std::weak_ptr< Blackboardparent_bb_
 
std::unordered_map< std::string, std::shared_ptr< Entry > > storage_
 

Detailed Description

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

Definition at line 22 of file blackboard.h.

Member Typedef Documentation

◆ Ptr

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

Definition at line 25 of file blackboard.h.

Constructor & Destructor Documentation

◆ Blackboard()

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

Definition at line 29 of file blackboard.h.

◆ ~Blackboard()

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

Member Function Documentation

◆ addSubtreeRemapping()

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

Definition at line 18 of file blackboard.cpp.

◆ clear()

void BT::Blackboard::clear ( )
inline

Definition at line 172 of file blackboard.h.

◆ create()

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 36 of file blackboard.h.

◆ createEntry()

void BT::Blackboard::createEntry ( const std::string &  key,
const PortInfo info 
)
inline

Definition at line 186 of file blackboard.h.

◆ createEntryImpl()

std::shared_ptr< Blackboard::Entry > BT::Blackboard::createEntryImpl ( const std::string &  key,
const PortInfo info 
)
private

Definition at line 68 of file blackboard.cpp.

◆ debugMessage()

void BT::Blackboard::debugMessage ( ) const

Definition at line 24 of file blackboard.cpp.

◆ enableAutoRemapping()

void BT::Blackboard::enableAutoRemapping ( bool  remapping)

Definition at line 5 of file blackboard.cpp.

◆ entryMutex()

std::mutex& BT::Blackboard::entryMutex ( )
inline

Definition at line 181 of file blackboard.h.

◆ get() [1/2]

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 81 of file blackboard.h.

◆ get() [2/2]

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

Version of get() that throws if it fails.

Definition at line 95 of file blackboard.h.

◆ getAny() [1/2]

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.

◆ getAny() [2/2]

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

Definition at line 70 of file blackboard.h.

◆ getKeys()

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

Definition at line 52 of file blackboard.cpp.

◆ portInfo()

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

Definition at line 10 of file blackboard.cpp.

◆ set()

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 110 of file blackboard.h.

Member Data Documentation

◆ autoremapping_

bool BT::Blackboard::autoremapping_ = false
private

Definition at line 213 of file blackboard.h.

◆ entry_mutex_

std::mutex BT::Blackboard::entry_mutex_
mutableprivate

Definition at line 208 of file blackboard.h.

◆ internal_to_external_

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

Definition at line 211 of file blackboard.h.

◆ mutex_

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

Definition at line 207 of file blackboard.h.

◆ parent_bb_

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

Definition at line 210 of file blackboard.h.

◆ storage_

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

Definition at line 209 of file blackboard.h.


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


behaviortree_cpp_v3
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Mon Jul 3 2023 02:50:14