1 #include "report_types.hpp"
2 
3 #include "utils/transform.hpp"
4 
5 ReadingParameters
toReadingParameters(const std::vector<LabeledMetricParameters> & labeled)6     toReadingParameters(const std::vector<LabeledMetricParameters>& labeled)
7 {
8     namespace ts = utils::tstring;
9 
10     return utils::transform(labeled,
11                             [](const LabeledMetricParameters& metricParams) {
12         return ReadingParameters::value_type(
13             utils::transform(metricParams.at_label<ts::SensorPath>(),
14                              [](const LabeledSensorInfo& sensorParameters) {
15             return std::tuple<sdbusplus::message::object_path, std::string>(
16                 sensorParameters.at_label<ts::Path>(),
17                 sensorParameters.at_label<ts::Metadata>());
18         }),
19             utils::enumToString(metricParams.at_label<ts::OperationType>()),
20             utils::enumToString(
21                 metricParams.at_label<ts::CollectionTimeScope>()),
22             metricParams.at_label<ts::CollectionDuration>().t.count());
23     });
24 }
25