MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / get

Method get

include/behaviortree_cpp/blackboard.h:236–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234
235template <typename T>
236inline T Blackboard::get(const std::string& key) const
237{
238 if(auto any_ref = getAnyLocked(key))
239 {
240 const auto& any = any_ref.get();
241 if(any->empty())
242 {
243 throw RuntimeError("Blackboard::get() error. Entry [", key,
244 "] hasn't been initialized, yet");
245 }
246 auto result = tryCastWithPolymorphicFallback<T>(any);
247 if(!result)
248 {
249 throw std::runtime_error(result.error());
250 }
251 return result.value();
252 }
253 throw RuntimeError("Blackboard::get() error. Missing key [", key, "]");
254}
255
256inline void Blackboard::unset(const std::string& key)
257{

Callers 15

removeMethod · 0.45
modifyMethod · 0.45
wait_allMethod · 0.45
sizeMethod · 0.45
add_implMethod · 0.45
addMethod · 0.45
loadFromFileMethod · 0.45
loadFromTextMethod · 0.45
loadDocImplMethod · 0.45
createNodeFromXMLMethod · 0.45
getAnyMethod · 0.45
ExportBlackboardToJSONFunction · 0.45

Calls 3

RuntimeErrorClass · 0.85
emptyMethod · 0.45
valueMethod · 0.45

Tested by 8

TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36