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

Method removeHook

src/loggers/groot2_publisher.cpp:660–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

658}
659
660bool Groot2Publisher::removeHook(Position pos, uint16_t node_uid)
661{
662 auto it = _p->nodes_by_uid.find(node_uid);
663 if(it == _p->nodes_by_uid.end())
664 {
665 return false;
666 }
667 const TreeNode::Ptr node = it->second.lock();
668 if(!node)
669 {
670 return false;
671 }
672
673 auto hook = getHook(pos, node_uid);
674 if(!hook)
675 {
676 return false;
677 }
678
679 {
680 const std::unique_lock<std::mutex> lk(_p->hooks_map_mutex);
681 _p->pre_hooks.erase(node_uid);
682 }
683 node->setPreTickFunction({});
684
685 // Disable breakpoint, if it was interactive and blocked
686 {
687 std::unique_lock<std::mutex> lk(hook->mutex);
688 if(hook->mode == Monitor::Hook::Mode::BREAKPOINT)
689 {
690 hook->enabled = false;
691 lk.unlock();
692 hook->wakeup.notify_all();
693 }
694 }
695 return true;
696}
697
698void Groot2Publisher::removeAllHooks()
699{

Callers

nothing calls this directly

Calls 4

lockMethod · 0.80
setPreTickFunctionMethod · 0.80
unlockMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected