Skip to content

Commit 28020b5

Browse files
committed
fix(probes): throw if probe_name not found during export
1 parent ff5633e commit 28020b5

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

apps/core/includes/dataexporter/partial_exporter.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ namespace Core
6868
* @brief Writes probe data to the export.
6969
*
7070
* @param data A span of constant doubles containing the probe measurements.
71+
* @throw out_or_range if probe_name not already registered
7172
*/
7273
void write_probe(const std::string& probe_name,
7374
std::span<const double> data);

apps/core/src/dataexporter/partial_exporter.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,14 @@ namespace Core
7979
export_counter++;
8080
}
8181

82-
// TODO add ProbeType argument to select correct array depending on type + add
83-
// 2 probes_count_n_element.
84-
// Change probe_counter_n_element to std::vector<std::size_t> where size is
85-
// number of probe type
8682
void
8783
PartialExporter::write_probe(const std::string& probe_name,
8884
std::span<const double> data)
8985
{
9086
std::string data_set_name = IO::format("probes/", probe_name);
91-
auto& counter = this->probe_counter_n_element[probe_name];
87+
88+
auto& counter
89+
= this->probe_counter_n_element.at(probe_name); // Throw if bad name
9290

9391
append_array(data_set_name, data, counter);
9492
counter += data.size();

0 commit comments

Comments
 (0)