1 #include "types/readings.hpp" 2 3 #include "utils/transform.hpp" 4 5 namespace utils 6 { 7 8 namespace ts = utils::tstring; 9 10 LabeledReadings toLabeledReadings(const Readings& readings) 11 { 12 return LabeledReadings{ 13 std::get<0>(readings), 14 utils::transform(std::get<1>(readings), [](const auto& readingData) { 15 return LabeledReadingData{readingData}; 16 })}; 17 } 18 19 Readings toReadings(const LabeledReadings& labeledReadings) 20 { 21 return Readings{labeledReadings.at_label<ts::Timestamp>(), 22 utils::transform(labeledReadings.at_label<ts::Readings>(), 23 [](const auto& labeledReadingData) { 24 return labeledReadingData.to_tuple(); 25 })}; 26 } 27 28 } // namespace utils 29