F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
51  operator=(const SendFileResponse& obj)
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  return (
65  (this->m_status == obj.m_status) &&
66  (this->m_context == obj.m_context)
67  );
68  }
69 
71  operator!=(const SendFileResponse& obj) const
72  {
73  return !(*this == obj);
74  }
75 
76 #ifdef BUILD_UT
77 
78  std::ostream& operator<<(std::ostream& os, const SendFileResponse& obj) {
79  Fw::String s;
80  obj.toString(s);
81  os << s.toChar();
82  return os;
83  }
84 
85 #endif
86 
87  // ----------------------------------------------------------------------
88  // Member functions
89  // ----------------------------------------------------------------------
90 
93  {
94  Fw::SerializeStatus status;
95 
96  status = buffer.serialize(this->m_status);
97  if (status != Fw::FW_SERIALIZE_OK) {
98  return status;
99  }
100  status = buffer.serialize(this->m_context);
101  if (status != Fw::FW_SERIALIZE_OK) {
102  return status;
103  }
104 
105  return status;
106  }
107 
110  {
111  Fw::SerializeStatus status;
112 
113  status = buffer.deserialize(this->m_status);
114  if (status != Fw::FW_SERIALIZE_OK) {
115  return status;
116  }
117  status = buffer.deserialize(this->m_context);
118  if (status != Fw::FW_SERIALIZE_OK) {
119  return status;
120  }
121 
122  return status;
123  }
124 
125 #if FW_SERIALIZABLE_TO_STRING
126 
127  void SendFileResponse ::
128  toString(Fw::StringBase& sb) const
129  {
130  static const char* formatString =
131  "( "
132  "status = %s, "
133  "context = %" PRIu32 ""
134  " )";
135 
136  // Declare strings to hold any serializable toString() arguments
137  Fw::String statusStr;
138 
139  // Call toString for arrays and serializable types
140  this->m_status.toString(statusStr);
141 
142  sb.format(
143  formatString,
144  statusStr.toChar(),
145  this->m_context
146  );
147  }
148 
149 #endif
150 
151  // ----------------------------------------------------------------------
152  // Setter functions
153  // ----------------------------------------------------------------------
154 
156  set(
157  Svc::SendFileStatus::T status,
158  U32 context
159  )
160  {
161  this->m_status = status;
162  this->m_context = context;
163  }
164 
167  {
168  this->m_status = status;
169  }
170 
172  setcontext(U32 context)
173  {
174  this->m_context = context;
175  }
176 
177 }
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:56
const char * toChar() const
Definition: String.hpp:50
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialization.
void setstatus(Svc::SendFileStatus::T status)
Set member status.
void setcontext(U32 context)
Set member context.
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialization.
SendFileResponse()
Constructor (default value)
void set(Svc::SendFileStatus::T status, U32 context)
Set all members.
bool operator==(const SendFileResponse &obj) const
Equality operator.
bool operator!=(const SendFileResponse &obj) const
Inequality operator.
SendFileResponse & operator=(const SendFileResponse &obj)
Copy assignment operator.
Send file status enum.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.