mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-02-19 08:08:42 +01:00
formatted main branch
This commit is contained in:
22
src/defs.cpp
22
src/defs.cpp
@@ -5,15 +5,11 @@
|
||||
#include <fmt/core.h>
|
||||
namespace aare {
|
||||
|
||||
|
||||
void assert_failed(const std::string &msg)
|
||||
{
|
||||
void assert_failed(const std::string &msg) {
|
||||
fmt::print(msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Convert a DetectorType to a string
|
||||
* @param type DetectorType
|
||||
@@ -40,7 +36,7 @@ template <> std::string ToString(DetectorType arg) {
|
||||
case DetectorType::Xilinx_ChipTestBoard:
|
||||
return "Xilinx_ChipTestBoard";
|
||||
|
||||
//Custom ones
|
||||
// Custom ones
|
||||
case DetectorType::Moench03:
|
||||
return "Moench03";
|
||||
case DetectorType::Moench03_old:
|
||||
@@ -48,8 +44,8 @@ template <> std::string ToString(DetectorType arg) {
|
||||
case DetectorType::Unknown:
|
||||
return "Unknown";
|
||||
|
||||
//no default case to trigger compiler warning if not all
|
||||
//enum values are handled
|
||||
// no default case to trigger compiler warning if not all
|
||||
// enum values are handled
|
||||
}
|
||||
throw std::runtime_error("Could not decode detector to string");
|
||||
}
|
||||
@@ -80,14 +76,14 @@ template <> DetectorType StringTo(const std::string &arg) {
|
||||
if (arg == "Xilinx_ChipTestBoard")
|
||||
return DetectorType::Xilinx_ChipTestBoard;
|
||||
|
||||
//Custom ones
|
||||
// Custom ones
|
||||
if (arg == "Moench03")
|
||||
return DetectorType::Moench03;
|
||||
if (arg == "Moench03_old")
|
||||
return DetectorType::Moench03_old;
|
||||
if (arg == "Unknown")
|
||||
return DetectorType::Unknown;
|
||||
|
||||
|
||||
throw std::runtime_error("Could not decode detector from: \"" + arg + "\"");
|
||||
}
|
||||
|
||||
@@ -102,7 +98,8 @@ template <> TimingMode StringTo(const std::string &arg) {
|
||||
return TimingMode::Auto;
|
||||
if (arg == "trigger")
|
||||
return TimingMode::Trigger;
|
||||
throw std::runtime_error("Could not decode timing mode from: \"" + arg + "\"");
|
||||
throw std::runtime_error("Could not decode timing mode from: \"" + arg +
|
||||
"\"");
|
||||
}
|
||||
|
||||
template <> FrameDiscardPolicy StringTo(const std::string &arg) {
|
||||
@@ -112,7 +109,8 @@ template <> FrameDiscardPolicy StringTo(const std::string &arg) {
|
||||
return FrameDiscardPolicy::Discard;
|
||||
if (arg == "discardpartial")
|
||||
return FrameDiscardPolicy::DiscardPartial;
|
||||
throw std::runtime_error("Could not decode frame discard policy from: \"" + arg + "\"");
|
||||
throw std::runtime_error("Could not decode frame discard policy from: \"" +
|
||||
arg + "\"");
|
||||
}
|
||||
|
||||
// template <> TimingMode StringTo<TimingMode>(std::string mode);
|
||||
|
||||
Reference in New Issue
Block a user