File indexing completed on 2025-01-18 09:10:43
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <iostream>
0012 #include <string> // for string printing
0013 #include <system_error> // bring in std::error_code et al
0014
0015 namespace ActsAlignment {
0016
0017 enum class AlignmentError {
0018 NoAlignmentDofOnTrack = 1,
0019 AlignmentParametersUpdateFailure = 2,
0020 ConvergeFailure = 3
0021 };
0022
0023 namespace detail {
0024
0025 class AlignmentErrorCategory : public std::error_category {
0026 public:
0027
0028 const char* name() const noexcept final { return "AlignmentError"; }
0029
0030 std::string message(int c) const final {
0031 switch (static_cast<AlignmentError>(c)) {
0032 case AlignmentError::NoAlignmentDofOnTrack:
0033 return "No alignment parameters on the track";
0034 case AlignmentError::AlignmentParametersUpdateFailure:
0035 return "Update to alignment parameters failure";
0036 case AlignmentError::ConvergeFailure:
0037 return "The alignment is not converged";
0038 default:
0039 return "unknown";
0040 }
0041 }
0042 };
0043 }
0044
0045
0046 extern inline const detail::AlignmentErrorCategory& AlignmentErrorCategory() {
0047 static detail::AlignmentErrorCategory c;
0048 return c;
0049 }
0050
0051 inline std::error_code make_error_code(ActsAlignment::AlignmentError e) {
0052 return {static_cast<int>(e), ActsAlignment::AlignmentErrorCategory()};
0053 }
0054 }
0055
0056 namespace std {
0057
0058 template <>
0059 struct is_error_code_enum<ActsAlignment::AlignmentError> : std::true_type {};
0060 }