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,
47  };
48 
50  using t = enum T;
51 
52  public:
53 
54  // ----------------------------------------------------------------------
55  // Constants
56  // ----------------------------------------------------------------------
57 
58  enum {
63  };
64 
65  public:
66 
67  // ----------------------------------------------------------------------
68  // Constructors
69  // ----------------------------------------------------------------------
70 
73  {
74  this->e = OK;
75  }
76 
79  const enum T e1
80  )
81  {
82  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
83  this->e = e1;
84  }
85 
88  const SerialType e1
89  )
90  {
91  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
92  this->e = static_cast<enum T>(e1);
93  }
94 
97  const CmdResponse& obj
98  )
99  {
100  this->e = obj.e;
101 #ifdef BUILD_UT
102  this->m_serializeValueIsSet = obj.m_serializeValueIsSet;
103  this->m_serializeValue = obj.m_serializeValue;
104 #endif
105  }
106 
107  public:
108 
109  // ----------------------------------------------------------------------
110  // Operators
111  // ----------------------------------------------------------------------
112 
115  const CmdResponse& obj
116  );
117 
120  SerialType e1
121  );
122 
125  enum T e1
126  );
127 
129  operator enum T() const
130  {
131  return this->e;
132  }
133 
135  bool operator==(enum T e1) const
136  {
137  return this->e == e1;
138  }
139 
141  bool operator!=(enum T e1) const
142  {
143  return !(*this == e1);
144  }
145 
146 #ifdef BUILD_UT
147 
149  friend std::ostream& operator<<(
150  std::ostream& os,
151  const CmdResponse& obj
152  );
153 
154 #endif
155 
156  public:
157 
158  // ----------------------------------------------------------------------
159  // Member functions
160  // ----------------------------------------------------------------------
161 
163  bool isValid() const;
164 
167  Fw::SerialBufferBase& buffer,
169  ) const;
170 
173  Fw::SerialBufferBase& buffer,
175  );
176 
177 #if FW_SERIALIZABLE_TO_STRING
178 
180  void toString(
181  Fw::StringBase& sb
182  ) const;
183 
184 #endif
185 
186 #ifdef BUILD_UT
187 
189  void setSerializeValue(
190  SerialType serializeValue
191  );
192 
193 #endif
194 
195  public:
196 
197  // ----------------------------------------------------------------------
198  // Static functions
199  // ----------------------------------------------------------------------
200 
202  static bool isValid(
203  SerialType serialTypeValue
204  );
205 
206  public:
207 
208  // ----------------------------------------------------------------------
209  // Public member variables
210  // ----------------------------------------------------------------------
211 
213  enum T e;
214 
215  private:
216 
217  // ----------------------------------------------------------------------
218  // Private member variables
219  // ----------------------------------------------------------------------
220 
221 #ifdef BUILD_UT
222 
228  bool m_serializeValueIsSet = false;
229 
231  SerialType m_serializeValue = 0;
232 
233 #endif
234 
235  };
236 
237 }
238 
239 #endif
CmdResponse(const CmdResponse &obj)
Copy constructor.
Invalid opcode dispatched.
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.
The size of the serial representation.
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)
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
The number of enumerated constants.
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.