F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TCHeaderSerializableAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TCHeaderSerializableAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for TCHeader 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_flagsAndScId(0),
22  m_vcIdAndLength(0),
23  m_frameSequenceNum(0)
24  {
25 
26  }
27 
30  U16 flagsAndScId,
31  U16 vcIdAndLength,
32  U8 frameSequenceNum
33  ) :
34  Serializable(),
35  m_flagsAndScId(flagsAndScId),
36  m_vcIdAndLength(vcIdAndLength),
37  m_frameSequenceNum(frameSequenceNum)
38  {
39 
40  }
41 
43  TCHeader(const TCHeader& obj) :
44  Serializable(),
45  m_flagsAndScId(obj.m_flagsAndScId),
46  m_vcIdAndLength(obj.m_vcIdAndLength),
47  m_frameSequenceNum(obj.m_frameSequenceNum)
48  {
49 
50  }
51 
52  // ----------------------------------------------------------------------
53  // Operators
54  // ----------------------------------------------------------------------
55 
57  operator=(const TCHeader& obj)
58  {
59  if (this == &obj) {
60  return *this;
61  }
62 
64  return *this;
65  }
66 
67  bool TCHeader ::
68  operator==(const TCHeader& obj) const
69  {
70  if (this == &obj) { return true; }
71  return (
72  (this->m_flagsAndScId == obj.m_flagsAndScId) &&
73  (this->m_vcIdAndLength == obj.m_vcIdAndLength) &&
74  (this->m_frameSequenceNum == obj.m_frameSequenceNum)
75  );
76  }
77 
78  bool TCHeader ::
79  operator!=(const TCHeader& obj) const
80  {
81  return !(*this == obj);
82  }
83 
84 #ifdef BUILD_UT
85 
86  std::ostream& operator<<(std::ostream& os, const TCHeader& 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.serializeFrom(this->m_flagsAndScId);
105  if (status != Fw::FW_SERIALIZE_OK) {
106  return status;
107  }
108  status = buffer.serializeFrom(this->m_vcIdAndLength);
109  if (status != Fw::FW_SERIALIZE_OK) {
110  return status;
111  }
112  status = buffer.serializeFrom(this->m_frameSequenceNum);
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.deserializeTo(this->m_flagsAndScId);
126  if (status != Fw::FW_SERIALIZE_OK) {
127  return status;
128  }
129  status = buffer.deserializeTo(this->m_vcIdAndLength);
130  if (status != Fw::FW_SERIALIZE_OK) {
131  return status;
132  }
133  status = buffer.deserializeTo(this->m_frameSequenceNum);
134  if (status != Fw::FW_SERIALIZE_OK) {
135  return status;
136  }
137 
138  return status;
139  }
140 
143  {
144  FwSizeType size = 0;
145  size += sizeof(U16);
146  size += sizeof(U16);
147  size += sizeof(U8);
148  return size;
149  }
150 
151 #if FW_SERIALIZABLE_TO_STRING
152 
153  void TCHeader ::
154  toString(Fw::StringBase& sb) const
155  {
156  Fw::String tmp;
157  sb = "( ";
158 
159  // Format flagsAndScId
160  sb += "flagsAndScId = ";
161  tmp.format("%" PRIu16 "", this->m_flagsAndScId);
162  sb += tmp;
163  sb += ", ";
164 
165  // Format vcIdAndLength
166  sb += "vcIdAndLength = ";
167  tmp.format("%" PRIu16 "", this->m_vcIdAndLength);
168  sb += tmp;
169  sb += ", ";
170 
171  // Format frameSequenceNum
172  sb += "frameSequenceNum = ";
173  tmp.format("%" PRIu8 "", this->m_frameSequenceNum);
174  sb += tmp;
175  sb += " )";
176  }
177 
178 #endif
179 
180  // ----------------------------------------------------------------------
181  // Setter functions
182  // ----------------------------------------------------------------------
183 
184  void TCHeader ::
186  U16 flagsAndScId,
187  U16 vcIdAndLength,
188  U8 frameSequenceNum
189  )
190  {
191  this->m_flagsAndScId = flagsAndScId;
192  this->m_vcIdAndLength = vcIdAndLength;
193  this->m_frameSequenceNum = frameSequenceNum;
194  }
195 
196  void TCHeader ::
197  set_flagsAndScId(U16 flagsAndScId)
198  {
199  this->m_flagsAndScId = flagsAndScId;
200  }
201 
202  void TCHeader ::
203  set_vcIdAndLength(U16 vcIdAndLength)
204  {
205  this->m_vcIdAndLength = vcIdAndLength;
206  }
207 
208  void TCHeader ::
209  set_frameSequenceNum(U8 frameSequenceNum)
210  {
211  this->m_frameSequenceNum = frameSequenceNum;
212  }
213 
214  }
215 
216 }
Serialization/Deserialization operation was successful.
Fw::SerializeStatus serializeTo(Fw::SerializeBufferBase &buffer) const
Serialization.
TCHeader()
Constructor (default value)
PlatformSizeType FwSizeType
const char * toChar() const
Definition: String.hpp:50
void set_frameSequenceNum(U8 frameSequenceNum)
Set member frameSequenceNum.
void set_vcIdAndLength(U16 vcIdAndLength)
Set member vcIdAndLength.
SerializeStatus
forward declaration for string
bool operator!=(const TCHeader &obj) const
Inequality operator.
Describes the frame header format for a Telecommand (TC) Transfer Frame header.
TCHeader & operator=(const TCHeader &obj)
Copy assignment operator.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
void set_flagsAndScId(U16 flagsAndScId)
Set member flagsAndScId.
FwSizeType serializedSize() const
Get the dynamic serialized size of the struct.
bool operator==(const TCHeader &obj) const
Equality operator.
RateGroupDivider component implementation.
SerializeStatus serializeFrom(U8 val)
serialize 8-bit unsigned int
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase &buffer)
Deserialization.
void set(U16 flagsAndScId, U16 vcIdAndLength, U8 frameSequenceNum)
Set all members.
SerializeStatus deserializeTo(U8 &val)
deserialize 8-bit unsigned int