F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
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
13namespace Os {
14
15 // ----------------------------------------------------------------------
16 // Operators
17 // ----------------------------------------------------------------------
18
19 QueueStatus& QueueStatus ::
20 operator=(const QueueStatus& obj)
21 {
22 this->e = obj.e;
23 return *this;
24 }
25
26 QueueStatus& QueueStatus ::
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 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
54 Fw::SerializeStatus QueueStatus ::
55 serialize(Fw::SerializeBufferBase& buffer) const
56 {
57 const Fw::SerializeStatus status = buffer.serialize(
58 static_cast<SerialType>(this->e)
59 );
60 return status;
61 }
62
63 Fw::SerializeStatus QueueStatus ::
64 deserialize(Fw::SerializeBufferBase& buffer)
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 QueueStatus ::
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_CREATED:
88 s = "ALREADY_CREATED";
89 break;
90 case EMPTY:
91 s = "EMPTY";
92 break;
93 case UNINITIALIZED:
94 s = "UNINITIALIZED";
95 break;
96 case SIZE_MISMATCH:
97 s = "SIZE_MISMATCH";
98 break;
99 case SEND_ERROR:
100 s = "SEND_ERROR";
101 break;
102 case RECEIVE_ERROR:
103 s = "RECEIVE_ERROR";
104 break;
105 case INVALID_PRIORITY:
106 s = "INVALID_PRIORITY";
107 break;
108 case FULL:
109 s = "FULL";
110 break;
111 case UNKNOWN_ERROR:
112 s = "UNKNOWN_ERROR";
113 break;
114 default:
115 s = "[invalid]";
116 break;
117 }
118 sb.format("%s (%" PRIi32 ")", s.toChar(), e);
119 }
120
121#elif FW_ENABLE_TEXT_LOGGING
122
123 void QueueStatus ::
124 toString(Fw::StringBase& sb) const
125 {
126 sb.format("%" PRIi32 "", e);
127 }
128
129#endif
130
131}
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
const char * toChar() const
Definition String.hpp:50
FPP shadow-enum representing Os::Queue::Status.
I32 SerialType
The serial representation type.
T
The raw enum type.
T e
The raw enum value.
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.