F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TaskStatusEnumAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TaskStatusEnumAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for TaskStatus enum
5 // ======================================================================
6 
7 #include <cstring>
8 #include <limits>
9 
11 
12 namespace Os {
13 
14  // ----------------------------------------------------------------------
15  // Operators
16  // ----------------------------------------------------------------------
17 
18  TaskStatus& TaskStatus ::
20  {
21  this->e = obj.e;
22 #ifdef BUILD_UT
23  this->m_serializeValueIsSet = obj.m_serializeValueIsSet;
24  this->m_serializeValue = obj.m_serializeValue;
25 #endif
26  return *this;
27  }
28 
30  operator=(enum T e1)
31  {
32  FW_ASSERT(isValid(e1), static_cast<FwAssertArgType>(e1));
33  this->e = e1;
34 #ifdef BUILD_UT
35  this->m_serializeValueIsSet = false;
36  this->m_serializeValue = 0;
37 #endif
38  return *this;
39  }
40 
41 #ifdef BUILD_UT
42 
43  std::ostream& operator<<(std::ostream& os, const TaskStatus& obj) {
44  Fw::String s;
45  obj.toString(s);
46  os << s;
47  return os;
48  }
49 
50 #endif
51 
52  // ----------------------------------------------------------------------
53  // Member functions
54  // ----------------------------------------------------------------------
55 
56  bool TaskStatus ::
57  isValid() const
58  {
59  return TaskStatus::isValid(this->e);
60  }
61 
64  Fw::SerialBufferBase& buffer,
65  Fw::Endianness mode
66  ) const
67  {
68  SerialType es = static_cast<SerialType>(this->e);
69 #ifdef BUILD_UT
70  // Unit testing only: On request, override the enum value
71  // with the numeric value, which is allowed to be invalid
72  if (this->m_serializeValueIsSet) {
73  es = this->m_serializeValue;
74  }
75 #endif
76  const Fw::SerializeStatus status = buffer.serializeFrom(es, mode);
77  return status;
78  }
79 
82  Fw::SerialBufferBase& buffer,
83  Fw::Endianness mode
84  )
85  {
86  SerialType es;
87  Fw::SerializeStatus status = buffer.deserializeTo(es, mode);
88  if ((status == Fw::FW_SERIALIZE_OK) && !TaskStatus::isValid(es)) {
90  }
91  if (status == Fw::FW_SERIALIZE_OK) {
92  this->e = static_cast<enum T>(es);
93  }
94  return status;
95  }
96 
97 #if FW_SERIALIZABLE_TO_STRING
98 
99  void TaskStatus ::
100  toString(Fw::StringBase& sb) const
101  {
102  Fw::String s;
103  switch (e) {
104  case OP_OK:
105  s = "OP_OK";
106  break;
107  case INVALID_HANDLE:
108  s = "INVALID_HANDLE";
109  break;
110  case INVALID_PARAMS:
111  s = "INVALID_PARAMS";
112  break;
113  case INVALID_PRIORITY:
114  s = "INVALID_PRIORITY";
115  break;
116  case INVALID_STACK:
117  s = "INVALID_STACK";
118  break;
119  case UNKNOWN_ERROR:
120  s = "UNKNOWN_ERROR";
121  break;
122  case INVALID_AFFINITY:
123  s = "INVALID_AFFINITY";
124  break;
125  case DELAY_ERROR:
126  s = "DELAY_ERROR";
127  break;
128  case JOIN_ERROR:
129  s = "JOIN_ERROR";
130  break;
131  case ERROR_RESOURCES:
132  s = "ERROR_RESOURCES";
133  break;
134  case ERROR_PERMISSION:
135  s = "ERROR_PERMISSION";
136  break;
137  case NOT_SUPPORTED:
138  s = "NOT_SUPPORTED";
139  break;
140  case INVALID_STATE:
141  s = "INVALID_STATE";
142  break;
143  default:
144  s = "[invalid]";
145  break;
146  }
147  sb.format("%s (%" PRIu8 ")", s.toChar(), e);
148  }
149 
150 #endif
151 
152 #ifdef BUILD_UT
153 
154  void TaskStatus ::
155  setSerializeValue(SerialType serializeValue)
156  {
157  this->m_serializeValue = serializeValue;
158  this->m_serializeValueIsSet = true;
159  }
160 
161 #endif
162 
163  // ----------------------------------------------------------------------
164  // Static functions
165  // ----------------------------------------------------------------------
166 
167  bool TaskStatus ::
168  isValid(SerialType serialTypeValue)
169  {
170  return (serialTypeValue <= INVALID_STATE);
171  }
172 
173 }
Serialization/Deserialization operation was successful.
bool isValid() const
Check raw enum value for validity.
Task feature is not supported.
error trying to join the task
enum T e
The raw enum value.
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.
started with invalid stack size
SerializeStatus
forward declaration for string
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
T
The raw enum type.
FPP shadow-enum representing Os::Task::Status.
started task with invalid parameters
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
error trying to delay the task
started task with invalid priority
unable to set the task affinity
permissions error setting-up tasks
const char * toChar() const
Convert to a C-style char*.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
message sent/received okay
Task is in an invalid state for the operation.
TaskStatus & operator=(const TaskStatus &obj)
Copy assignment operator (object)
Endianness
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.
unexpected error return value
#define FW_ASSERT(...)
Definition: Assert.hpp:14
unable to allocate more tasks
ComCfg::Apid::SerialType SerialType
Definition: TestUtils.cpp:14