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

Method getLockedPortContent

src/tree_node.cpp:501–522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499}
500
501AnyPtrLocked BT::TreeNode::getLockedPortContent(const std::string& key)
502{
503 if(auto remapped_key = getRemappedKey(key, getRawPortValue(key)))
504 {
505 const auto bb_key = std::string(*remapped_key);
506 auto result = _p->config.blackboard->getAnyLocked(bb_key);
507 if(!result && _p->config.manifest != nullptr)
508 {
509 // Entry doesn't exist yet. Create it using the port's type info
510 // from the manifest so that getLockedPortContent works even when
511 // the port is not explicitly declared in XML. Issue #942.
512 auto port_it = _p->config.manifest->ports.find(key);
513 if(port_it != _p->config.manifest->ports.end())
514 {
515 _p->config.blackboard->createEntry(bb_key, port_it->second);
516 result = _p->config.blackboard->getAnyLocked(bb_key);
517 }
518 }
519 return result;
520 }
521 return {};
522}
523
524} // namespace BT

Callers

nothing calls this directly

Calls 4

stringFunction · 0.85
getAnyLockedMethod · 0.80
createEntryMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected