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 
8 #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 
94  {
95  Fw::SerializeStatus status;
96 
97  status = buffer.serialize(this->m_status);
98  if (status != Fw::FW_SERIALIZE_OK) {
99  return status;
100  }
101  status = buffer.serialize(this->m_context);
102  if (status != Fw::FW_SERIALIZE_OK) {
103  return status;
104  }
105 
106  return status;
107  }
108 
111  {
112  Fw::SerializeStatus status;
113 
114  status = buffer.deserialize(this->m_status);
115  if (status != Fw::FW_SERIALIZE_OK) {
116  return status;
117  }
118  status = buffer.deserialize(this->m_context);
119  if (status != Fw::FW_SERIALIZE_OK) {
120  return status;
121  }
122 
123  return status;
124  }
125 
126 #if FW_SERIALIZABLE_TO_STRING
127 
128  void SendFileResponse ::
129  toString(Fw::StringBase& sb) const
130  {
131  static const char* formatString =
132  "( "
133  "status = %s, "
134  "context = %" PRIu32 ""
135  " )";
136 
137  // Declare strings to hold any serializable toString() arguments
138  Fw::String statusStr;
139 
140  // Call toString for arrays and serializable types
141  this->m_status.toString(statusStr);
142 
143  sb.format(
144  formatString,
145  statusStr.toChar(),
146  this->m_context
147  );
148  }
149 
150 #endif
151 
152  // ----------------------------------------------------------------------
153  // Setter functions
154  // ----------------------------------------------------------------------
155 
158  Svc::SendFileStatus::T status,
159  U32 context
160  )
161  {
162  this->m_status = status;
163  this->m_context = context;
164  }
165 
168  {
169  this->m_status = status;
170  }
171 
173  setcontext(U32 context)
174  {
175  this->m_context = context;
176  }
177 
178 }
Serialization/Deserialization operation was successful.
SendFileResponse & operator=(const SendFileResponse &obj)
Copy assignment operator.
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
const char * toChar() const
Definition: String.hpp:50
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialization.
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialization.
SendFileResponse()
Constructor (default value)
void setcontext(U32 context)
Set member context.
SerializeStatus
forward declaration for string
bool operator!=(const SendFileResponse &obj) const
Inequality operator.
void setstatus(Svc::SendFileStatus::T status)
Set member status.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
Send file response struct.
Send file status enum.
bool operator==(const SendFileResponse &obj) const
Equality operator.
void set(Svc::SendFileStatus::T status, U32 context)
Set all members.