Add formatters

This commit is contained in:
2026-03-09 15:15:37 +01:00
parent d4091d56a6
commit 5cc2b9f501
2 changed files with 60 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
#pragma once
#include "aare/RemapDefs.hpp"
namespace aare::remap::format {
static inline std::string toString(defs::Rotation);
static inline std::string toString(defs::SensorPixelGeometry const &g);
static inline std::string toString(defs::SensorStrixelGeometry const &g);
static inline std::string toString(defs::SensorGroupConfig const &c);
inline std::ostream &operator<<(std::ostream &os,
defs::SensorGroupConfig const &c);
} // namespace aare::remap::format
+48
View File
@@ -0,0 +1,48 @@
#include "aare/RemapFormat.hpp"
#include <sstream>
namespace aare::remap::format {
static inline std::string toString(defs::Rotation r) {
return (r == defs::Rotation::Normal ? "Normal" : "Inverse");
}
static inline std::string toString(defs::SensorPixelGeometry const &g) {
std::ostringstream os;
os << "SensorPixelGeometry\n"
<< " cols x rows: " << g.cols << " x " << g.rows << "\n"
<< " guardring :\n"
<< " x = " << g.guardring.x << "\n"
<< " y = " << g.guardring.y << "\n";
return os.str();
}
static inline std::string toString(defs::SensorStrixelGeometry const &g) {
std::ostringstream os;
os << "SensorStrixelGeometry\n"
<< " multiplicity: " << g.multiplicity << "\n"
<< " pitch : " << g.pitch_um << " um\n";
return os.str();
}
static inline std::string toString(defs::SensorGroupConfig const &c) {
std::ostringstream os;
os << "SensorGroupConfig\n"
<< toString(c.pixel) << "\n"
<< toString(c.strixel) << "\n"
<< " placement on sensor:\n"
<< c.placement_on_sensor << "\n";
return os.str();
}
inline std::ostream &operator<<(std::ostream &os,
defs::SensorGroupConfig const &c) {
return os << toString(c);
}
} // namespace aare::remap::format