F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileSystemStatusEnumAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileSystemStatusEnumAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FileSystemStatus enum
5 // ======================================================================
6 
7 #include <cstring>
8 #include <limits>
9 
10 #include "Fw/Types/Assert.hpp"
12 
13 namespace Os {
14 
15  // ----------------------------------------------------------------------
16  // Operators
17  // ----------------------------------------------------------------------
18 
19  FileSystemStatus& FileSystemStatus ::
21  {
22  this->e = obj.e;
23  return *this;
24  }
25 
27  operator=(enum T e1)
28  {
29  this->e = e1;
30  return *this;
31  }
32 
33 #ifdef BUILD_UT
34 
35  std::ostream& operator<<(std::ostream& os, const FileSystemStatus& obj) {
36  Fw::String s;
37  obj.toString(s);
38  os << s;
39  return os;
40  }
41 
42 #endif
43 
44  // ----------------------------------------------------------------------
45  // Member functions
46  // ----------------------------------------------------------------------
47 
49  isValid() const
50  {
51  return ((e >= OP_OK) && (e <= OTHER_ERROR));
52  }
53 
56  Fw::SerialBufferBase& buffer,
57  Fw::Endianness mode
58  ) const
59  {
60  const Fw::SerializeStatus status = buffer.serializeFrom(
61  static_cast<SerialType>(this->e),
62  mode
63  );
64  return status;
65  }
66 
69  Fw::SerialBufferBase& buffer,
70  Fw::Endianness mode
71  )
72  {
73  SerialType es;
74  Fw::SerializeStatus status = buffer.deserializeTo(es, mode);
75  if (status == Fw::FW_SERIALIZE_OK) {
76  this->e = static_cast<enum T>(es);
77  if (!this->isValid()) {
79  }
80  }
81  return status;
82  }
83 
84 #if FW_SERIALIZABLE_TO_STRING
85 
86  void FileSystemStatus ::
87  toString(Fw::StringBase& sb) const
88  {
89  Fw::String s;
90  switch (e) {
91  case OP_OK:
92  s = "OP_OK";
93  break;
94  case ALREADY_EXISTS:
95  s = "ALREADY_EXISTS";
96  break;
97  case NO_SPACE:
98  s = "NO_SPACE";
99  break;
100  case NO_PERMISSION:
101  s = "NO_PERMISSION";
102  break;
103  case NOT_DIR:
104  s = "NOT_DIR";
105  break;
106  case IS_DIR:
107  s = "IS_DIR";
108  break;
109  case NOT_EMPTY:
110  s = "NOT_EMPTY";
111  break;
112  case INVALID_PATH:
113  s = "INVALID_PATH";
114  break;
115  case DOESNT_EXIST:
116  s = "DOESNT_EXIST";
117  break;
118  case FILE_LIMIT:
119  s = "FILE_LIMIT";
120  break;
121  case BUSY:
122  s = "BUSY";
123  break;
124  case NO_MORE_FILES:
125  s = "NO_MORE_FILES";
126  break;
127  case BUFFER_TOO_SMALL:
128  s = "BUFFER_TOO_SMALL";
129  break;
130  case EXDEV_ERROR:
131  s = "EXDEV_ERROR";
132  break;
133  case OVERFLOW_ERROR:
134  s = "OVERFLOW_ERROR";
135  break;
136  case NOT_SUPPORTED:
137  s = "NOT_SUPPORTED";
138  break;
139  case OTHER_ERROR:
140  s = "OTHER_ERROR";
141  break;
142  default:
143  s = "[invalid]";
144  break;
145  }
146  sb.format("%s (%" PRIu8 ")", s.toChar(), e);
147  }
148 
149 #elif FW_ENABLE_TEXT_LOGGING
150 
151  void FileSystemStatus ::
152  toString(Fw::StringBase& sb) const
153  {
154  sb.format("%" PRIu8 "", e);
155  }
156 
157 #endif
158 
159 }
Buffer size is too small to hold full path (for getWorkingDirectory)
Serialization/Deserialization operation was successful.
FileSystemStatus & operator=(const FileSystemStatus &obj)
Copy assignment operator (object)
Path is too long, too many sym links, etc.
FPP shadow-enum representing Os::FileSystem::Status.
Directory stream has no more files.
Operation was successful.
const char * toChar() const
Convert to a C-style char*.
Definition: String.hpp:50
Deserialization data had incorrect values (unexpected data types)
virtual SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)=0
Serialize an 8-bit unsigned integer value.
Operation is not supported by the current implementation.
SerializeStatus
forward declaration for string
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
Operation failed due to overflow in calculation of the result.
enum T e
The raw enum value.
bool isValid() const
Check raw enum value for validity.
Operand is in use by the system or by a process.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
Endianness
Operation not supported across devices (e.g. rename)
U8 SerialType
The serial representation type.
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.