fpp/compiler/tools/fpp-to-cpp/test/array/S2SerializableAc.ref.cpp
2025-11-16 13:40:21 -08:00

152 lines
2.6 KiB
C++
Vendored

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