MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / removeNode

Method removeNode

pj_datastore/src/derived_engine.cpp:693–728  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

691// ---------------------------------------------------------------------------
692
693PJ::Status DerivedEngine::removeNode(PJ::NodeId id) {
694 auto it = impl_->nodes.find(id);
695 if (it == impl_->nodes.end()) {
696 return PJ::unexpected(fmt::format("remove_node: node {} not found", id));
697 }
698
699 const DerivedNode& node = it->second;
700
701 // Remove from topic_to_nodes
702 for (PJ::TopicId in_tid : node.all_input_topic_ids) {
703 auto& v = impl_->topic_to_nodes[in_tid];
704 v.erase(std::remove(v.begin(), v.end(), id), v.end());
705 }
706
707 // Remove from output_topic_to_node and registered_output_names
708 for (PJ::TopicId out_tid : node.output_topic_ids) {
709 impl_->output_topic_to_node.erase(out_tid);
710 // Remove from registered_output_names (scan for the value)
711 for (auto sit = impl_->registered_output_names.begin(); sit != impl_->registered_output_names.end(); ++sit) {
712 if (sit->second == out_tid) {
713 impl_->registered_output_names.erase(sit);
714 break;
715 }
716 }
717 }
718
719 // Remove from downstream_of
720 impl_->downstream_of.erase(id);
721 for (auto dit = impl_->downstream_of.begin(); dit != impl_->downstream_of.end(); ++dit) {
722 auto& list = dit.value();
723 list.erase(std::remove(list.begin(), list.end(), id), list.end());
724 }
725
726 impl_->nodes.erase(it);
727 return PJ::okStatus();
728}
729
730bool DerivedEngine::hasNode(PJ::NodeId id) const noexcept {
731 return impl_->nodes.contains(id);

Callers 5

applyFilterMethod · 0.80
removeFilterMethod · 0.80
clearAllFiltersMethod · 0.80
installTransformMethod · 0.80
removeTransformMethod · 0.80

Calls 5

eraseMethod · 0.80
findMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected