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

Method updateFilter

pj_runtime/src/DataProcessorService.cpp:210–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210Status DataProcessorService::updateFilter(NodeId node_id, std::shared_ptr<proc::DataProcessor> processor) {
211 if (!processor) {
212 return PJ::unexpected("DataProcessorService: null processor");
213 }
214 if (Status replaced =
215 derived_->replaceSisoTransform(node_id, std::make_unique<proc::ProcessorSisoAdapter>(processor));
216 !replaced.has_value()) {
217 return replaced;
218 }
219 for (auto& [out_tid, recipe] : recipes_) {
220 if (recipe.node_id == node_id) {
221 recipe.processor = processor;
222 recipe.processor_id = processor->id();
223 // Re-capture the defining source (like applyFilter) so a layout re-saved after
224 // an in-place edit embeds the NEW filter's <source_fallback>, not the old one.
225 if (const auto* lua = dynamic_cast<const scripting::LuaSisoTransform*>(processor.get())) {
226 recipe.filter_source = lua->sourceText();
227 } else {
228 recipe.filter_source.clear();
229 }
230 break;
231 }
232 }
233 return PJ::okStatus();
234}
235
236std::vector<std::pair<std::string, std::string>> DataProcessorService::availableFilters() const {
237 std::vector<std::pair<std::string, std::string>> out;

Callers 2

applyToSelectedMethod · 0.80
TESTFunction · 0.80

Calls 4

replaceSisoTransformMethod · 0.80
getMethod · 0.80
idMethod · 0.45
clearMethod · 0.45

Tested by 1

TESTFunction · 0.64