MCPcopy Create free account
hub / github.com/chrxh/alien / serializeStatistics

Method serializeStatistics

source/PersisterInterface/SerializerService.cpp:1409–1443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1407}
1408
1409void SerializerService::serializeStatistics(StatisticsHistoryData const& statistics, std::ostream& stream)
1410{
1411 //header row
1412 auto writeLabelAllColors = [&stream](auto const& name) {
1413 for (int i = 0; i < MAX_COLORS; ++i) {
1414 if (i != 0) {
1415 stream << ",";
1416 }
1417 stream << name << " (color " << i << ")";
1418 }
1419 stream << "," << name << " (accumulated)";
1420 };
1421
1422 int index = 0;
1423 for (auto const& [colName, colorDependent]: ColumnDescriptions) {
1424 if (index != 0) {
1425 stream << ", ";
1426 }
1427 if (!colorDependent) {
1428 stream << colName;
1429 }
1430 else {
1431 writeLabelAllColors(colName);
1432 }
1433 ++index;
1434 }
1435 stream << std::endl;
1436
1437 //content
1438 for (auto dataPoints : statistics) {
1439 std::vector<std::string> entries;
1440 save(entries, dataPoints);
1441 stream << boost::join(entries, ",") << std::endl;
1442 }
1443}
1444
1445void SerializerService::deserializeStatistics(StatisticsHistoryData& statistics, std::istream& stream)
1446{

Callers

nothing calls this directly

Calls 1

saveFunction · 0.85

Tested by

no test coverage detected