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>(), |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 15 | [](const LabeledSensorInfo& sensorParameters) { |
Krzysztof Grobelny | b8cc78d | 2021-11-29 15:54:53 +0100 | [diff] [blame] | 16 | return std::tuple<sdbusplus::message::object_path, |
| 17 | std::string>( |
| 18 | sensorParameters.at_label<ts::Path>(), |
| 19 | sensorParameters.at_label<ts::Metadata>()); |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 20 | }), |
| 21 | utils::enumToString(metricParams.at_label<ts::OperationType>()), |
| 22 | metricParams.at_label<ts::Id>(), |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 23 | utils::enumToString( |
| 24 | metricParams.at_label<ts::CollectionTimeScope>()), |
| 25 | metricParams.at_label<ts::CollectionDuration>().t.count()); |
| 26 | }); |
| 27 | } |