F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
OpenEnumAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title OpenEnumAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for Open enum
5 // ======================================================================
6 
7 #ifndef Fw_OpenEnumAc_HPP
8 #define Fw_OpenEnumAc_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 Open :
19  public Fw::Serializable
20  {
21 
22  public:
23 
24  // ----------------------------------------------------------------------
25  // Types
26  // ----------------------------------------------------------------------
27 
29  using SerialType = U8;
30 
32  enum T {
34  CLOSED = 0,
36  OPEN = 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  Open()
63  {
64  this->e = CLOSED;
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 Open& obj
79  )
80  {
81  this->e = obj.e;
82 #ifdef BUILD_UT
83  this->m_serializeValueIsSet = obj.m_serializeValueIsSet;
84  this->m_serializeValue = obj.m_serializeValue;
85 #endif
86  }
87 
88  public:
89 
90  // ----------------------------------------------------------------------
91  // Operators
92  // ----------------------------------------------------------------------
93 
95  Open& operator=(
96  const Open& obj
97  );
98 
100  Open& operator=(
101  enum T e1
102  );
103 
105  operator enum T() const
106  {
107  return this->e;
108  }
109 
111  bool operator==(enum T e1) const
112  {
113  return this->e == e1;
114  }
115 
117  bool operator!=(enum T e1) const
118  {
119  return !(*this == e1);
120  }
121 
122 #ifdef BUILD_UT
123 
125  friend std::ostream& operator<<(
126  std::ostream& os,
127  const Open& obj
128  );
129 
130 #endif
131 
132  public:
133 
134  // ----------------------------------------------------------------------
135  // Member functions
136  // ----------------------------------------------------------------------
137 
139  bool isValid() const;
140 
143  Fw::SerialBufferBase& buffer,
145  ) const;
146 
149  Fw::SerialBufferBase& buffer,
151  );
152 
153 #if FW_SERIALIZABLE_TO_STRING
154 
156  void toString(
157  Fw::StringBase& sb
158  ) const;
159 
160 #endif
161 
162 #ifdef BUILD_UT
163 
165  void setSerializeValue(
166  SerialType serializeValue
167  );
168 
169 #endif
170 
171  public:
172 
173  // ----------------------------------------------------------------------
174  // Static functions
175  // ----------------------------------------------------------------------
176 
178  static bool isValid(
179  SerialType serialTypeValue
180  );
181 
182  public:
183 
184  // ----------------------------------------------------------------------
185  // Public member variables
186  // ----------------------------------------------------------------------
187 
189  enum T e;
190 
191  private:
192 
193  // ----------------------------------------------------------------------
194  // Private member variables
195  // ----------------------------------------------------------------------
196 
197 #ifdef BUILD_UT
198 
204  bool m_serializeValueIsSet = false;
205 
207  SerialType m_serializeValue = 0;
208 
209 #endif
210 
211  };
212 
213 }
214 
215 #endif
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.
Definition: OpenEnumAc.cpp:81
bool isValid() const
Check raw enum value for validity.
Definition: OpenEnumAc.cpp:57
T
The raw enum type.
Definition: OpenEnumAc.hpp:32
bool operator!=(enum T e1) const
Inequality operator.
Definition: OpenEnumAc.hpp:117
Open & operator=(const Open &obj)
Copy assignment operator (object)
Definition: OpenEnumAc.cpp:19
The number of enumerated constants.
Definition: OpenEnumAc.hpp:52
enum T t
For backwards compatibility.
Definition: OpenEnumAc.hpp:40
enum T e
The raw enum value.
Definition: OpenEnumAc.hpp:189
Open state.
Definition: OpenEnumAc.hpp:36
Open()
Constructor (default value of CLOSED)
Definition: OpenEnumAc.hpp:62
SerializeStatus
forward declaration for string
Open(const Open &obj)
Copy constructor.
Definition: OpenEnumAc.hpp:77
The size of the serial representation.
Definition: OpenEnumAc.hpp:50
Closed state.
Definition: OpenEnumAc.hpp:34
Open(const enum T e1)
Constructor (user-provided value)
Definition: OpenEnumAc.hpp:68
bool operator==(enum T e1) const
Equality operator.
Definition: OpenEnumAc.hpp:111
Open and closed states.
Definition: OpenEnumAc.hpp:18
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
Implementation of malloc based allocator.
Endianness
U8 SerialType
The serial representation type.
Definition: OpenEnumAc.hpp:29
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Big endian serialization.
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
Definition: OpenEnumAc.cpp:63