F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FrameErrorEnumAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FrameErrorEnumAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FrameError enum
5 // ======================================================================
6 
7 #include <cstring>
8 #include <limits>
9 
10 #include "Fw/Types/Assert.hpp"
12 
13 namespace Svc {
14 
15  namespace Ccsds {
16 
17  // ----------------------------------------------------------------------
18  // Operators
19  // ----------------------------------------------------------------------
20 
21  FrameError& FrameError ::
23  {
24  this->e = obj.e;
25  return *this;
26  }
27 
30  {
31  this->e = e1;
32  return *this;
33  }
34 
35 #ifdef BUILD_UT
36 
37  std::ostream& operator<<(std::ostream& os, const FrameError& obj) {
38  Fw::String s;
39  obj.toString(s);
40  os << s;
41  return os;
42  }
43 
44 #endif
45 
46  // ----------------------------------------------------------------------
47  // Member functions
48  // ----------------------------------------------------------------------
49 
50  bool FrameError ::
51  isValid() const
52  {
53  return ((e >= SP_INVALID_LENGTH) && (e <= TC_INVALID_CRC));
54  }
55 
58  {
59  const Fw::SerializeStatus status = buffer.serializeFrom(
60  static_cast<SerialType>(this->e)
61  );
62  return status;
63  }
64 
67  {
68  SerialType es;
69  Fw::SerializeStatus status = buffer.deserializeTo(es);
70  if (status == Fw::FW_SERIALIZE_OK) {
71  this->e = static_cast<T>(es);
72  if (!this->isValid()) {
74  }
75  }
76  return status;
77  }
78 
79 #if FW_SERIALIZABLE_TO_STRING
80 
81  void FrameError ::
82  toString(Fw::StringBase& sb) const
83  {
84  Fw::String s;
85  switch (e) {
86  case SP_INVALID_LENGTH:
87  s = "SP_INVALID_LENGTH";
88  break;
89  case TC_INVALID_SCID:
90  s = "TC_INVALID_SCID";
91  break;
92  case TC_INVALID_LENGTH:
93  s = "TC_INVALID_LENGTH";
94  break;
95  case TC_INVALID_VCID:
96  s = "TC_INVALID_VCID";
97  break;
98  case TC_INVALID_CRC:
99  s = "TC_INVALID_CRC";
100  break;
101  default:
102  s = "[invalid]";
103  break;
104  }
105  sb.format("%s (%" PRIu8 ")", s.toChar(), e);
106  }
107 
108 #elif FW_ENABLE_TEXT_LOGGING
109 
110  void FrameError ::
111  toString(Fw::StringBase& sb) const
112  {
113  sb.format("%" PRIu8 "", e);
114  }
115 
116 #endif
117 
118  }
119 
120 }
Serialization/Deserialization operation was successful.
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase &buffer)
Deserialize raw enum value from SerialType.
Enum representing an error during framing/deframing in the CCSDS protocols.
const char * toChar() const
Definition: String.hpp:50
Deserialization data had incorrect values (unexpected data types)
SerializeStatus
forward declaration for string
Fw::SerializeStatus serializeTo(Fw::SerializeBufferBase &buffer) const
Serialize raw enum value to SerialType.
FrameError & operator=(const FrameError &obj)
Copy assignment operator (object)
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
T e
The raw enum value.
U8 SerialType
The serial representation type.
RateGroupDivider component implementation.
SerializeStatus serializeFrom(U8 val)
serialize 8-bit unsigned int
T
The raw enum type.
bool isValid() const
Check raw enum value for validity.
SerializeStatus deserializeTo(U8 &val)
deserialize 8-bit unsigned int