F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
QueueStatusEnumAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title QueueStatusEnumAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for QueueStatus 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  QueueStatus& QueueStatus ::
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 QueueStatus& 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 QueueStatus ::
49  isValid() const
50  {
51  return ((e >= OP_OK) && (e <= UNKNOWN_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<T>(es);
77  if (!this->isValid()) {
79  }
80  }
81  return status;
82  }
83 
84 #if FW_SERIALIZABLE_TO_STRING
85 
86  void QueueStatus ::
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_CREATED:
95  s = "ALREADY_CREATED";
96  break;
97  case EMPTY:
98  s = "EMPTY";
99  break;
100  case UNINITIALIZED:
101  s = "UNINITIALIZED";
102  break;
103  case SIZE_MISMATCH:
104  s = "SIZE_MISMATCH";
105  break;
106  case SEND_ERROR:
107  s = "SEND_ERROR";
108  break;
109  case RECEIVE_ERROR:
110  s = "RECEIVE_ERROR";
111  break;
112  case INVALID_PRIORITY:
113  s = "INVALID_PRIORITY";
114  break;
115  case FULL:
116  s = "FULL";
117  break;
118  case NOT_SUPPORTED:
119  s = "NOT_SUPPORTED";
120  break;
121  case ALLOCATION_FAILED:
122  s = "ALLOCATION_FAILED";
123  break;
124  case UNKNOWN_ERROR:
125  s = "UNKNOWN_ERROR";
126  break;
127  default:
128  s = "[invalid]";
129  break;
130  }
131  sb.format("%s (%" PRIu8 ")", s.toChar(), e);
132  }
133 
134 #elif FW_ENABLE_TEXT_LOGGING
135 
136  void QueueStatus ::
137  toString(Fw::StringBase& sb) const
138  {
139  sb.format("%" PRIu8 "", e);
140  }
141 
142 #endif
143 
144 }
Serialization/Deserialization operation was successful.
invalid priority requested
bool isValid() const
Check raw enum value for validity.
const char * toChar() const
Convert to a C-style char*.
Definition: String.hpp:50
QueueStatus & operator=(const QueueStatus &obj)
Copy assignment operator (object)
Deserialization data had incorrect values (unexpected data types)
U8 SerialType
The serial representation type.
virtual SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)=0
Serialize an 8-bit unsigned integer value.
message sent/received okay
SerializeStatus
forward declaration for string
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.
Queue was full when attempting to send a message.
attempted to send or receive with buffer too large, too small
T
The raw enum type.
Queue feature is not supported.
FPP shadow-enum representing Os::Queue::Status.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
creating an already created queue
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
If non-blocking, all the messages have been drained.
required memory could not be allocated
Queue wasn&#39;t initialized successfully.
Endianness
T e
The raw enum value.
Unexpected error; can&#39;t match with returns.