F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
CmdResponseEnumAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title CmdResponseEnumAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for CmdResponse enum
5 // ======================================================================
6 
7 #ifndef Fw_CmdResponseEnumAc_HPP
8 #define Fw_CmdResponseEnumAc_HPP
9 
10 #include "Fw/FPrimeBasicTypes.hpp"
11 #include "Fw/Types/Assert.hpp"
13 #include "Fw/Types/String.hpp"
14 
15 namespace Fw {
16 
18  class CmdResponse :
19  public Fw::Serializable
20  {
21 
22  public:
23 
24  // ----------------------------------------------------------------------
25  // Types
26  // ----------------------------------------------------------------------
27 
29  using SerialType = U8;
30 
32  enum T {
34  OK = 0,
44  BUSY = 5,
46  CLEARED = 6,
49  };
50 
52  using t = enum T;
53 
54  public:
55 
56  // ----------------------------------------------------------------------
57  // Constants
58  // ----------------------------------------------------------------------
59 
60  enum {
65  };
66 
67  public:
68 
69  // ----------------------------------------------------------------------
70  // Constructors
71  // ----------------------------------------------------------------------
72 
75  {
76  this->e = OK;
77  }
78 
81  const enum T e1
82  )
83  {
84  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
85  this->e = e1;
86  }
87 
90  const SerialType e1
91  )
92  {
93  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
94  this->e = static_cast<enum T>(e1);
95  }
96 
99  const CmdResponse& obj
100  )
101  {
102  this->e = obj.e;
103 #ifdef BUILD_UT
104  this->m_serializeValueIsSet = obj.m_serializeValueIsSet;
105  this->m_serializeValue = obj.m_serializeValue;
106 #endif
107  }
108 
109  public:
110 
111  // ----------------------------------------------------------------------
112  // Operators
113  // ----------------------------------------------------------------------
114 
117  const CmdResponse& obj
118  );
119 
122  SerialType e1
123  );
124 
127  enum T e1
128  );
129 
131  operator enum T() const
132  {
133  return this->e;
134  }
135 
137  bool operator==(enum T e1) const
138  {
139  return this->e == e1;
140  }
141 
143  bool operator!=(enum T e1) const
144  {
145  return !(*this == e1);
146  }
147 
148 #ifdef BUILD_UT
149 
151  friend std::ostream& operator<<(
152  std::ostream& os,
153  const CmdResponse& obj
154  );
155 
156 #endif
157 
158  public:
159 
160  // ----------------------------------------------------------------------
161  // Member functions
162  // ----------------------------------------------------------------------
163 
165  bool isValid() const;
166 
169  Fw::SerialBufferBase& buffer,
171  ) const;
172 
175  Fw::SerialBufferBase& buffer,
177  );
178 
179 #if FW_SERIALIZABLE_TO_STRING
180 
182  void toString(
183  Fw::StringBase& sb
184  ) const;
185 
186 #endif
187 
188 #ifdef BUILD_UT
189 
191  void setSerializeValue(
192  SerialType serializeValue
193  );
194 
195 #endif
196 
197  public:
198 
199  // ----------------------------------------------------------------------
200  // Static functions
201  // ----------------------------------------------------------------------
202 
204  static bool isValid(
205  SerialType serialTypeValue
206  );
207 
208  public:
209 
210  // ----------------------------------------------------------------------
211  // Public member variables
212  // ----------------------------------------------------------------------
213 
215  enum T e;
216 
217  private:
218 
219  // ----------------------------------------------------------------------
220  // Private member variables
221  // ----------------------------------------------------------------------
222 
223 #ifdef BUILD_UT
224 
230  bool m_serializeValueIsSet = false;
231 
233  SerialType m_serializeValue = 0;
234 
235 #endif
236 
237  };
238 
239 }
240 
241 #endif
CmdResponse(const CmdResponse &obj)
Copy constructor.
Invalid opcode dispatched.
The number of enumerated constants.
enum T e
The raw enum value.
Enum representing a command response.
bool isValid() const
Check raw enum value for validity.
Command tracking was cleared before the command completed.
SerializeStatus
forward declaration for string
CmdResponse & operator=(const CmdResponse &obj)
Copy assignment operator (object)
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.
bool operator!=(enum T e1) const
Inequality operator.
T
The raw enum type.
CmdResponse(const enum T e1)
Constructor (user-provided value)
CmdResponse(const SerialType e1)
Constructor (serial representation value)
The size of the serial representation.
Command successfully executed.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
bool operator==(enum T e1) const
Equality operator.
Command failed to deserialize.
Command had execution error.
U8 SerialType
The serial representation type.
Command failed validation.
Command was dispatched but the response tracking failed, indicating unknown state.
Implementation of malloc based allocator.
Endianness
enum T t
For backwards compatibility.
#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.
CmdResponse()
Constructor (default value of OK)
Big endian serialization.