F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
OnEnumAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title OnEnumAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for On enum
5 // ======================================================================
6 
7 #ifndef Fw_OnEnumAc_HPP
8 #define Fw_OnEnumAc_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 On :
19  public Fw::Serializable
20  {
21 
22  public:
23 
24  // ----------------------------------------------------------------------
25  // Types
26  // ----------------------------------------------------------------------
27 
29  using SerialType = U8;
30 
32  enum T {
34  OFF = 0,
36  ON = 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 
62  On()
63  {
64  this->e = OFF;
65  }
66 
68  On(
69  const enum T e1
70  )
71  {
72  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
73  this->e = e1;
74  }
75 
77  On(
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 
86  On(
87  const On& 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 
104  On& operator=(
105  const On& obj
106  );
107 
109  On& operator=(
110  SerialType e1
111  );
112 
114  On& operator=(
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 On& 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
Off state.
Definition: OnEnumAc.hpp:34
U8 SerialType
The serial representation type.
Definition: OnEnumAc.hpp:29
On and off states.
Definition: OnEnumAc.hpp:18
bool isValid() const
Check raw enum value for validity.
Definition: OnEnumAc.cpp:69
On & operator=(const On &obj)
Copy assignment operator (object)
Definition: OnEnumAc.cpp:19
SerializeStatus
forward declaration for string
enum T t
For backwards compatibility.
Definition: OnEnumAc.hpp:40
bool operator==(enum T e1) const
Equality operator.
Definition: OnEnumAc.hpp:125
On(const enum T e1)
Constructor (user-provided value)
Definition: OnEnumAc.hpp:68
On state.
Definition: OnEnumAc.hpp:36
On(const SerialType e1)
Constructor (serial representation value)
Definition: OnEnumAc.hpp:77
enum T e
The raw enum value.
Definition: OnEnumAc.hpp:203
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
T
The raw enum type.
Definition: OnEnumAc.hpp:32
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
Definition: OnEnumAc.cpp:75
On()
Constructor (default value of OFF)
Definition: OnEnumAc.hpp:62
On(const On &obj)
Copy constructor.
Definition: OnEnumAc.hpp:86
The size of the serial representation.
Definition: OnEnumAc.hpp:50
Implementation of malloc based allocator.
Endianness
The number of enumerated constants.
Definition: OnEnumAc.hpp:52
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Big endian serialization.
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.
Definition: OnEnumAc.cpp:93
bool operator!=(enum T e1) const
Inequality operator.
Definition: OnEnumAc.hpp:131