fpp/compiler/tools/fpp-to-cpp/test/component/base/SSerializableAc.ref.cpp
Rob Bocchino f706e977bb Revise C++ code gen
Remove unused header includes
2024-05-01 10:06:16 -07:00

168 lines
2.8 KiB
C++

// ======================================================================
// \title SSerializableAc.cpp
// \author Generated by fpp-to-cpp
// \brief cpp file for S struct
// ======================================================================
#include "Fw/Types/Assert.hpp"
#include "base/SSerializableAc.hpp"
// ----------------------------------------------------------------------
// Constructors
// ----------------------------------------------------------------------
S ::
S() :
Serializable(),
m_x(0),
m_y(Fw::String(""))
{
}
S ::
S(
U32 x,
const Fw::StringBase& y
) :
Serializable(),
m_x(x),
m_y(y)
{
}
S ::
S(const S& obj) :
Serializable(),
m_x(obj.m_x),
m_y(obj.m_y)
{
}
// ----------------------------------------------------------------------
// Operators
// ----------------------------------------------------------------------
S& S ::
operator=(const S& obj)
{
if (this == &obj) {
return *this;
}
set(obj.m_x, obj.m_y);
return *this;
}
bool S ::
operator==(const S& obj) const
{
return (
(this->m_x == obj.m_x) &&
(this->m_y == obj.m_y)
);
}
bool S ::
operator!=(const S& obj) const
{
return !(*this == obj);
}
#ifdef BUILD_UT
std::ostream& operator<<(std::ostream& os, const S& obj) {
Fw::String s;
obj.toString(s);
os << s.toChar();
return os;
}
#endif
// ----------------------------------------------------------------------
// Member functions
// ----------------------------------------------------------------------
Fw::SerializeStatus S ::
serialize(Fw::SerializeBufferBase& buffer) const
{
Fw::SerializeStatus status;
status = buffer.serialize(this->m_x);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
status = buffer.serialize(this->m_y);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
return status;
}
Fw::SerializeStatus S ::
deserialize(Fw::SerializeBufferBase& buffer)
{
Fw::SerializeStatus status;
status = buffer.deserialize(this->m_x);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
status = buffer.deserialize(this->m_y);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
return status;
}
#if FW_SERIALIZABLE_TO_STRING
void S ::
toString(Fw::StringBase& sb) const
{
static const char* formatString =
"( "
"x = %" PRIu32 ", "
"y = %s"
" )";
sb.format(
formatString,
this->m_x,
this->m_y.toChar()
);
}
#endif
// ----------------------------------------------------------------------
// Setter functions
// ----------------------------------------------------------------------
void S ::
set(
U32 x,
const Fw::StringBase& y
)
{
this->m_x = x;
this->m_y = y;
}
void S ::
setx(U32 x)
{
this->m_x = x;
}
void S ::
sety(const Fw::StringBase& y)
{
this->m_y = y;
}