F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
PhasesEnumAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title PhasesEnumAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for Phases enum
5 // ======================================================================
6 
7 #include <cstring>
8 #include <limits>
9 
10 #include "Fw/Types/Assert.hpp"
11 #include "Fpp/PhasesEnumAc.hpp"
12 
13 namespace Fpp {
14 
15  namespace ToCpp {
16 
17  // ----------------------------------------------------------------------
18  // Operators
19  // ----------------------------------------------------------------------
20 
22  operator=(const Phases& obj)
23  {
24  this->e = obj.e;
25  return *this;
26  }
27 
30  {
31  this->e = e1;
32  return *this;
33  }
34 
35 #ifdef BUILD_UT
36 
37  std::ostream& operator<<(std::ostream& os, const Phases& obj) {
38  Fw::String s;
39  obj.toString(s);
40  os << s;
41  return os;
42  }
43 
44 #endif
45 
46  // ----------------------------------------------------------------------
47  // Member functions
48  // ----------------------------------------------------------------------
49 
50  bool Phases ::
51  isValid() const
52  {
53  return ((e >= configConstants) && (e <= tearDownComponents));
54  }
55 
58  {
59  const Fw::SerializeStatus status = buffer.serialize(
60  static_cast<SerialType>(this->e)
61  );
62  return status;
63  }
64 
67  {
68  SerialType es;
69  Fw::SerializeStatus status = buffer.deserialize(es);
70  if (status == Fw::FW_SERIALIZE_OK) {
71  this->e = static_cast<T>(es);
72  if (!this->isValid()) {
74  }
75  }
76  return status;
77  }
78 
79 #if FW_SERIALIZABLE_TO_STRING
80 
81  void Phases ::
82  toString(Fw::StringBase& sb) const
83  {
84  Fw::String s;
85  switch (e) {
86  case configConstants:
87  s = "configConstants";
88  break;
89  case configObjects:
90  s = "configObjects";
91  break;
92  case instances:
93  s = "instances";
94  break;
95  case initComponents:
96  s = "initComponents";
97  break;
98  case configComponents:
99  s = "configComponents";
100  break;
101  case regCommands:
102  s = "regCommands";
103  break;
104  case readParameters:
105  s = "readParameters";
106  break;
107  case loadParameters:
108  s = "loadParameters";
109  break;
110  case startTasks:
111  s = "startTasks";
112  break;
113  case stopTasks:
114  s = "stopTasks";
115  break;
116  case freeThreads:
117  s = "freeThreads";
118  break;
119  case tearDownComponents:
120  s = "tearDownComponents";
121  break;
122  default:
123  s = "[invalid]";
124  break;
125  }
126  sb.format("%s (%" PRIi32 ")", s.toChar(), e);
127  }
128 
129 #elif FW_ENABLE_TEXT_LOGGING
130 
131  void Phases ::
132  toString(Fw::StringBase& sb) const
133  {
134  sb.format("%" PRIi32 "", e);
135  }
136 
137 #endif
138 
139  }
140 
141 }
Serialization/Deserialization operation was successful.
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
const char * toChar() const
Definition: String.hpp:50
I32 SerialType
The serial representation type.
Deserialization data had incorrect values (unexpected data types)
SerializeStatus
forward declaration for string
bool isValid() const
Check raw enum value for validity.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialize raw enum value from SerialType.
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialize raw enum value to SerialType.
Phases & operator=(const Phases &obj)
Copy assignment operator (object)
T e
The raw enum value.
T
The raw enum type.