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,
45  };
46 
48  using t = enum T;
49 
50  public:
51 
52  // ----------------------------------------------------------------------
53  // Constants
54  // ----------------------------------------------------------------------
55 
56  enum {
61  };
62 
63  public:
64 
65  // ----------------------------------------------------------------------
66  // Constructors
67  // ----------------------------------------------------------------------
68 
71  {
72  this->e = OK;
73  }
74 
77  const enum T e1
78  )
79  {
80  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
81  this->e = e1;
82  }
83 
86  const CmdResponse& obj
87  )
88  {
89  this->e = obj.e;
90 #ifdef BUILD_UT
91  this->m_serializeValueIsSet = obj.m_serializeValueIsSet;
92  this->m_serializeValue = obj.m_serializeValue;
93 #endif
94  }
95 
96  public:
97 
98  // ----------------------------------------------------------------------
99  // Operators
100  // ----------------------------------------------------------------------
101 
104  const CmdResponse& obj
105  );
106 
109  enum T e1
110  );
111 
113  operator enum T() const
114  {
115  return this->e;
116  }
117 
119  bool operator==(enum T e1) const
120  {
121  return this->e == e1;
122  }
123 
125  bool operator!=(enum T e1) const
126  {
127  return !(*this == e1);
128  }
129 
130 #ifdef BUILD_UT
131 
133  friend std::ostream& operator<<(
134  std::ostream& os,
135  const CmdResponse& obj
136  );
137 
138 #endif
139 
140  public:
141 
142  // ----------------------------------------------------------------------
143  // Member functions
144  // ----------------------------------------------------------------------
145 
147  bool isValid() const;
148 
151  Fw::SerialBufferBase& buffer,
153  ) const;
154 
157  Fw::SerialBufferBase& buffer,
159  );
160 
161 #if FW_SERIALIZABLE_TO_STRING
162 
164  void toString(
165  Fw::StringBase& sb
166  ) const;
167 
168 #endif
169 
170 #ifdef BUILD_UT
171 
173  void setSerializeValue(
174  SerialType serializeValue
175  );
176 
177 #endif
178 
179  public:
180 
181  // ----------------------------------------------------------------------
182  // Static functions
183  // ----------------------------------------------------------------------
184 
186  static bool isValid(
187  SerialType serialTypeValue
188  );
189 
190  public:
191 
192  // ----------------------------------------------------------------------
193  // Public member variables
194  // ----------------------------------------------------------------------
195 
197  enum T e;
198 
199  private:
200 
201  // ----------------------------------------------------------------------
202  // Private member variables
203  // ----------------------------------------------------------------------
204 
205 #ifdef BUILD_UT
206 
212  bool m_serializeValueIsSet = false;
213 
215  SerialType m_serializeValue = 0;
216 
217 #endif
218 
219  };
220 
221 }
222 
223 #endif
CmdResponse(const CmdResponse &obj)
Copy constructor.
Invalid opcode dispatched.
The size of the serial representation.
enum T e
The raw enum value.
Enum representing a command response.
The number of enumerated constants.
bool isValid() const
Check raw enum value for validity.
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)
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.
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.