F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SpacePacketHeaderSerializableAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SpacePacketHeaderSerializableAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for SpacePacketHeader struct
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 
10 namespace Svc {
11 
12  namespace CCSDS {
13 
14  // ----------------------------------------------------------------------
15  // Constructors
16  // ----------------------------------------------------------------------
17 
20  Serializable(),
21  m_packetIdentification(0),
22  m_packetSequenceControl(0),
23  m_packetDataLength(0)
24  {
25 
26  }
27 
30  U16 packetIdentification,
31  U16 packetSequenceControl,
32  U16 packetDataLength
33  ) :
34  Serializable(),
35  m_packetIdentification(packetIdentification),
36  m_packetSequenceControl(packetSequenceControl),
37  m_packetDataLength(packetDataLength)
38  {
39 
40  }
41 
44  Serializable(),
45  m_packetIdentification(obj.m_packetIdentification),
46  m_packetSequenceControl(obj.m_packetSequenceControl),
47  m_packetDataLength(obj.m_packetDataLength)
48  {
49 
50  }
51 
52  // ----------------------------------------------------------------------
53  // Operators
54  // ----------------------------------------------------------------------
55 
58  {
59  if (this == &obj) {
60  return *this;
61  }
62 
64  return *this;
65  }
66 
68  operator==(const SpacePacketHeader& obj) const
69  {
70  if (this == &obj) { return true; }
71  return (
73  (this->m_packetSequenceControl == obj.m_packetSequenceControl) &&
74  (this->m_packetDataLength == obj.m_packetDataLength)
75  );
76  }
77 
79  operator!=(const SpacePacketHeader& obj) const
80  {
81  return !(*this == obj);
82  }
83 
84 #ifdef BUILD_UT
85 
86  std::ostream& operator<<(std::ostream& os, const SpacePacketHeader& obj) {
87  Fw::String s;
88  obj.toString(s);
89  os << s.toChar();
90  return os;
91  }
92 
93 #endif
94 
95  // ----------------------------------------------------------------------
96  // Member functions
97  // ----------------------------------------------------------------------
98 
101  {
102  Fw::SerializeStatus status;
103 
104  status = buffer.serialize(this->m_packetIdentification);
105  if (status != Fw::FW_SERIALIZE_OK) {
106  return status;
107  }
108  status = buffer.serialize(this->m_packetSequenceControl);
109  if (status != Fw::FW_SERIALIZE_OK) {
110  return status;
111  }
112  status = buffer.serialize(this->m_packetDataLength);
113  if (status != Fw::FW_SERIALIZE_OK) {
114  return status;
115  }
116 
117  return status;
118  }
119 
122  {
123  Fw::SerializeStatus status;
124 
125  status = buffer.deserialize(this->m_packetIdentification);
126  if (status != Fw::FW_SERIALIZE_OK) {
127  return status;
128  }
129  status = buffer.deserialize(this->m_packetSequenceControl);
130  if (status != Fw::FW_SERIALIZE_OK) {
131  return status;
132  }
133  status = buffer.deserialize(this->m_packetDataLength);
134  if (status != Fw::FW_SERIALIZE_OK) {
135  return status;
136  }
137 
138  return status;
139  }
140 
141 #if FW_SERIALIZABLE_TO_STRING
142 
143  void SpacePacketHeader ::
144  toString(Fw::StringBase& sb) const
145  {
146  static const char* formatString =
147  "( "
148  "packetIdentification = %" PRIu16 ", "
149  "packetSequenceControl = %" PRIu16 ", "
150  "packetDataLength = %" PRIu16 ""
151  " )";
152 
153  sb.format(
154  formatString,
157  this->m_packetDataLength
158  );
159  }
160 
161 #endif
162 
163  // ----------------------------------------------------------------------
164  // Setter functions
165  // ----------------------------------------------------------------------
166 
169  U16 packetIdentification,
170  U16 packetSequenceControl,
171  U16 packetDataLength
172  )
173  {
174  this->m_packetIdentification = packetIdentification;
175  this->m_packetSequenceControl = packetSequenceControl;
176  this->m_packetDataLength = packetDataLength;
177  }
178 
180  setpacketIdentification(U16 packetIdentification)
181  {
182  this->m_packetIdentification = packetIdentification;
183  }
184 
186  setpacketSequenceControl(U16 packetSequenceControl)
187  {
188  this->m_packetSequenceControl = packetSequenceControl;
189  }
190 
192  setpacketDataLength(U16 packetDataLength)
193  {
194  this->m_packetDataLength = packetDataLength;
195  }
196 
197  }
198 
199 }
Serialization/Deserialization operation was successful.
SpacePacketHeader & operator=(const SpacePacketHeader &obj)
Copy assignment operator.
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
const char * toChar() const
Definition: String.hpp:50
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialization.
void setpacketIdentification(U16 packetIdentification)
Set member packetIdentification.
SerializeStatus
forward declaration for string
void setpacketSequenceControl(U16 packetSequenceControl)
Set member packetSequenceControl.
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialization.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
bool operator!=(const SpacePacketHeader &obj) const
Inequality operator.
void set(U16 packetIdentification, U16 packetSequenceControl, U16 packetDataLength)
Set all members.
SpacePacketHeader()
Constructor (default value)
Describes the frame header format for the SpacePacket communications protocol.
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
void setpacketDataLength(U16 packetDataLength)
Set member packetDataLength.
RateGroupDivider component implementation.
bool operator==(const SpacePacketHeader &obj) const
Equality operator.