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

Method createDataset

pj_datastore/src/engine.cpp:75–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73// ---------------------------------------------------------------------------
74
75Expected<DatasetId> DataEngine::createDataset(DatasetDescriptor descriptor, DatasetId requested_id) {
76 std::unique_lock<std::recursive_mutex> lock(impl_->mutex_);
77 DatasetId id = requested_id != 0 ? requested_id : impl_->next_dataset_id;
78 if (requested_id != 0) {
79 if (impl_->datasets.find(requested_id) != impl_->datasets.end()) {
80 return PJ::unexpected(fmt::format("Dataset {} already exists", requested_id));
81 }
82 }
83
84 // Verify time domain exists if specified
85 if (descriptor.time_domain_id != 0) {
86 auto it = impl_->time_domains.find(descriptor.time_domain_id);
87 if (it == impl_->time_domains.end()) {
88 return PJ::unexpected(fmt::format("Time domain {} not found", descriptor.time_domain_id));
89 }
90 }
91 if (requested_id != 0) {
92 if (impl_->next_dataset_id <= id) {
93 impl_->next_dataset_id = id + 1;
94 }
95 } else {
96 ++impl_->next_dataset_id;
97 }
98
99 DatasetInfo info;
100 info.id = id;
101 info.source_name = std::move(descriptor.source_name);
102 if (descriptor.time_domain_id != 0) {
103 info.time_domain = impl_->time_domains.at(descriptor.time_domain_id);
104 }
105 impl_->datasets.emplace(id, std::move(info));
106 return id;
107}
108
109const DatasetInfo* DataEngine::getDataset(DatasetId id) const {
110 auto it = impl_->datasets.find(id);

Callers 15

SetUpMethod · 0.80
PlotFixtureMethod · 0.80
TESTFunction · 0.80
TESTFunction · 0.80
TESTFunction · 0.80
SetUpMethod · 0.80
TESTFunction · 0.80
TESTFunction · 0.80
TEST_FFunction · 0.80
TESTFunction · 0.80
loadPotatoFunction · 0.80
registerTopicFunction · 0.80

Calls 3

atMethod · 0.80
findMethod · 0.45
endMethod · 0.45

Tested by 15

SetUpMethod · 0.64
PlotFixtureMethod · 0.64
TESTFunction · 0.64
TESTFunction · 0.64
TESTFunction · 0.64
SetUpMethod · 0.64
TESTFunction · 0.64
TESTFunction · 0.64
TEST_FFunction · 0.64
TESTFunction · 0.64
loadPotatoFunction · 0.64
registerTopicFunction · 0.64