F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
EventManager_EnabledEnumAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title EventManager_EnabledEnumAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for EventManager_Enabled enum
5 // ======================================================================
6 
7 #include <cstring>
8 #include <limits>
9 
10 #include "Fw/Types/Assert.hpp"
12 
13 namespace Svc {
14 
15  // ----------------------------------------------------------------------
16  // Operators
17  // ----------------------------------------------------------------------
18 
19  EventManager_Enabled& EventManager_Enabled ::
21  {
22  this->e = obj.e;
23  return *this;
24  }
25 
27  operator=(enum 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 EventManager_Enabled& 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 
49  isValid() const
50  {
51  return EventManager_Enabled::isValid(this->e);
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) && !EventManager_Enabled::isValid(es)) {
77  }
78  if (status == Fw::FW_SERIALIZE_OK) {
79  this->e = static_cast<enum T>(es);
80  }
81  return status;
82  }
83 
84 #if FW_SERIALIZABLE_TO_STRING
85 
86  void EventManager_Enabled ::
87  toString(Fw::StringBase& sb) const
88  {
89  Fw::String s;
90  switch (e) {
91  case ENABLED:
92  s = "ENABLED";
93  break;
94  case DISABLED:
95  s = "DISABLED";
96  break;
97  default:
98  s = "[invalid]";
99  break;
100  }
101  sb.format("%s (%" PRIu8 ")", s.toChar(), e);
102  }
103 
104 #elif FW_ENABLE_TEXT_LOGGING
105 
106  void EventManager_Enabled ::
107  toString(Fw::StringBase& sb) const
108  {
109  sb.format("%" PRIu8 "", e);
110  }
111 
112 #endif
113 
114  // ----------------------------------------------------------------------
115  // Static functions
116  // ----------------------------------------------------------------------
117 
119  isValid(SerialType serialTypeValue)
120  {
121  return (serialTypeValue <= DISABLED);
122  }
123 
124 }
Serialization/Deserialization operation was successful.
Enabled and disabled state.
bool isValid() const
Check raw enum value for validity.
Deserialization data had incorrect values (unexpected data types)
virtual SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)=0
Serialize an 8-bit unsigned integer value.
SerializeStatus
forward declaration for string
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
const char * toChar() const
Convert to a C-style char*.
EventManager_Enabled & operator=(const EventManager_Enabled &obj)
Copy assignment operator (object)
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialize raw enum value from SerialType.
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialize raw enum value to SerialType.
U8 SerialType
The serial representation type.
RateGroupDivider component implementation.
Endianness