RTC Toolkit  2.0.0
mudpiProcessingError.hpp
Go to the documentation of this file.
1 
11 #ifndef RTCTK_REUSABLECOMPONENT_TELREPUB_MUDPIPROCESSORERROR_HPP_
12 #define RTCTK_REUSABLECOMPONENT_TELREPUB_MUDPIPROCESSORERROR_HPP_
13 
14 
15 #include <system_error>
16 
17 namespace rtctk::telRepub {
18 
24 {
28  TopicIdOutOfRange = 1,
29 
33  FrameIdOutOfRange,
34 
38  SynchronizingSample,
39 
43  MissingFrame,
44 
48  TopicTooLong,
49 
54 };
55 
56 
62 class MudpiProcessorErrorCategory : public std::error_category {
66  const char* name() const noexcept override {
67  return "MudpiProcessingError";
68  }
69 
73  std::string message(int ev) const noexcept override {
74  switch (static_cast<MudpiProcessingError>(ev)) {
75  case MudpiProcessingError::TopicIdOutOfRange:
76  return "TopicId out of range";
77  case MudpiProcessingError::FrameIdOutOfRange:
78  return "FrameId out of range";
79  case MudpiProcessingError::SynchronizingSample:
80  return "Synchronizing sample due to Missing (skipped) sample(s)";
81  case MudpiProcessingError::MissingFrame:
82  return "Missing (skipped) frame in a sample";
83  case MudpiProcessingError::TopicTooLong:
84  return "Topic too long";
86  return "Queue Overflow";
87  default:
88  return "unknown";
89  }
90  }
91 
92  virtual bool equivalent(const std::error_code& code,
93  int condition) const noexcept override {
94  return false;
95  }
96 };
97 
103 inline const std::error_category& GetMudpiProcessorErrorCategory() {
104  static const MudpiProcessorErrorCategory inst{};
105  return inst;
106 }
107 
113 inline std::error_code make_error_code(MudpiProcessingError e) { // NOLINT
114  return {static_cast<int>(e), GetMudpiProcessorErrorCategory()};
115 }
116 
117 } // closing namespace rtctk::telRepub
118 
119 namespace std {
120 template <>
121 struct is_error_code_enum<rtctk::telRepub::MudpiProcessingError> : true_type {};
122 } // namespace std
123 
124 
125 
126 #endif //RTCTK_REUSABLECOMPONENT_TELREPUB_MUDPIPROCESSORERROR_HPP_
127 
128 
129 
rtctk::telRepub
Definition: ddsPubThread.hpp:26
rtctk::telRepub::MudpiProcessorErrorCategory
MUDPI Processor error category.
Definition: mudpiProcessingError.hpp:62
rtctk::telRepub::GetMudpiProcessorErrorCategory
const std::error_category & GetMudpiProcessorErrorCategory()
MudpiProcessing error category.
Definition: mudpiProcessingError.hpp:103
rtctk::telRepub::MudpiProcessingError
MudpiProcessingError
MUDPI Processor errors.
Definition: mudpiProcessingError.hpp:24
rtctk::telRepub::MudpiProcessingError::TopicIdOutOfRange
@ TopicIdOutOfRange
TopicId out of range.
rtctk::telRepub::make_error_code
std::error_code make_error_code(MudpiProcessingError e)
Create std::error_code from ProcessingError.
Definition: mudpiProcessingError.hpp:113
std
Definition: mudpiProcessingError.hpp:119
rtctk
Definition: commandReplier.cpp:20