F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SendFileResponseSerializableAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SendFileResponseSerializableAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for SendFileResponse struct
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 
10 namespace Svc {
11 
12  // ----------------------------------------------------------------------
13  // Constructors
14  // ----------------------------------------------------------------------
15 
18  Serializable(),
19  m_status(Svc::SendFileStatus::STATUS_OK),
20  m_context(0)
21  {
22 
23  }
24 
28  U32 context
29  ) :
30  Serializable(),
31  m_status(status),
32  m_context(context)
33  {
34 
35  }
36 
39  Serializable(),
40  m_status(obj.m_status),
41  m_context(obj.m_context)
42  {
43 
44  }
45 
46  // ----------------------------------------------------------------------
47  // Operators
48  // ----------------------------------------------------------------------
49 
52  {
53  if (this == &obj) {
54  return *this;
55  }
56 
57  set(obj.m_status, obj.m_context);
58  return *this;
59  }
60 
62  operator==(const SendFileResponse& obj) const
63  {
64  if (this == &obj) { return true; }
65  return (
66  (this->m_status == obj.m_status) &&
67  (this->m_context == obj.m_context)
68  );
69  }
70 
72  operator!=(const SendFileResponse& obj) const
73  {
74  return !(*this == obj);
75  }
76 
77 #ifdef BUILD_UT
78 
79  std::ostream& operator<<(std::ostream& os, const SendFileResponse& obj) {
80  Fw::String s;
81  obj.toString(s);
82  os << s.toChar();
83  return os;
84  }
85 
86 #endif
87 
88  // ----------------------------------------------------------------------
89  // Member functions
90  // ----------------------------------------------------------------------
91 
95  Fw::Endianness mode
96  ) const
97  {
98  Fw::SerializeStatus status;
99 
100  status = buffer.serializeFrom(this->m_status, mode);
101  if (status != Fw::FW_SERIALIZE_OK) {
102  return status;
103  }
104  status = buffer.serializeFrom(this->m_context, mode);
105  if (status != Fw::FW_SERIALIZE_OK) {
106  return status;
107  }
108 
109  return status;
110  }
111 
114  Fw::SerializeBufferBase& buffer,
115  Fw::Endianness mode
116  )
117  {
118  Fw::SerializeStatus status;
119 
120  status = buffer.deserializeTo(this->m_status, mode);
121  if (status != Fw::FW_SERIALIZE_OK) {
122  return status;
123  }
124  status = buffer.deserializeTo(this->m_context, mode);
125  if (status != Fw::FW_SERIALIZE_OK) {
126  return status;
127  }
128 
129  return status;
130  }
131 
134  {
135  FwSizeType size = 0;
137  size += sizeof(U32);
138  return size;
139  }
140 
141 #if FW_SERIALIZABLE_TO_STRING
142 
143  void SendFileResponse ::
144  toString(Fw::StringBase& sb) const
145  {
146  Fw::String tmp;
147  sb = "( ";
148 
149  // Format status
150  sb += "status = ";
151  this->m_status.toString(tmp);
152  sb += tmp;
153  sb += ", ";
154 
155  // Format context
156  sb += "context = ";
157  tmp.format("%" PRIu32 "", this->m_context);
158  sb += tmp;
159  sb += " )";
160  }
161 
162 #endif
163 
164  // ----------------------------------------------------------------------
165  // Setter functions
166  // ----------------------------------------------------------------------
167 
170  Svc::SendFileStatus::T status,
171  U32 context
172  )
173  {
174  this->m_status = status;
175  this->m_context = context;
176  }
177 
180  {
181  this->m_status = status;
182  }
183 
185  set_context(U32 context)
186  {
187  this->m_context = context;
188  }
189 
190 }
Serialization/Deserialization operation was successful.
FwSizeType serializedSize() const
Get the dynamic serialized size of the struct.
SendFileResponse & operator=(const SendFileResponse &obj)
Copy assignment operator.
void set_status(Svc::SendFileStatus::T status)
Set member status.
PlatformSizeType FwSizeType
const char * toChar() const
Definition: String.hpp:50
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)
deserialize 8-bit unsigned int
Fw::SerializeStatus serializeTo(Fw::SerializeBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialization.
SendFileResponse()
Constructor (default value)
SerializeStatus
forward declaration for string
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialization.
bool operator!=(const SendFileResponse &obj) const
Inequality operator.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)
serialize 8-bit unsigned int
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
Send file response struct.
void set_context(U32 context)
Set member context.
RateGroupDivider component implementation.
Send file status enum.
Endianness
The size of the serial representation.
bool operator==(const SendFileResponse &obj) const
Equality operator.
void set(Svc::SendFileStatus::T status, U32 context)
Set all members.