F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileModeEnumAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileModeEnumAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for FileMode enum
5 // ======================================================================
6 
7 #ifndef Os_FileModeEnumAc_HPP
8 #define Os_FileModeEnumAc_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 FileMode :
19  public Fw::Serializable
20  {
21 
22  public:
23 
24  // ----------------------------------------------------------------------
25  // Types
26  // ----------------------------------------------------------------------
27 
29  using SerialType = U8;
30 
32  enum T {
36  OPEN_READ = 1,
45  };
46 
48  using t = enum T;
49 
50  public:
51 
52  // ----------------------------------------------------------------------
53  // Constants
54  // ----------------------------------------------------------------------
55 
56  enum {
61  };
62 
63  public:
64 
65  // ----------------------------------------------------------------------
66  // Constructors
67  // ----------------------------------------------------------------------
68 
71  {
72  this->e = OPEN_NO_MODE;
73  }
74 
77  const enum T e1
78  )
79  {
80  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
81  this->e = e1;
82  }
83 
86  const SerialType e1
87  )
88  {
89  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
90  this->e = static_cast<enum T>(e1);
91  }
92 
95  const FileMode& obj
96  )
97  {
98  this->e = obj.e;
99 #ifdef BUILD_UT
100  this->m_serializeValueIsSet = obj.m_serializeValueIsSet;
101  this->m_serializeValue = obj.m_serializeValue;
102 #endif
103  }
104 
105  public:
106 
107  // ----------------------------------------------------------------------
108  // Operators
109  // ----------------------------------------------------------------------
110 
113  const FileMode& obj
114  );
115 
118  SerialType e1
119  );
120 
123  enum T e1
124  );
125 
127  operator enum T() const
128  {
129  return this->e;
130  }
131 
133  bool operator==(enum T e1) const
134  {
135  return this->e == e1;
136  }
137 
139  bool operator!=(enum T e1) const
140  {
141  return !(*this == e1);
142  }
143 
144 #ifdef BUILD_UT
145 
147  friend std::ostream& operator<<(
148  std::ostream& os,
149  const FileMode& obj
150  );
151 
152 #endif
153 
154  public:
155 
156  // ----------------------------------------------------------------------
157  // Member functions
158  // ----------------------------------------------------------------------
159 
161  bool isValid() const;
162 
165  Fw::SerialBufferBase& buffer,
167  ) const;
168 
171  Fw::SerialBufferBase& buffer,
173  );
174 
175 #if FW_SERIALIZABLE_TO_STRING
176 
178  void toString(
179  Fw::StringBase& sb
180  ) const;
181 
182 #endif
183 
184 #ifdef BUILD_UT
185 
187  void setSerializeValue(
188  SerialType serializeValue
189  );
190 
191 #endif
192 
193  public:
194 
195  // ----------------------------------------------------------------------
196  // Static functions
197  // ----------------------------------------------------------------------
198 
200  static bool isValid(
201  SerialType serialTypeValue
202  );
203 
204  public:
205 
206  // ----------------------------------------------------------------------
207  // Public member variables
208  // ----------------------------------------------------------------------
209 
211  enum T e;
212 
213  private:
214 
215  // ----------------------------------------------------------------------
216  // Private member variables
217  // ----------------------------------------------------------------------
218 
219 #ifdef BUILD_UT
220 
226  bool m_serializeValueIsSet = false;
227 
229  SerialType m_serializeValue = 0;
230 
231 #endif
232 
233  };
234 
235 }
236 
237 #endif
The number of enumerated constants.
Open file for writing and truncates file if it exists, ie same flags as creat()
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
Open file for writing; writes don&#39;t return until data is on disk.
Open file for writing.
enum T t
For backwards compatibility.
FileMode()
Constructor (default value of OPEN_NO_MODE)
bool operator==(enum T e1) const
Equality operator.
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.
SerializeStatus
forward declaration for string
U8 SerialType
The serial representation type.
FileMode(const FileMode &obj)
Copy constructor.
FPP shadow-enum representing Os::File::Mode.
FileMode(const SerialType e1)
Constructor (serial representation value)
File mode not yet selected.
The size of the serial representation.
bool isValid() const
Check raw enum value for validity.
Open file for appending.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
Open file for reading.
bool operator!=(enum T e1) const
Inequality operator.
FileMode & operator=(const FileMode &obj)
Copy assignment operator (object)
T
The raw enum type.
FileMode(const enum T e1)
Constructor (user-provided value)
Endianness
enum T e
The raw enum value.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Big endian serialization.