F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
GenericStatusEnumAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title GenericStatusEnumAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for GenericStatus enum
5 // ======================================================================
6 
7 #ifndef Os_GenericStatusEnumAc_HPP
8 #define Os_GenericStatusEnumAc_HPP
9 
10 #include "Fw/FPrimeBasicTypes.hpp"
11 #include "Fw/Types/Assert.hpp"
13 #include "Fw/Types/String.hpp"
14 
15 namespace Os {
16 
18  class GenericStatus :
19  public Fw::Serializable
20  {
21 
22  public:
23 
24  // ----------------------------------------------------------------------
25  // Types
26  // ----------------------------------------------------------------------
27 
29  using SerialType = U8;
30 
32  enum T {
34  OP_OK = 0,
36  ERROR = 1,
37  };
38 
40  using t = enum T;
41 
42  public:
43 
44  // ----------------------------------------------------------------------
45  // Constants
46  // ----------------------------------------------------------------------
47 
48  enum {
53  };
54 
55  public:
56 
57  // ----------------------------------------------------------------------
58  // Constructors
59  // ----------------------------------------------------------------------
60 
63  {
64  this->e = OP_OK;
65  }
66 
69  const enum T e1
70  )
71  {
72  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
73  this->e = e1;
74  }
75 
78  const SerialType e1
79  )
80  {
81  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
82  this->e = static_cast<enum T>(e1);
83  }
84 
87  const GenericStatus& obj
88  )
89  {
90  this->e = obj.e;
91 #ifdef BUILD_UT
92  this->m_serializeValueIsSet = obj.m_serializeValueIsSet;
93  this->m_serializeValue = obj.m_serializeValue;
94 #endif
95  }
96 
97  public:
98 
99  // ----------------------------------------------------------------------
100  // Operators
101  // ----------------------------------------------------------------------
102 
105  const GenericStatus& obj
106  );
107 
110  SerialType e1
111  );
112 
115  enum T e1
116  );
117 
119  operator enum T() const
120  {
121  return this->e;
122  }
123 
125  bool operator==(enum T e1) const
126  {
127  return this->e == e1;
128  }
129 
131  bool operator!=(enum T e1) const
132  {
133  return !(*this == e1);
134  }
135 
136 #ifdef BUILD_UT
137 
139  friend std::ostream& operator<<(
140  std::ostream& os,
141  const GenericStatus& obj
142  );
143 
144 #endif
145 
146  public:
147 
148  // ----------------------------------------------------------------------
149  // Member functions
150  // ----------------------------------------------------------------------
151 
153  bool isValid() const;
154 
157  Fw::SerialBufferBase& buffer,
159  ) const;
160 
163  Fw::SerialBufferBase& buffer,
165  );
166 
167 #if FW_SERIALIZABLE_TO_STRING
168 
170  void toString(
171  Fw::StringBase& sb
172  ) const;
173 
174 #endif
175 
176 #ifdef BUILD_UT
177 
179  void setSerializeValue(
180  SerialType serializeValue
181  );
182 
183 #endif
184 
185  public:
186 
187  // ----------------------------------------------------------------------
188  // Static functions
189  // ----------------------------------------------------------------------
190 
192  static bool isValid(
193  SerialType serialTypeValue
194  );
195 
196  public:
197 
198  // ----------------------------------------------------------------------
199  // Public member variables
200  // ----------------------------------------------------------------------
201 
203  enum T e;
204 
205  private:
206 
207  // ----------------------------------------------------------------------
208  // Private member variables
209  // ----------------------------------------------------------------------
210 
211 #ifdef BUILD_UT
212 
218  bool m_serializeValueIsSet = false;
219 
221  SerialType m_serializeValue = 0;
222 
223 #endif
224 
225  };
226 
227 }
228 
229 #endif
GenericStatus(const enum T e1)
Constructor (user-provided value)
bool operator!=(enum T e1) const
Inequality operator.
bool isValid() const
Check raw enum value for validity.
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.
enum T e
The raw enum value.
enum T t
For backwards compatibility.
FPP shadow-enum representing Os::Generic::Status.
The size of the serial representation.
SerializeStatus
forward declaration for string
GenericStatus()
Constructor (default value of OP_OK)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
T
The raw enum type.
U8 SerialType
The serial representation type.
GenericStatus & operator=(const GenericStatus &obj)
Copy assignment operator (object)
GenericStatus(const GenericStatus &obj)
Copy constructor.
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
The number of enumerated constants.
Endianness
bool operator==(enum T e1) const
Equality operator.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Big endian serialization.
GenericStatus(const SerialType e1)
Constructor (serial representation value)