F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SpiStatusEnumAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SpiStatusEnumAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for SpiStatus enum
5 // ======================================================================
6 
7 #ifndef Drv_SpiStatusEnumAc_HPP
8 #define Drv_SpiStatusEnumAc_HPP
9 
10 #include "Fw/FPrimeBasicTypes.hpp"
11 #include "Fw/Types/Assert.hpp"
13 #include "Fw/Types/String.hpp"
14 
15 namespace Drv {
16 
17  class SpiStatus :
18  public Fw::Serializable
19  {
20 
21  public:
22 
23  // ----------------------------------------------------------------------
24  // Types
25  // ----------------------------------------------------------------------
26 
28  using SerialType = U8;
29 
31  enum T {
33  SPI_OK = 0,
44  };
45 
47  using t = enum T;
48 
49  public:
50 
51  // ----------------------------------------------------------------------
52  // Constants
53  // ----------------------------------------------------------------------
54 
55  enum {
60  };
61 
62  public:
63 
64  // ----------------------------------------------------------------------
65  // Constructors
66  // ----------------------------------------------------------------------
67 
70  {
71  this->e = SPI_OK;
72  }
73 
76  const enum T e1
77  )
78  {
79  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
80  this->e = e1;
81  }
82 
85  const SerialType e1
86  )
87  {
88  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
89  this->e = static_cast<enum T>(e1);
90  }
91 
94  const SpiStatus& obj
95  )
96  {
97  this->e = obj.e;
98 #ifdef BUILD_UT
99  this->m_serializeValueIsSet = obj.m_serializeValueIsSet;
100  this->m_serializeValue = obj.m_serializeValue;
101 #endif
102  }
103 
104  public:
105 
106  // ----------------------------------------------------------------------
107  // Operators
108  // ----------------------------------------------------------------------
109 
112  const SpiStatus& obj
113  );
114 
117  SerialType e1
118  );
119 
122  enum T e1
123  );
124 
126  operator enum T() const
127  {
128  return this->e;
129  }
130 
132  bool operator==(enum T e1) const
133  {
134  return this->e == e1;
135  }
136 
138  bool operator!=(enum T e1) const
139  {
140  return !(*this == e1);
141  }
142 
143 #ifdef BUILD_UT
144 
146  friend std::ostream& operator<<(
147  std::ostream& os,
148  const SpiStatus& obj
149  );
150 
151 #endif
152 
153  public:
154 
155  // ----------------------------------------------------------------------
156  // Member functions
157  // ----------------------------------------------------------------------
158 
160  bool isValid() const;
161 
164  Fw::SerialBufferBase& buffer,
166  ) const;
167 
170  Fw::SerialBufferBase& buffer,
172  );
173 
174 #if FW_SERIALIZABLE_TO_STRING
175 
177  void toString(
178  Fw::StringBase& sb
179  ) const;
180 
181 #endif
182 
183 #ifdef BUILD_UT
184 
186  void setSerializeValue(
187  SerialType serializeValue
188  );
189 
190 #endif
191 
192  public:
193 
194  // ----------------------------------------------------------------------
195  // Static functions
196  // ----------------------------------------------------------------------
197 
199  static bool isValid(
200  SerialType serialTypeValue
201  );
202 
203  public:
204 
205  // ----------------------------------------------------------------------
206  // Public member variables
207  // ----------------------------------------------------------------------
208 
210  enum T e;
211 
212  private:
213 
214  // ----------------------------------------------------------------------
215  // Private member variables
216  // ----------------------------------------------------------------------
217 
218 #ifdef BUILD_UT
219 
225  bool m_serializeValueIsSet = false;
226 
228  SerialType m_serializeValue = 0;
229 
230 #endif
231 
232  };
233 
234 }
235 
236 #endif
SpiStatus(const SpiStatus &obj)
Copy constructor.
enum T t
For backwards compatibility.
SpiStatus(const enum T e1)
Constructor (user-provided value)
U8 SerialType
The serial representation type.
SerializeStatus
forward declaration for string
Other errors that do not fit.
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
SpiStatus()
Constructor (default value of SPI_OK)
bool operator!=(enum T e1) const
Inequality operator.
SpiStatus(const SerialType e1)
Constructor (serial representation value)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
SpiStatus & operator=(const SpiStatus &obj)
Copy assignment operator (object)
enum T e
The raw enum value.
The size of the serial representation.
SPI driver failed to open device.
bool operator==(enum T e1) const
Equality operator.
T
The raw enum type.
Endianness
Transaction okay.
The number of enumerated constants.
bool isValid() const
Check raw enum value for validity.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.
Big endian serialization.