F´ Flight Software - C/C++ Documentation  devel
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 
20  operator=(const FileSystemStatus& obj)
21  {
22  this->e = obj.e;
23  return *this;
24  }
25 
27  operator=(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  {
57  const Fw::SerializeStatus status = buffer.serialize(
58  static_cast<SerialType>(this->e)
59  );
60  return status;
61  }
62 
65  {
66  SerialType es;
67  Fw::SerializeStatus status = buffer.deserialize(es);
68  if (status == Fw::FW_SERIALIZE_OK) {
69  this->e = static_cast<T>(es);
70  if (!this->isValid()) {
72  }
73  }
74  return status;
75  }
76 
77 #if FW_SERIALIZABLE_TO_STRING
78 
79  void FileSystemStatus ::
80  toString(Fw::StringBase& sb) const
81  {
82  Fw::String s;
83  switch (e) {
84  case OP_OK:
85  s = "OP_OK";
86  break;
87  case ALREADY_EXISTS:
88  s = "ALREADY_EXISTS";
89  break;
90  case NO_SPACE:
91  s = "NO_SPACE";
92  break;
93  case NO_PERMISSION:
94  s = "NO_PERMISSION";
95  break;
96  case NOT_DIR:
97  s = "NOT_DIR";
98  break;
99  case IS_DIR:
100  s = "IS_DIR";
101  break;
102  case NOT_EMPTY:
103  s = "NOT_EMPTY";
104  break;
105  case INVALID_PATH:
106  s = "INVALID_PATH";
107  break;
108  case DOESNT_EXIST:
109  s = "DOESNT_EXIST";
110  break;
111  case FILE_LIMIT:
112  s = "FILE_LIMIT";
113  break;
114  case BUSY:
115  s = "BUSY";
116  break;
117  case NO_MORE_FILES:
118  s = "NO_MORE_FILES";
119  break;
120  case BUFFER_TOO_SMALL:
121  s = "BUFFER_TOO_SMALL";
122  break;
123  case EXDEV_ERROR:
124  s = "EXDEV_ERROR";
125  break;
126  case OVERFLOW_ERROR:
127  s = "OVERFLOW_ERROR";
128  break;
129  case NOT_SUPPORTED:
130  s = "NOT_SUPPORTED";
131  break;
132  case OTHER_ERROR:
133  s = "OTHER_ERROR";
134  break;
135  default:
136  s = "[invalid]";
137  break;
138  }
139  sb.format("%s (%" PRIi32 ")", s.toChar(), e);
140  }
141 
142 #elif FW_ENABLE_TEXT_LOGGING
143 
144  void FileSystemStatus ::
145  toString(Fw::StringBase& sb) const
146  {
147  sb.format("%" PRIi32 "", e);
148  }
149 
150 #endif
151 
152 }
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:56
const char * toChar() const
Definition: String.hpp:50
FPP shadow-enum representing Os::FileSystem::Status.
I32 SerialType
The serial representation type.
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialize raw enum value to SerialType.
bool isValid() const
Check raw enum value for validity.
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialize raw enum value from SerialType.
@ IS_DIR
Path is a directory.
@ INVALID_PATH
Path is too long, too many sym links, etc.
@ BUFFER_TOO_SMALL
Buffer size is too small to hold full path (for getWorkingDirectory)
@ NOT_SUPPORTED
Operation is not supported by the current implementation.
@ NOT_DIR
Path is not a directory.
@ BUSY
Operand is in use by the system or by a process.
@ ALREADY_EXISTS
File already exists.
@ OTHER_ERROR
other OS-specific error
@ NO_MORE_FILES
Directory stream has no more files.
@ DOESNT_EXIST
Path doesn't exist.
@ OVERFLOW_ERROR
Operation failed due to overflow in calculation of the result.
@ EXDEV_ERROR
Operation not supported across devices (e.g. rename)
@ NOT_EMPTY
directory is not empty
@ OP_OK
Operation was successful.
@ NO_PERMISSION
No permission to write.
@ FILE_LIMIT
Too many files or links.
FileSystemStatus & operator=(const FileSystemStatus &obj)
Copy assignment operator (object)
SerializeStatus
forward declaration for string
@ FW_DESERIALIZE_FORMAT_ERROR
Deserialization data had incorrect values (unexpected data types)
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.