37 std::stringstream issues;
39 if (signal.header().name().empty())
45 if (signal.has_measurement())
48 measurement->fromMessage(signal, &issues);
49 if (!issues.str().empty())
54 addMeasurement(QString::fromStdString(signal.header().name()), measurement);
56 else if (signal.has_time_series())
59 ts->fromMessage(signal, &issues);
61 if (!issues.str().empty())
66 addTimeSeries(QString::fromStdString(signal.header().name()), ts);
68 else if (signal.has_indexed_values())
71 indexed_values->fromMessage(signal, &issues);
73 if (!issues.str().empty())
78 addIndexedValues(QString::fromStdString(signal.header().name()), indexed_values);
80 else if (signal.has_indexed_values_set())
83 indexed_values_set->fromMessage(signal, &issues);
85 if (!issues.str().empty())
92 else if (signal.has_matrix())
95 matrix_signal->fromMessage(signal, &issues);
97 if (!issues.str().empty())
102 addMatrixSignal(QString::fromStdString(signal.header().name()), matrix_signal);
106 PRINT_ERROR_NAMED(
"The gui currently does not support the message type of " << signal.header().name());
133 it->short_name = it->namespaces.back();
135 it->dimension = measurement->header.value_dimension;
136 it->zero_order_hold = measurement->header.zero_order_hold;
137 for (
const std::string& label : measurement->getValueLabels()) it->value_labels.push_back(QString::fromStdString(label));
140 ts->header = measurement->header;
141 if (!measurement->getValues().empty()) ts->add(*measurement);
148 if (!measurement->getValues().empty())
150 std::static_pointer_cast<TimeSeriesSignal>(it->signal)->add(*measurement);
155 if (!measurement->getValues().empty())
171 it->short_name = it->namespaces.back();
174 ts->getTimeSeries() ? ts->getTimeSeries()->getValueDimension() : ts->header.value_dimension;
175 it->zero_order_hold = ts->header.zero_order_hold;
176 std::vector<std::string> sublabels;
177 ts->getValueLabels(sublabels);
178 for (
const std::string& label : sublabels) it->value_labels.push_back(QString::fromStdString(label));
182 sequence->header = ts->header;
183 if (!ts->isEmpty()) sequence->add(ts->getTimeSeriesPtr());
184 it->signal = sequence;
192 std::static_pointer_cast<TimeSeriesSequenceSignal>(it->signal)->add(ts->getTimeSeriesPtr());
215 it->short_name = it->namespaces.back();
218 it->zero_order_hold = indexed_values->header.zero_order_hold;
221 set->header = indexed_values->header;
222 if (!indexed_values->isEmpty()) set->add(*indexed_values);
229 if (!indexed_values->isEmpty())
231 std::static_pointer_cast<IndexedValuesSetSignal>(it->signal)->add(*indexed_values);
236 if (!indexed_values->isEmpty())
293 it->short_name = it->namespaces.back();
296 it->zero_order_hold = matrix_signal->header.zero_order_hold;
299 set->header = matrix_signal->header;
300 if (!matrix_signal->isEmpty()) set->add(matrix_signal);
307 if (!matrix_signal->isEmpty())
309 std::static_pointer_cast<MatrixSetSignal>(it->signal)->add(matrix_signal);
314 if (!matrix_signal->isEmpty())
372 return &signal_it.value();
381 return &signal_it.value();
395 if (token.size() < 2)
403 id = token.front().toInt(&ret_val);
406 PRINT_WARNING_COND(!ret_val,
"SignalHelper::key2Name(): unknown format in " << key.toStdString());
412 QMutableHashIterator<QString, SignalData> map_it(
_signal_map);
413 while (map_it.hasNext())
417 if (map_it.value().task_id == task_id)
419 QString removed_name = map_it.value().name;
420 int removed_id = map_it.value().task_id;
431 while (map_it.hasNext())
435 if (task_id < 0 || map_it.value().task_id != task_id)
continue;
437 if (map_it.value().name.contains(namespace_pattern))
439 QString removed_name = map_it.value().name;
440 int removed_id = map_it.value().task_id;
450 QMutableHashIterator<QString, SignalData> map_it(
_signal_map);
451 while (map_it.hasNext())
455 QString removed_name = map_it.value().name;
456 int removed_id = map_it.value().task_id;
490 auto idx_it = it->active_indices.find(value_idx);
491 if (idx_it != it->active_indices.end())
493 it->active_indices.erase(idx_it);
496 if (it->active_indices.isEmpty())