F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
PolyDbEntryEnumAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title PolyDbEntryEnumAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for PolyDbEntry enum
5 // ======================================================================
6 
7 #include <cstring>
8 #include <limits>
9 
10 #include "Fw/Types/Assert.hpp"
12 
13 namespace Svc {
14 
15  namespace PolyDbCfg {
16 
17  // ----------------------------------------------------------------------
18  // Operators
19  // ----------------------------------------------------------------------
20 
22  operator=(const PolyDbEntry& obj)
23  {
24  this->e = obj.e;
25  return *this;
26  }
27 
29  operator=(T e1)
30  {
31  this->e = e1;
32  return *this;
33  }
34 
35 #ifdef BUILD_UT
36 
37  std::ostream& operator<<(std::ostream& os, const PolyDbEntry& 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 
51  isValid() const
52  {
53  return ((e >= POLYDB_ENTRY_00) && (e <= POLYDB_ENTRY_09));
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 PolyDbEntry ::
82  toString(Fw::StringBase& sb) const
83  {
84  Fw::String s;
85  switch (e) {
86  case POLYDB_ENTRY_00:
87  s = "POLYDB_ENTRY_00";
88  break;
89  case POLYDB_ENTRY_01:
90  s = "POLYDB_ENTRY_01";
91  break;
92  case POLYDB_ENTRY_03:
93  s = "POLYDB_ENTRY_03";
94  break;
95  case POLYDB_ENTRY_04:
96  s = "POLYDB_ENTRY_04";
97  break;
98  case POLYDB_ENTRY_05:
99  s = "POLYDB_ENTRY_05";
100  break;
101  case POLYDB_ENTRY_06:
102  s = "POLYDB_ENTRY_06";
103  break;
104  case POLYDB_ENTRY_07:
105  s = "POLYDB_ENTRY_07";
106  break;
107  case POLYDB_ENTRY_08:
108  s = "POLYDB_ENTRY_08";
109  break;
110  case POLYDB_ENTRY_09:
111  s = "POLYDB_ENTRY_09";
112  break;
113  default:
114  s = "[invalid]";
115  break;
116  }
117  sb.format("%s (%" PRIu32 ")", s.toChar(), e);
118  }
119 
120 #elif FW_ENABLE_TEXT_LOGGING
121 
122  void PolyDbEntry ::
123  toString(Fw::StringBase& sb) const
124  {
125  sb.format("%" PRIu32 "", e);
126  }
127 
128 #endif
129 
130  }
131 
132 }
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
Definition: StringBase.cpp:56
const char * toChar() const
Definition: String.hpp:50
bool isValid() const
Check raw enum value for validity.
U32 SerialType
The serial representation type.
PolyDbEntry & operator=(const PolyDbEntry &obj)
Copy assignment operator (object)
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialize raw enum value from SerialType.
T e
The raw enum value.
T
The raw enum type.
@ POLYDB_ENTRY_01
Entry 1.
@ POLYDB_ENTRY_09
Entry 9.
@ POLYDB_ENTRY_06
Entry 6.
@ POLYDB_ENTRY_05
Entry 5.
@ POLYDB_ENTRY_00
Entry 0.
@ POLYDB_ENTRY_04
Entry 4.
@ POLYDB_ENTRY_03
Entry 2.
@ POLYDB_ENTRY_07
Entry 7.
@ POLYDB_ENTRY_08
Entry 8.
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialize raw enum value to SerialType.
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.