F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
DirectionEnumAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title DirectionEnumAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for Direction enum
5 // ======================================================================
6 
7 #ifndef Fw_DirectionEnumAc_HPP
8 #define Fw_DirectionEnumAc_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 Direction :
19  public Fw::Serializable
20  {
21 
22  public:
23 
24  // ----------------------------------------------------------------------
25  // Types
26  // ----------------------------------------------------------------------
27 
29  using SerialType = U8;
30 
32  enum T {
34  IN = 0,
36  OUT = 1,
38  INOUT = 2,
39  };
40 
42  using t = enum T;
43 
44  public:
45 
46  // ----------------------------------------------------------------------
47  // Constants
48  // ----------------------------------------------------------------------
49 
50  enum {
55  };
56 
57  public:
58 
59  // ----------------------------------------------------------------------
60  // Constructors
61  // ----------------------------------------------------------------------
62 
65  {
66  this->e = IN;
67  }
68 
71  const enum T e1
72  )
73  {
74  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
75  this->e = e1;
76  }
77 
80  const Direction& obj
81  )
82  {
83  this->e = obj.e;
84 #ifdef BUILD_UT
85  this->m_serializeValueIsSet = obj.m_serializeValueIsSet;
86  this->m_serializeValue = obj.m_serializeValue;
87 #endif
88  }
89 
90  public:
91 
92  // ----------------------------------------------------------------------
93  // Operators
94  // ----------------------------------------------------------------------
95 
98  const Direction& obj
99  );
100 
103  enum T e1
104  );
105 
107  operator enum T() const
108  {
109  return this->e;
110  }
111 
113  bool operator==(enum T e1) const
114  {
115  return this->e == e1;
116  }
117 
119  bool operator!=(enum T e1) const
120  {
121  return !(*this == e1);
122  }
123 
124 #ifdef BUILD_UT
125 
127  friend std::ostream& operator<<(
128  std::ostream& os,
129  const Direction& obj
130  );
131 
132 #endif
133 
134  public:
135 
136  // ----------------------------------------------------------------------
137  // Member functions
138  // ----------------------------------------------------------------------
139 
141  bool isValid() const;
142 
145  Fw::SerialBufferBase& buffer,
147  ) const;
148 
151  Fw::SerialBufferBase& buffer,
153  );
154 
155 #if FW_SERIALIZABLE_TO_STRING
156 
158  void toString(
159  Fw::StringBase& sb
160  ) const;
161 
162 #endif
163 
164 #ifdef BUILD_UT
165 
167  void setSerializeValue(
168  SerialType serializeValue
169  );
170 
171 #endif
172 
173  public:
174 
175  // ----------------------------------------------------------------------
176  // Static functions
177  // ----------------------------------------------------------------------
178 
180  static bool isValid(
181  SerialType serialTypeValue
182  );
183 
184  public:
185 
186  // ----------------------------------------------------------------------
187  // Public member variables
188  // ----------------------------------------------------------------------
189 
191  enum T e;
192 
193  private:
194 
195  // ----------------------------------------------------------------------
196  // Private member variables
197  // ----------------------------------------------------------------------
198 
199 #ifdef BUILD_UT
200 
206  bool m_serializeValueIsSet = false;
207 
209  SerialType m_serializeValue = 0;
210 
211 #endif
212 
213  };
214 
215 }
216 
217 #endif
The number of enumerated constants.
U8 SerialType
The serial representation type.
enum T t
For backwards compatibility.
bool isValid() const
Check raw enum value for validity.
The size of the serial representation.
Direction(const enum T e1)
Constructor (user-provided value)
bool operator==(enum T e1) const
Equality operator.
Out direction.
SerializeStatus
forward declaration for string
Direction & operator=(const Direction &obj)
Copy assignment operator (object)
T
The raw enum type.
Direction states.
Direction()
Constructor (default value of IN)
enum T e
The raw enum value.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
In/Out direction.
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.
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
Direction(const Direction &obj)
Copy constructor.
In direction.
Implementation of malloc based allocator.
Endianness
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Big endian serialization.