F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
QueueIdEnumAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title QueueIdEnumAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for QueueId enum
5 // ======================================================================
6 
7 #include <cstring>
8 #include <limits>
9 
11 
12 namespace Svc {
13 
14  namespace Ccsds {
15 
16  namespace Cfdp {
17 
18  // ----------------------------------------------------------------------
19  // Operators
20  // ----------------------------------------------------------------------
21 
22  QueueId& QueueId ::
23  operator=(const QueueId& obj)
24  {
25  this->e = obj.e;
26 #ifdef BUILD_UT
27  this->m_serializeValueIsSet = obj.m_serializeValueIsSet;
28  this->m_serializeValue = obj.m_serializeValue;
29 #endif
30  return *this;
31  }
32 
35  {
36  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
37  this->e = static_cast<enum T>(e1);
38 #ifdef BUILD_UT
39  this->m_serializeValueIsSet = false;
40  this->m_serializeValue = 0;
41 #endif
42  return *this;
43  }
44 
46  operator=(enum T e1)
47  {
48  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
49  this->e = e1;
50 #ifdef BUILD_UT
51  this->m_serializeValueIsSet = false;
52  this->m_serializeValue = 0;
53 #endif
54  return *this;
55  }
56 
57 #ifdef BUILD_UT
58 
59  std::ostream& operator<<(std::ostream& os, const QueueId& obj) {
60  Fw::String s;
61  obj.toString(s);
62  os << s;
63  return os;
64  }
65 
66 #endif
67 
68  // ----------------------------------------------------------------------
69  // Member functions
70  // ----------------------------------------------------------------------
71 
72  bool QueueId ::
73  isValid() const
74  {
75  return QueueId::isValid(this->e);
76  }
77 
80  Fw::SerialBufferBase& buffer,
81  Fw::Endianness mode
82  ) const
83  {
84  SerialType es = static_cast<SerialType>(this->e);
85 #ifdef BUILD_UT
86  // Unit testing only: On request, override the enum value
87  // with the numeric value, which is allowed to be invalid
88  if (this->m_serializeValueIsSet) {
89  es = this->m_serializeValue;
90  }
91 #endif
92  const Fw::SerializeStatus status = buffer.serializeFrom(es, mode);
93  return status;
94  }
95 
98  Fw::SerialBufferBase& buffer,
99  Fw::Endianness mode
100  )
101  {
102  SerialType es;
103  Fw::SerializeStatus status = buffer.deserializeTo(es, mode);
104  if ((status == Fw::FW_SERIALIZE_OK) && !QueueId::isValid(es)) {
106  }
107  if (status == Fw::FW_SERIALIZE_OK) {
108  this->e = static_cast<enum T>(es);
109  }
110  return status;
111  }
112 
113 #if FW_SERIALIZABLE_TO_STRING
114 
115  void QueueId ::
116  toString(Fw::StringBase& sb) const
117  {
118  Fw::String s;
119  switch (e) {
120  case PEND:
121  s = "PEND";
122  break;
123  case TXA:
124  s = "TXA";
125  break;
126  case TXW:
127  s = "TXW";
128  break;
129  case RX:
130  s = "RX";
131  break;
132  case HIST:
133  s = "HIST";
134  break;
135  case HIST_FREE:
136  s = "HIST_FREE";
137  break;
138  case FREE:
139  s = "FREE";
140  break;
141  case NUM:
142  s = "NUM";
143  break;
144  default:
145  s = "[invalid]";
146  break;
147  }
148  sb.format("%s (%" PRIu8 ")", s.toChar(), e);
149  }
150 
151 #endif
152 
153 #ifdef BUILD_UT
154 
155  void QueueId ::
156  setSerializeValue(SerialType serializeValue)
157  {
158  this->m_serializeValue = serializeValue;
159  this->m_serializeValueIsSet = true;
160  }
161 
162 #endif
163 
164  // ----------------------------------------------------------------------
165  // Static functions
166  // ----------------------------------------------------------------------
167 
168  bool QueueId ::
169  isValid(SerialType serialTypeValue)
170  {
171  return (serialTypeValue <= NUM);
172  }
173 
174  }
175 
176  }
177 
178 }
Serialization/Deserialization operation was successful.
first one on this list is active
Deserialization data had incorrect values (unexpected data types)
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.
virtual SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)=0
Serialize an 8-bit unsigned integer value.
enum T e
The raw enum value.
SerializeStatus
forward declaration for string
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
U8 SerialType
The serial representation type.
bool isValid() const
Check raw enum value for validity.
const char * toChar() const
Convert to a C-style char*.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:58
RateGroupDivider component implementation.
QueueId & operator=(const QueueId &obj)
Copy assignment operator (object)
Endianness
T
The raw enum type.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
ComCfg::Apid::SerialType SerialType
Definition: TestUtils.cpp:14