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.serialize(this->m_flagsAndScId);
105  if (status != Fw::FW_SERIALIZE_OK) {
106  return status;
107  }
108  status = buffer.serialize(this->m_vcIdAndLength);
109  if (status != Fw::FW_SERIALIZE_OK) {
110  return status;
111  }
112  status = buffer.serialize(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.deserialize(this->m_flagsAndScId);
126  if (status != Fw::FW_SERIALIZE_OK) {
127  return status;
128  }
129  status = buffer.deserialize(this->m_vcIdAndLength);
130  if (status != Fw::FW_SERIALIZE_OK) {
131  return status;
132  }
133  status = buffer.deserialize(this->m_frameSequenceNum);
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 TCHeader ::
144  toString(Fw::StringBase& sb) const
145  {
146  static const char* formatString =
147  "( "
148  "flagsAndScId = %" PRIu16 ", "
149  "vcIdAndLength = %" PRIu16 ", "
150  "frameSequenceNum = %" PRIu8 ""
151  " )";
152 
153  sb.format(
154  formatString,
155  this->m_flagsAndScId,
156  this->m_vcIdAndLength,
157  this->m_frameSequenceNum
158  );
159  }
160 
161 #endif
162 
163  // ----------------------------------------------------------------------
164  // Setter functions
165  // ----------------------------------------------------------------------
166 
167  void TCHeader ::
169  U16 flagsAndScId,
170  U16 vcIdAndLength,
171  U8 frameSequenceNum
172  )
173  {
174  this->m_flagsAndScId = flagsAndScId;
175  this->m_vcIdAndLength = vcIdAndLength;
176  this->m_frameSequenceNum = frameSequenceNum;
177  }
178 
179  void TCHeader ::
180  setflagsAndScId(U16 flagsAndScId)
181  {
182  this->m_flagsAndScId = flagsAndScId;
183  }
184 
185  void TCHeader ::
186  setvcIdAndLength(U16 vcIdAndLength)
187  {
188  this->m_vcIdAndLength = vcIdAndLength;
189  }
190 
191  void TCHeader ::
192  setframeSequenceNum(U8 frameSequenceNum)
193  {
194  this->m_frameSequenceNum = frameSequenceNum;
195  }
196 
197  }
198 
199 }
Serialization/Deserialization operation was successful.
Describes the frame header format for a Telecommand (TC) Transfer Frame header.
void setframeSequenceNum(U8 frameSequenceNum)
Set member frameSequenceNum.
void set(U16 flagsAndScId, U16 vcIdAndLength, U8 frameSequenceNum)
Set all members.
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
const char * toChar() const
Definition: String.hpp:50
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialization.
SerializeStatus
forward declaration for string
TCHeader()
Constructor (default value)
void setvcIdAndLength(U16 vcIdAndLength)
Set member vcIdAndLength.
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialization.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:56
bool operator==(const TCHeader &obj) const
Equality operator.
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
RateGroupDivider component implementation.
bool operator!=(const TCHeader &obj) const
Inequality operator.
TCHeader & operator=(const TCHeader &obj)
Copy assignment operator.
void setflagsAndScId(U16 flagsAndScId)
Set member flagsAndScId.