F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FileStatusEnumAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileStatusEnumAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FileStatus 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  FileStatus& FileStatus ::
21  {
22  this->e = obj.e;
23  return *this;
24  }
25 
28  {
29  this->e = e1;
30  return *this;
31  }
32 
33 #ifdef BUILD_UT
34 
35  std::ostream& operator<<(std::ostream& os, const FileStatus& 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 
48  bool FileStatus ::
49  isValid() const
50  {
51  return ((e >= OP_OK) && (e <= OTHER_ERROR));
52  }
53 
56  {
57  const Fw::SerializeStatus status = buffer.serializeFrom(
58  static_cast<SerialType>(this->e)
59  );
60  return status;
61  }
62 
65  {
66  SerialType es;
67  Fw::SerializeStatus status = buffer.deserializeTo(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 FileStatus ::
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 DOESNT_EXIST:
88  s = "DOESNT_EXIST";
89  break;
90  case NO_SPACE:
91  s = "NO_SPACE";
92  break;
93  case NO_PERMISSION:
94  s = "NO_PERMISSION";
95  break;
96  case BAD_SIZE:
97  s = "BAD_SIZE";
98  break;
99  case NOT_OPENED:
100  s = "NOT_OPENED";
101  break;
102  case FILE_EXISTS:
103  s = "FILE_EXISTS";
104  break;
105  case NOT_SUPPORTED:
106  s = "NOT_SUPPORTED";
107  break;
108  case INVALID_MODE:
109  s = "INVALID_MODE";
110  break;
111  case INVALID_ARGUMENT:
112  s = "INVALID_ARGUMENT";
113  break;
114  case NO_MORE_RESOURCES:
115  s = "NO_MORE_RESOURCES";
116  break;
117  case OTHER_ERROR:
118  s = "OTHER_ERROR";
119  break;
120  default:
121  s = "[invalid]";
122  break;
123  }
124  sb.format("%s (%" PRIi32 ")", s.toChar(), e);
125  }
126 
127 #elif FW_ENABLE_TEXT_LOGGING
128 
129  void FileStatus ::
130  toString(Fw::StringBase& sb) const
131  {
132  sb.format("%" PRIi32 "", e);
133  }
134 
135 #endif
136 
137 }
Serialization/Deserialization operation was successful.
const char * toChar() const
Definition: String.hpp:50
bool isValid() const
Check raw enum value for validity.
file hasn&#39;t been opened yet
Deserialization data had incorrect values (unexpected data types)
No permission to read/write file.
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase &buffer)
Deserialize raw enum value from SerialType.
File doesn&#39;t exist (for read)
FileStatus & operator=(const FileStatus &obj)
Copy assignment operator (object)
SerializeStatus
forward declaration for string
file already exist (for CREATE with O_EXCL enabled)
No more available resources.
T
The raw enum type.
A catch-all for other errors. Have to look in implementation-specific code.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
I32 SerialType
The serial representation type.
Kernel or file system does not support operation.
Mode for file access is invalid for current operation.
T e
The raw enum value.
Fw::SerializeStatus serializeTo(Fw::SerializeBufferBase &buffer) const
Serialize raw enum value to SerialType.
Invalid argument passed in.
SerializeStatus serializeFrom(U8 val)
serialize 8-bit unsigned int
FPP shadow-enum representing Os::File::Status.
Invalid size parameter.
Operation was successful.
SerializeStatus deserializeTo(U8 &val)
deserialize 8-bit unsigned int