fpp/compiler/tools/fpp-to-cpp/test/array/SWrapperSerializableAc.ref.cpp
2025-11-16 13:49:34 -08:00

152 lines
2.7 KiB
C++
Vendored

// ======================================================================
// \title SWrapperSerializableAc.cpp
// \author Generated by fpp-to-cpp
// \brief cpp file for SWrapper struct
// ======================================================================
#include "Fw/Types/Assert.hpp"
#include "SWrapperSerializableAc.hpp"
// ----------------------------------------------------------------------
// Constructors
// ----------------------------------------------------------------------
SWrapper ::
SWrapper() :
Serializable(),
m_s{}
{
}
SWrapper ::
SWrapper(const SDefault& s) :
Serializable(),
m_s(s)
{
}
SWrapper ::
SWrapper(const SWrapper& obj) :
Serializable(),
m_s(obj.m_s)
{
}
// ----------------------------------------------------------------------
// Operators
// ----------------------------------------------------------------------
SWrapper& SWrapper ::
operator=(const SWrapper& obj)
{
if (this == &obj) {
return *this;
}
set(obj.m_s);
return *this;
}
bool SWrapper ::
operator==(const SWrapper& obj) const
{
return (this->m_s == obj.m_s);
}
bool SWrapper ::
operator!=(const SWrapper& obj) const
{
return !(*this == obj);
}
#ifdef BUILD_UT
std::ostream& operator<<(std::ostream& os, const SWrapper& obj) {
Fw::String s;
obj.toString(s);
os << s.toChar();
return os;
}
#endif
// ----------------------------------------------------------------------
// Member functions
// ----------------------------------------------------------------------
Fw::SerializeStatus SWrapper ::
serializeTo(
Fw::SerialBufferBase& buffer,
Fw::Endianness mode
) const
{
Fw::SerializeStatus status;
status = buffer.serializeFrom(this->m_s, mode);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
return status;
}
Fw::SerializeStatus SWrapper ::
deserializeFrom(
Fw::SerialBufferBase& buffer,
Fw::Endianness mode
)
{
Fw::SerializeStatus status;
status = buffer.deserializeTo(this->m_s, mode);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
return status;
}
FwSizeType SWrapper ::
serializedSize() const
{
FwSizeType size = 0;
size += this->m_s.serializedSize();
return size;
}
#if FW_SERIALIZABLE_TO_STRING
void SWrapper ::
toString(Fw::StringBase& sb) const
{
Fw::String tmp;
sb = "( ";
// Format s
sb += "s = ";
this->m_s.toString(tmp);
sb += tmp;
sb += " )";
}
#endif
// ----------------------------------------------------------------------
// Setter functions
// ----------------------------------------------------------------------
void SWrapper ::
set(const SDefault& s)
{
this->m_s = s;
}
void SWrapper ::
set_s(const SDefault& s)
{
this->m_s = s;
}