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 
10 #include "Fw/Types/Assert.hpp"
12 
13 namespace Svc {
14 
15  namespace Fpy {
16 
17  // ----------------------------------------------------------------------
18  // Operators
19  // ----------------------------------------------------------------------
20 
21  DirectiveId& DirectiveId ::
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 DirectiveId& 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 DirectiveId ::
51  isValid() const
52  {
53  return ((e >= INVALID) && (e <= EXIT));
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 DirectiveId ::
82  toString(Fw::StringBase& sb) const
83  {
84  Fw::String s;
85  switch (e) {
86  case INVALID:
87  s = "INVALID";
88  break;
89  case WAIT_REL:
90  s = "WAIT_REL";
91  break;
92  case WAIT_ABS:
93  s = "WAIT_ABS";
94  break;
95  case SET_SER_REG:
96  s = "SET_SER_REG";
97  break;
98  case GOTO:
99  s = "GOTO";
100  break;
101  case IF:
102  s = "IF";
103  break;
104  case NO_OP:
105  s = "NO_OP";
106  break;
107  case GET_TLM:
108  s = "GET_TLM";
109  break;
110  case GET_PRM:
111  s = "GET_PRM";
112  break;
113  case CMD:
114  s = "CMD";
115  break;
116  case SET_REG:
117  s = "SET_REG";
118  break;
119  case DESER_SER_REG_8:
120  s = "DESER_SER_REG_8";
121  break;
122  case DESER_SER_REG_4:
123  s = "DESER_SER_REG_4";
124  break;
125  case DESER_SER_REG_2:
126  s = "DESER_SER_REG_2";
127  break;
128  case DESER_SER_REG_1:
129  s = "DESER_SER_REG_1";
130  break;
131  case OR:
132  s = "OR";
133  break;
134  case AND:
135  s = "AND";
136  break;
137  case IEQ:
138  s = "IEQ";
139  break;
140  case INE:
141  s = "INE";
142  break;
143  case ULT:
144  s = "ULT";
145  break;
146  case ULE:
147  s = "ULE";
148  break;
149  case UGT:
150  s = "UGT";
151  break;
152  case UGE:
153  s = "UGE";
154  break;
155  case SLT:
156  s = "SLT";
157  break;
158  case SLE:
159  s = "SLE";
160  break;
161  case SGT:
162  s = "SGT";
163  break;
164  case SGE:
165  s = "SGE";
166  break;
167  case FEQ:
168  s = "FEQ";
169  break;
170  case FNE:
171  s = "FNE";
172  break;
173  case FLT:
174  s = "FLT";
175  break;
176  case FLE:
177  s = "FLE";
178  break;
179  case FGT:
180  s = "FGT";
181  break;
182  case FGE:
183  s = "FGE";
184  break;
185  case NOT:
186  s = "NOT";
187  break;
188  case FPEXT:
189  s = "FPEXT";
190  break;
191  case FPTRUNC:
192  s = "FPTRUNC";
193  break;
194  case FPTOSI:
195  s = "FPTOSI";
196  break;
197  case FPTOUI:
198  s = "FPTOUI";
199  break;
200  case SITOFP:
201  s = "SITOFP";
202  break;
203  case UITOFP:
204  s = "UITOFP";
205  break;
206  case EXIT:
207  s = "EXIT";
208  break;
209  default:
210  s = "[invalid]";
211  break;
212  }
213  sb.format("%s (%" PRIu8 ")", s.toChar(), e);
214  }
215 
216 #elif FW_ENABLE_TEXT_LOGGING
217 
218  void DirectiveId ::
219  toString(Fw::StringBase& sb) const
220  {
221  sb.format("%" PRIu8 "", e);
222  }
223 
224 #endif
225 
226  }
227 
228 }
Serialization/Deserialization operation was successful.
U8 SerialType
The serial representation type.
const char * toChar() const
Definition: String.hpp:50
Deserialization data had incorrect values (unexpected data types)
SerializeStatus
forward declaration for string
DirectiveId & operator=(const DirectiveId &obj)
Copy assignment operator (object)
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase &buffer)
Deserialize raw enum value from SerialType.
Fw::SerializeStatus serializeTo(Fw::SerializeBufferBase &buffer) const
Serialize raw enum value to SerialType.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
T e
The raw enum value.
bool isValid() const
Check raw enum value for validity.
T
The raw enum type.
RateGroupDivider component implementation.
SerializeStatus serializeFrom(U8 val)
serialize 8-bit unsigned int
SerializeStatus deserializeTo(U8 &val)
deserialize 8-bit unsigned int