Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame^] | 1 | #include "report_types.hpp" |
| 2 | |
| 3 | #include "utils/transform.hpp" |
| 4 | |
| 5 | ReadingParameters |
| 6 | toReadingParameters(const std::vector<LabeledMetricParameters>& labeled) |
| 7 | { |
| 8 | namespace ts = utils::tstring; |
| 9 | |
| 10 | return utils::transform( |
| 11 | labeled, [](const LabeledMetricParameters& metricParams) { |
| 12 | return ReadingParameters::value_type( |
| 13 | utils::transform( |
| 14 | metricParams.at_label<ts::SensorPath>(), |
| 15 | [](const LabeledSensorParameters& sensorParameters) { |
| 16 | return sdbusplus::message::object_path( |
| 17 | sensorParameters.at_label<ts::Path>()); |
| 18 | }), |
| 19 | utils::enumToString(metricParams.at_label<ts::OperationType>()), |
| 20 | metricParams.at_label<ts::Id>(), |
| 21 | metricParams.at_label<ts::MetricMetadata>(), |
| 22 | utils::enumToString( |
| 23 | metricParams.at_label<ts::CollectionTimeScope>()), |
| 24 | metricParams.at_label<ts::CollectionDuration>().t.count()); |
| 25 | }); |
| 26 | } |