F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
DirectiveIdEnumAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title DirectiveIdEnumAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for DirectiveId enum
5 // ======================================================================
6 
7 #include <cstring>
8 #include <limits>
9 
11 
12 namespace Svc {
13 
14  namespace Fpy {
15 
16  // ----------------------------------------------------------------------
17  // Operators
18  // ----------------------------------------------------------------------
19 
20  DirectiveId& DirectiveId ::
22  {
23  this->e = obj.e;
24 #ifdef BUILD_UT
25  this->m_serializeValueIsSet = obj.m_serializeValueIsSet;
26  this->m_serializeValue = obj.m_serializeValue;
27 #endif
28  return *this;
29  }
30 
33  {
34  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
35  this->e = static_cast<enum T>(e1);
36 #ifdef BUILD_UT
37  this->m_serializeValueIsSet = false;
38  this->m_serializeValue = 0;
39 #endif
40  return *this;
41  }
42 
44  operator=(enum T e1)
45  {
46  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
47  this->e = e1;
48 #ifdef BUILD_UT
49  this->m_serializeValueIsSet = false;
50  this->m_serializeValue = 0;
51 #endif
52  return *this;
53  }
54 
55 #ifdef BUILD_UT
56 
57  std::ostream& operator<<(std::ostream& os, const DirectiveId& obj) {
58  Fw::String s;
59  obj.toString(s);
60  os << s;
61  return os;
62  }
63 
64 #endif
65 
66  // ----------------------------------------------------------------------
67  // Member functions
68  // ----------------------------------------------------------------------
69 
70  bool DirectiveId ::
71  isValid() const
72  {
73  return DirectiveId::isValid(this->e);
74  }
75 
78  Fw::SerialBufferBase& buffer,
79  Fw::Endianness mode
80  ) const
81  {
82  SerialType es = static_cast<SerialType>(this->e);
83 #ifdef BUILD_UT
84  // Unit testing only: On request, override the enum value
85  // with the numeric value, which is allowed to be invalid
86  if (this->m_serializeValueIsSet) {
87  es = this->m_serializeValue;
88  }
89 #endif
90  const Fw::SerializeStatus status = buffer.serializeFrom(es, mode);
91  return status;
92  }
93 
96  Fw::SerialBufferBase& buffer,
97  Fw::Endianness mode
98  )
99  {
100  SerialType es;
101  Fw::SerializeStatus status = buffer.deserializeTo(es, mode);
102  if ((status == Fw::FW_SERIALIZE_OK) && !DirectiveId::isValid(es)) {
104  }
105  if (status == Fw::FW_SERIALIZE_OK) {
106  this->e = static_cast<enum T>(es);
107  }
108  return status;
109  }
110 
111 #if FW_SERIALIZABLE_TO_STRING
112 
113  void DirectiveId ::
114  toString(Fw::StringBase& sb) const
115  {
116  Fw::String s;
117  switch (e) {
118  case INVALID:
119  s = "INVALID";
120  break;
121  case WAIT_REL:
122  s = "WAIT_REL";
123  break;
124  case WAIT_ABS:
125  s = "WAIT_ABS";
126  break;
127  case GOTO:
128  s = "GOTO";
129  break;
130  case IF:
131  s = "IF";
132  break;
133  case NO_OP:
134  s = "NO_OP";
135  break;
136  case PUSH_TLM_VAL:
137  s = "PUSH_TLM_VAL";
138  break;
139  case PUSH_PRM:
140  s = "PUSH_PRM";
141  break;
142  case CONST_CMD:
143  s = "CONST_CMD";
144  break;
145  case OR:
146  s = "OR";
147  break;
148  case AND:
149  s = "AND";
150  break;
151  case IEQ:
152  s = "IEQ";
153  break;
154  case INE:
155  s = "INE";
156  break;
157  case ULT:
158  s = "ULT";
159  break;
160  case ULE:
161  s = "ULE";
162  break;
163  case UGT:
164  s = "UGT";
165  break;
166  case UGE:
167  s = "UGE";
168  break;
169  case SLT:
170  s = "SLT";
171  break;
172  case SLE:
173  s = "SLE";
174  break;
175  case SGT:
176  s = "SGT";
177  break;
178  case SGE:
179  s = "SGE";
180  break;
181  case FEQ:
182  s = "FEQ";
183  break;
184  case FNE:
185  s = "FNE";
186  break;
187  case FLT:
188  s = "FLT";
189  break;
190  case FLE:
191  s = "FLE";
192  break;
193  case FGT:
194  s = "FGT";
195  break;
196  case FGE:
197  s = "FGE";
198  break;
199  case NOT:
200  s = "NOT";
201  break;
202  case FPTOSI:
203  s = "FPTOSI";
204  break;
205  case FPTOUI:
206  s = "FPTOUI";
207  break;
208  case SITOFP:
209  s = "SITOFP";
210  break;
211  case UITOFP:
212  s = "UITOFP";
213  break;
214  case ADD:
215  s = "ADD";
216  break;
217  case SUB:
218  s = "SUB";
219  break;
220  case MUL:
221  s = "MUL";
222  break;
223  case UDIV:
224  s = "UDIV";
225  break;
226  case SDIV:
227  s = "SDIV";
228  break;
229  case UMOD:
230  s = "UMOD";
231  break;
232  case SMOD:
233  s = "SMOD";
234  break;
235  case FADD:
236  s = "FADD";
237  break;
238  case FSUB:
239  s = "FSUB";
240  break;
241  case FMUL:
242  s = "FMUL";
243  break;
244  case FDIV:
245  s = "FDIV";
246  break;
247  case FPOW:
248  s = "FPOW";
249  break;
250  case FLOG:
251  s = "FLOG";
252  break;
253  case FMOD:
254  s = "FMOD";
255  break;
256  case FPEXT:
257  s = "FPEXT";
258  break;
259  case FPTRUNC:
260  s = "FPTRUNC";
261  break;
262  case SIEXT_8_64:
263  s = "SIEXT_8_64";
264  break;
265  case SIEXT_16_64:
266  s = "SIEXT_16_64";
267  break;
268  case SIEXT_32_64:
269  s = "SIEXT_32_64";
270  break;
271  case ZIEXT_8_64:
272  s = "ZIEXT_8_64";
273  break;
274  case ZIEXT_16_64:
275  s = "ZIEXT_16_64";
276  break;
277  case ZIEXT_32_64:
278  s = "ZIEXT_32_64";
279  break;
280  case ITRUNC_64_8:
281  s = "ITRUNC_64_8";
282  break;
283  case ITRUNC_64_16:
284  s = "ITRUNC_64_16";
285  break;
286  case ITRUNC_64_32:
287  s = "ITRUNC_64_32";
288  break;
289  case EXIT:
290  s = "EXIT";
291  break;
292  case ALLOCATE:
293  s = "ALLOCATE";
294  break;
296  s = "STORE_REL_CONST_OFFSET";
297  break;
298  case LOAD_REL:
299  s = "LOAD_REL";
300  break;
301  case PUSH_VAL:
302  s = "PUSH_VAL";
303  break;
304  case DISCARD:
305  s = "DISCARD";
306  break;
307  case MEMCMP:
308  s = "MEMCMP";
309  break;
310  case STACK_CMD:
311  s = "STACK_CMD";
312  break;
314  s = "PUSH_TLM_VAL_AND_TIME";
315  break;
316  case PUSH_TIME:
317  s = "PUSH_TIME";
318  break;
319  case GET_FIELD:
320  s = "GET_FIELD";
321  break;
322  case PEEK:
323  s = "PEEK";
324  break;
325  case STORE_REL:
326  s = "STORE_REL";
327  break;
328  case CALL:
329  s = "CALL";
330  break;
331  case RETURN:
332  s = "RETURN";
333  break;
334  case LOAD_ABS:
335  s = "LOAD_ABS";
336  break;
337  case STORE_ABS:
338  s = "STORE_ABS";
339  break;
341  s = "STORE_ABS_CONST_OFFSET";
342  break;
343  case POP_EVENT:
344  s = "POP_EVENT";
345  break;
346  case SET_SEED:
347  s = "SET_SEED";
348  break;
349  case PUSH_RAND:
350  s = "PUSH_RAND";
351  break;
352  case POP_SERIALIZABLE:
353  s = "POP_SERIALIZABLE";
354  break;
355  case FFLOOR:
356  s = "FFLOOR";
357  break;
358  case IABS:
359  s = "IABS";
360  break;
361  case FABS:
362  s = "FABS";
363  break;
364  default:
365  s = "[invalid]";
366  break;
367  }
368  sb.format("%s (%" PRIu8 ")", s.toChar(), e);
369  }
370 
371 #endif
372 
373 #ifdef BUILD_UT
374 
375  void DirectiveId ::
376  setSerializeValue(SerialType serializeValue)
377  {
378  this->m_serializeValue = serializeValue;
379  this->m_serializeValueIsSet = true;
380  }
381 
382 #endif
383 
384  // ----------------------------------------------------------------------
385  // Static functions
386  // ----------------------------------------------------------------------
387 
388  bool DirectiveId ::
389  isValid(SerialType serialTypeValue)
390  {
391  return (serialTypeValue <= FABS);
392  }
393 
394  }
395 
396 }
Serialization/Deserialization operation was successful.
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.
Deserialization data had incorrect values (unexpected data types)
virtual SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)=0
Serialize an 8-bit unsigned integer value.
SerializeStatus
forward declaration for string
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
DirectiveId & operator=(const DirectiveId &obj)
Copy assignment operator (object)
enum T e
The raw enum value.
const char * toChar() const
Convert to a C-style char*.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:58
bool isValid() const
Check raw enum value for validity.
T
The raw enum type.
U8 SerialType
The serial representation type.
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
RateGroupDivider component implementation.
Endianness
#define FW_ASSERT(...)
Definition: Assert.hpp:14
ComCfg::Apid::SerialType SerialType
Definition: TestUtils.cpp:14