F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FooterSerializableAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FooterSerializableAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for Footer struct
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 
10 namespace Svc {
11 
12  namespace Fpy {
13 
14  // ----------------------------------------------------------------------
15  // Constructors
16  // ----------------------------------------------------------------------
17 
18  Footer ::
20  Serializable(),
21  m_crc(0)
22  {
23 
24  }
25 
26  Footer ::
27  Footer(U32 crc) :
28  Serializable(),
29  m_crc(crc)
30  {
31 
32  }
33 
34  Footer ::
35  Footer(const Footer& obj) :
36  Serializable(),
37  m_crc(obj.m_crc)
38  {
39 
40  }
41 
42  // ----------------------------------------------------------------------
43  // Operators
44  // ----------------------------------------------------------------------
45 
47  operator=(const Footer& obj)
48  {
49  if (this == &obj) {
50  return *this;
51  }
52 
53  set(obj.m_crc);
54  return *this;
55  }
56 
57  bool Footer ::
58  operator==(const Footer& obj) const
59  {
60  return (this->m_crc == obj.m_crc);
61  }
62 
63  bool Footer ::
64  operator!=(const Footer& obj) const
65  {
66  return !(*this == obj);
67  }
68 
69 #ifdef BUILD_UT
70 
71  std::ostream& operator<<(std::ostream& os, const Footer& obj) {
72  Fw::String s;
73  obj.toString(s);
74  os << s.toChar();
75  return os;
76  }
77 
78 #endif
79 
80  // ----------------------------------------------------------------------
81  // Member functions
82  // ----------------------------------------------------------------------
83 
86  Fw::SerialBufferBase& buffer,
87  Fw::Endianness mode
88  ) const
89  {
90  Fw::SerializeStatus status;
91 
92  status = buffer.serializeFrom(this->m_crc, mode);
93  if (status != Fw::FW_SERIALIZE_OK) {
94  return status;
95  }
96 
97  return status;
98  }
99 
102  Fw::SerialBufferBase& buffer,
103  Fw::Endianness mode
104  )
105  {
106  Fw::SerializeStatus status;
107 
108  status = buffer.deserializeTo(this->m_crc, mode);
109  if (status != Fw::FW_SERIALIZE_OK) {
110  return status;
111  }
112 
113  return status;
114  }
115 
118  {
119  FwSizeType size = 0;
120  size += sizeof(U32);
121  return size;
122  }
123 
124 #if FW_SERIALIZABLE_TO_STRING
125 
126  void Footer ::
127  toString(Fw::StringBase& sb) const
128  {
129  Fw::String tmp;
130  sb = "( ";
131 
132  // Format crc
133  sb += "crc = ";
134  tmp.format("%" PRIu32 "", this->m_crc);
135  sb += tmp;
136  sb += " )";
137  }
138 
139 #endif
140 
141  // ----------------------------------------------------------------------
142  // Setter functions
143  // ----------------------------------------------------------------------
144 
145  void Footer ::
146  set(U32 crc)
147  {
148  this->m_crc = crc;
149  }
150 
151  void Footer ::
152  set_crc(U32 crc)
153  {
154  this->m_crc = crc;
155  }
156 
157  }
158 
159 }
Serialization/Deserialization operation was successful.
PlatformSizeType FwSizeType
const char * toChar() const
Convert to a C-style char*.
Definition: String.hpp:50
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.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
RateGroupDivider component implementation.
Endianness