F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FrameContextSerializableAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FrameContextSerializableAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FrameContext struct
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 
10 namespace ComCfg {
11 
12  // ----------------------------------------------------------------------
13  // Constructors
14  // ----------------------------------------------------------------------
15 
18  Serializable(),
19  m_comQueueIndex(),
20  m_apid(ComCfg::Apid::FW_PACKET_UNKNOWN),
21  m_sequenceCount(),
22  m_vcId(1),
23  m_sendNow()
24  {
25 
26  }
27 
30  FwIndexType comQueueIndex,
31  ComCfg::Apid::T apid,
32  U16 sequenceCount,
33  U8 vcId,
34  bool sendNow
35  ) :
36  Serializable(),
37  m_comQueueIndex(comQueueIndex),
38  m_apid(apid),
39  m_sequenceCount(sequenceCount),
40  m_vcId(vcId),
41  m_sendNow(sendNow)
42  {
43 
44  }
45 
48  Serializable(),
49  m_comQueueIndex(obj.m_comQueueIndex),
50  m_apid(obj.m_apid),
51  m_sequenceCount(obj.m_sequenceCount),
52  m_vcId(obj.m_vcId),
53  m_sendNow(obj.m_sendNow)
54  {
55 
56  }
57 
58  // ----------------------------------------------------------------------
59  // Operators
60  // ----------------------------------------------------------------------
61 
64  {
65  if (this == &obj) {
66  return *this;
67  }
68 
69  set(obj.m_comQueueIndex, obj.m_apid, obj.m_sequenceCount, obj.m_vcId, obj.m_sendNow);
70  return *this;
71  }
72 
73  bool FrameContext ::
74  operator==(const FrameContext& obj) const
75  {
76  if (this == &obj) { return true; }
77  return (
78  (this->m_comQueueIndex == obj.m_comQueueIndex) &&
79  (this->m_apid == obj.m_apid) &&
80  (this->m_sequenceCount == obj.m_sequenceCount) &&
81  (this->m_vcId == obj.m_vcId) &&
82  (this->m_sendNow == obj.m_sendNow)
83  );
84  }
85 
86  bool FrameContext ::
87  operator!=(const FrameContext& obj) const
88  {
89  return !(*this == obj);
90  }
91 
92 #ifdef BUILD_UT
93 
94  std::ostream& operator<<(std::ostream& os, const FrameContext& obj) {
95  Fw::String s;
96  obj.toString(s);
97  os << s.toChar();
98  return os;
99  }
100 
101 #endif
102 
103  // ----------------------------------------------------------------------
104  // Member functions
105  // ----------------------------------------------------------------------
106 
109  Fw::SerialBufferBase& buffer,
110  Fw::Endianness mode
111  ) const
112  {
113  Fw::SerializeStatus status;
114 
115  status = buffer.serializeFrom(this->m_comQueueIndex, mode);
116  if (status != Fw::FW_SERIALIZE_OK) {
117  return status;
118  }
119  status = buffer.serializeFrom(this->m_apid, mode);
120  if (status != Fw::FW_SERIALIZE_OK) {
121  return status;
122  }
123  status = buffer.serializeFrom(this->m_sequenceCount, mode);
124  if (status != Fw::FW_SERIALIZE_OK) {
125  return status;
126  }
127  status = buffer.serializeFrom(this->m_vcId, mode);
128  if (status != Fw::FW_SERIALIZE_OK) {
129  return status;
130  }
131  status = buffer.serializeFrom(this->m_sendNow, mode);
132  if (status != Fw::FW_SERIALIZE_OK) {
133  return status;
134  }
135 
136  return status;
137  }
138 
141  Fw::SerialBufferBase& buffer,
142  Fw::Endianness mode
143  )
144  {
145  Fw::SerializeStatus status;
146 
147  status = buffer.deserializeTo(this->m_comQueueIndex, mode);
148  if (status != Fw::FW_SERIALIZE_OK) {
149  return status;
150  }
151  status = buffer.deserializeTo(this->m_apid, mode);
152  if (status != Fw::FW_SERIALIZE_OK) {
153  return status;
154  }
155  status = buffer.deserializeTo(this->m_sequenceCount, mode);
156  if (status != Fw::FW_SERIALIZE_OK) {
157  return status;
158  }
159  status = buffer.deserializeTo(this->m_vcId, mode);
160  if (status != Fw::FW_SERIALIZE_OK) {
161  return status;
162  }
163  status = buffer.deserializeTo(this->m_sendNow, mode);
164  if (status != Fw::FW_SERIALIZE_OK) {
165  return status;
166  }
167 
168  return status;
169  }
170 
173  {
174  FwSizeType size = 0;
175  size += sizeof(FwIndexType);
177  size += sizeof(U16);
178  size += sizeof(U8);
179  size += sizeof(U8);
180  return size;
181  }
182 
183 #if FW_SERIALIZABLE_TO_STRING
184 
185  void FrameContext ::
186  toString(Fw::StringBase& sb) const
187  {
188  Fw::String tmp;
189  sb = "( ";
190 
191  // Format comQueueIndex
192  sb += "comQueueIndex = ";
193  tmp.format("%" PRIi16 "", this->m_comQueueIndex);
194  sb += tmp;
195  sb += ", ";
196 
197  // Format apid
198  sb += "apid = ";
199  this->m_apid.toString(tmp);
200  sb += tmp;
201  sb += ", ";
202 
203  // Format sequenceCount
204  sb += "sequenceCount = ";
205  tmp.format("%" PRIu16 "", this->m_sequenceCount);
206  sb += tmp;
207  sb += ", ";
208 
209  // Format vcId
210  sb += "vcId = ";
211  tmp.format("%" PRIu8 "", this->m_vcId);
212  sb += tmp;
213  sb += ", ";
214 
215  // Format sendNow
216  sb += "sendNow = ";
217  tmp.format("%d", this->m_sendNow);
218  sb += tmp;
219  sb += " )";
220  }
221 
222 #endif
223 
224  // ----------------------------------------------------------------------
225  // Setter functions
226  // ----------------------------------------------------------------------
227 
228  void FrameContext ::
230  FwIndexType comQueueIndex,
231  ComCfg::Apid::T apid,
232  U16 sequenceCount,
233  U8 vcId,
234  bool sendNow
235  )
236  {
237  this->m_comQueueIndex = comQueueIndex;
238  this->m_apid = apid;
239  this->m_sequenceCount = sequenceCount;
240  this->m_vcId = vcId;
241  this->m_sendNow = sendNow;
242  }
243 
244  void FrameContext ::
246  {
247  this->m_comQueueIndex = comQueueIndex;
248  }
249 
250  void FrameContext ::
252  {
253  this->m_apid = apid;
254  }
255 
256  void FrameContext ::
257  set_sequenceCount(U16 sequenceCount)
258  {
259  this->m_sequenceCount = sequenceCount;
260  }
261 
262  void FrameContext ::
264  {
265  this->m_vcId = vcId;
266  }
267 
268  void FrameContext ::
269  set_sendNow(bool sendNow)
270  {
271  this->m_sendNow = sendNow;
272  }
273 
274 }
void set(FwIndexType comQueueIndex, ComCfg::Apid::T apid, U16 sequenceCount, U8 vcId, bool sendNow)
Set all members.
Serialization/Deserialization operation was successful.
FrameContext()
Constructor (default value)
PlatformSizeType FwSizeType
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialization.
const char * toChar() const
Convert to a C-style char*.
Definition: String.hpp:50
void set_apid(ComCfg::Apid::T apid)
Set member apid.
FwSizeType serializedSize() const
Get the dynamic serialized size of the struct.
void set_sendNow(bool sendNow)
Set member sendNow.
bool operator!=(const FrameContext &obj) const
Inequality operator.
virtual SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)=0
Serialize an 8-bit unsigned integer value.
SerializeStatus
forward declaration for string
The size of the serial representation.
Definition: ApidEnumAc.hpp:67
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
T
The raw enum type.
Definition: ApidEnumAc.hpp:31
void set_sequenceCount(U16 sequenceCount)
Set member sequenceCount.
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialization.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void set_vcId(U8 vcId)
Set member vcId.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
bool operator==(const FrameContext &obj) const
Equality operator.
void set_comQueueIndex(FwIndexType comQueueIndex)
Set member comQueueIndex.
PlatformIndexType FwIndexType
Type used to pass context info between components during framing/deframing.
Endianness
APIDs are 11 bits in the Space Packet protocol, so we use U16. Max value 7FF.
Definition: ApidEnumAc.hpp:17
FrameContext & operator=(const FrameContext &obj)
Copy assignment operator.