fpp/compiler/tools/fpp-to-cpp/test/struct/IncludingSerializableAc.ref.cpp
Robert L. Bocchino Jr f8e1f2b0aa Restore old behavior of toString conversion
We don't want the m_ prefix in the member names. Those
should correspond to the FPP member names. m_ is just for
the C++ implementation.
2024-01-18 19:21:12 -08:00

155 lines
3.0 KiB
C++

// ======================================================================
// \title IncludingSerializableAc.cpp
// \author Generated by fpp-to-cpp
// \brief cpp file for Including struct
// ======================================================================
#include "cstdio"
#include "cstring"
#include "Fw/Types/Assert.hpp"
#include "Fw/Types/StringUtils.hpp"
#include "IncludingSerializableAc.hpp"
// ----------------------------------------------------------------------
// Constructors
// ----------------------------------------------------------------------
Including ::
Including() :
Serializable(),
m_x(0)
{
}
Including ::
Including(const Included& x) :
Serializable(),
m_x(x)
{
}
Including ::
Including(const Including& obj) :
Serializable(),
m_x(obj.m_x)
{
}
// ----------------------------------------------------------------------
// Operators
// ----------------------------------------------------------------------
Including& Including ::
operator=(const Including& obj)
{
if (this == &obj) {
return *this;
}
set(obj.m_x);
return *this;
}
bool Including ::
operator==(const Including& obj) const
{
return (this->m_x == obj.m_x);
}
bool Including ::
operator!=(const Including& obj) const
{
return !(*this == obj);
}
#ifdef BUILD_UT
std::ostream& operator<<(std::ostream& os, const Including& obj) {
Fw::String s;
obj.toString(s);
os << s.toChar();
return os;
}
#endif
// ----------------------------------------------------------------------
// Member functions
// ----------------------------------------------------------------------
Fw::SerializeStatus Including ::
serialize(Fw::SerializeBufferBase& buffer) const
{
Fw::SerializeStatus status;
status = buffer.serialize(this->m_x);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
return status;
}
Fw::SerializeStatus Including ::
deserialize(Fw::SerializeBufferBase& buffer)
{
Fw::SerializeStatus status;
status = buffer.deserialize(this->m_x);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
return status;
}
#if FW_SERIALIZABLE_TO_STRING
void Including ::
toString(Fw::StringBase& sb) const
{
static const char* formatString =
"( "
"x = %s"
" )";
// Declare strings to hold any serializable toString() arguments
Fw::String xStr;
// Call toString for arrays and serializable types
this->m_x.toString(xStr);
char outputString[FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE];
(void) snprintf(
outputString,
FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE,
formatString,
xStr.toChar()
);
outputString[FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE-1] = 0; // NULL terminate
sb = outputString;
}
#endif
// ----------------------------------------------------------------------
// Setter functions
// ----------------------------------------------------------------------
void Including ::
set(const Included& x)
{
this->m_x = x;
}
void Including ::
setx(const Included& x)
{
this->m_x = x;
}