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

using Ptr = std::shared_ptr< Blackboard >
 

Public Member Functions

void addSubtreeRemapping (StringView internal, StringView external)
 
void clear ()
 
void cloneInto (Blackboard &dst) const
 cloneInto copies the values of the entries into another blackboard. Known limitations: More...
 
void createEntry (const std::string &key, const TypeInfo &info)
 
void debugMessage () const
 
void enableAutoRemapping (bool remapping)
 
const TypeInfoentryInfo (const std::string &key)
 
std::recursive_mutex & entryMutex () const
 
template<typename T >
get (const std::string &key) const
 
template<typename T >
bool get (const std::string &key, T &value) const
 
AnygetAny (const std::string &key)
 
const AnygetAny (const std::string &key) const
 
AnyPtrLocked getAnyLocked (const std::string &key)
 
AnyPtrLocked getAnyLocked (const std::string &key) const
 
std::shared_ptr< Blackboard::EntrygetEntry (const std::string &key)
 
const std::shared_ptr< EntrygetEntry (const std::string &key) const
 
std::vector< StringViewgetKeys () const
 
template<typename T >
Expected< StampedValue< T > > getStamped (const std::string &key) const
 
template<typename T >
Expected< TimestampgetStamped (const std::string &key, T &value) const
 
Blackboard::Ptr parent ()
 
BlackboardrootBlackboard ()
 
const BlackboardrootBlackboard () const
 
template<typename T >
void set (const std::string &key, const T &value)
 Update the entry with the given key. More...
 
void unset (const std::string &key)
 
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 TypeInfo &info)
 

Private Attributes

bool autoremapping_ = false
 
std::recursive_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 32 of file blackboard.h.

Member Typedef Documentation

◆ Ptr

using BT::Blackboard::Ptr = std::shared_ptr<Blackboard>

Definition at line 35 of file blackboard.h.

Constructor & Destructor Documentation

◆ Blackboard()

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

Definition at line 39 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 89 of file blackboard.cpp.

◆ clear()

void BT::Blackboard::clear ( )

Definition at line 131 of file blackboard.cpp.

◆ cloneInto()

void BT::Blackboard::cloneInto ( Blackboard dst) const

cloneInto copies the values of the entries into another blackboard. Known limitations:

  • it doesn't update the remapping in dst
  • it doesn't change the parent blackboard os dst
Parameters
dstdestination, i.e. blackboard to be updated

Definition at line 154 of file blackboard.cpp.

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

◆ createEntry()

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

Definition at line 142 of file blackboard.cpp.

◆ createEntryImpl()

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

Definition at line 208 of file blackboard.cpp.

◆ debugMessage()

void BT::Blackboard::debugMessage ( ) const

Definition at line 95 of file blackboard.cpp.

◆ enableAutoRemapping()

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

Definition at line 13 of file blackboard.cpp.

◆ entryInfo()

const TypeInfo * BT::Blackboard::entryInfo ( const std::string &  key)

Definition at line 83 of file blackboard.cpp.

◆ entryMutex()

std::recursive_mutex & BT::Blackboard::entryMutex ( ) const

Definition at line 137 of file blackboard.cpp.

◆ get() [1/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 172 of file blackboard.h.

◆ get() [2/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 313 of file blackboard.h.

◆ getAny() [1/2]

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

Definition at line 41 of file blackboard.cpp.

◆ getAny() [2/2]

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

Definition at line 36 of file blackboard.cpp.

◆ getAnyLocked() [1/2]

AnyPtrLocked BT::Blackboard::getAnyLocked ( const std::string &  key)

Definition at line 18 of file blackboard.cpp.

◆ getAnyLocked() [2/2]

AnyPtrLocked BT::Blackboard::getAnyLocked ( const std::string &  key) const

Definition at line 27 of file blackboard.cpp.

◆ getEntry() [1/2]

std::shared_ptr< Blackboard::Entry > BT::Blackboard::getEntry ( const std::string &  key)

Definition at line 78 of file blackboard.cpp.

◆ getEntry() [2/2]

const std::shared_ptr< Blackboard::Entry > BT::Blackboard::getEntry ( const std::string &  key) const

Definition at line 47 of file blackboard.cpp.

◆ getKeys()

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

Definition at line 116 of file blackboard.cpp.

◆ getStamped() [1/2]

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

Definition at line 346 of file blackboard.h.

◆ getStamped() [2/2]

template<typename T >
Expected< Timestamp > BT::Blackboard::getStamped ( const std::string &  key,
T &  value 
) const
inline

Definition at line 328 of file blackboard.h.

◆ parent()

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

Definition at line 199 of file blackboard.cpp.

◆ rootBlackboard() [1/2]

const Blackboard * BT::Blackboard::rootBlackboard ( )

Definition at line 307 of file blackboard.cpp.

◆ rootBlackboard() [2/2]

const Blackboard* BT::Blackboard::rootBlackboard ( ) const

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

◆ unset()

void BT::Blackboard::unset ( const std::string &  key)
inline

Definition at line 187 of file blackboard.h.

Member Data Documentation

◆ autoremapping_

bool BT::Blackboard::autoremapping_ = false
private

Definition at line 152 of file blackboard.h.

◆ entry_mutex_

std::recursive_mutex BT::Blackboard::entry_mutex_
mutableprivate

Definition at line 145 of file blackboard.h.

◆ internal_to_external_

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

Definition at line 148 of file blackboard.h.

◆ mutex_

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

Definition at line 144 of file blackboard.h.

◆ parent_bb_

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

Definition at line 147 of file blackboard.h.

◆ storage_

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

Definition at line 146 of file blackboard.h.


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


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Jun 28 2024 02:20:09