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

Method outputNameInUse

pj_runtime/src/DataProcessorService.cpp:388–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386}
387
388bool DataProcessorService::outputNameInUse(const std::string& name, const std::string& except_key) const {
389 // Another transform already outputs this name?
390 for (const auto& [key, recipe] : transform_recipes_) {
391 if (key == except_key) {
392 continue;
393 }
394 if (std::find(recipe.outputs.begin(), recipe.outputs.end(), name) != recipe.outputs.end()) {
395 return true;
396 }
397 }
398 // A live engine topic (source / filter output / other node) has this name, and it
399 // is not this transform's own current output (so an in-place replace is allowed)?
400 std::unordered_set<TopicId> own_outputs;
401 if (const auto it = transform_recipes_.find(except_key); it != transform_recipes_.end()) {
402 own_outputs.insert(it->second.output_topic_ids.begin(), it->second.output_topic_ids.end());
403 }
404 for (const DatasetId ds : engine_.listDatasets()) {
405 for (const TopicId tid : engine_.listTopics(ds)) {
406 if (own_outputs.count(tid) > 0) {
407 continue;
408 }
409 const TopicStorage* storage = engine_.getTopicStorage(tid);
410 if (storage != nullptr && storage->descriptor().name == name) {
411 return true;
412 }
413 }
414 }
415 return false;
416}
417
418Status DataProcessorService::validateScript(
419 std::string_view script, std::string_view language, std::string_view params_json) {

Callers

nothing calls this directly

Calls 9

getTopicStorageMethod · 0.80
descriptorMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45
insertMethod · 0.45
listDatasetsMethod · 0.45
listTopicsMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected