fpp/compiler/tools/fpp-to-cpp/test/alias/NamespaceSerializableAc.ref.cpp
2025-10-10 18:00:24 -05:00

243 lines
4.5 KiB
C++
Vendored

// ======================================================================
// \title NamespaceSerializableAc.cpp
// \author Generated by fpp-to-cpp
// \brief cpp file for Namespace struct
// ======================================================================
#include "Fw/Types/Assert.hpp"
#include "NamespaceSerializableAc.hpp"
// ----------------------------------------------------------------------
// Constructors
// ----------------------------------------------------------------------
Namespace ::
Namespace() :
Serializable(),
m_A(0),
m_B(0),
m_C(0),
m_D(0)
{
}
Namespace ::
Namespace(
SimpleCType A,
SimpleCType2 B,
M::M2::NamespacedAliasType C,
M::NamespacedAliasType2 D
) :
Serializable(),
m_A(A),
m_B(B),
m_C(C),
m_D(D)
{
}
Namespace ::
Namespace(const Namespace& obj) :
Serializable(),
m_A(obj.m_A),
m_B(obj.m_B),
m_C(obj.m_C),
m_D(obj.m_D)
{
}
// ----------------------------------------------------------------------
// Operators
// ----------------------------------------------------------------------
Namespace& Namespace ::
operator=(const Namespace& obj)
{
if (this == &obj) {
return *this;
}
set(obj.m_A, obj.m_B, obj.m_C, obj.m_D);
return *this;
}
bool Namespace ::
operator==(const Namespace& obj) const
{
if (this == &obj) { return true; }
return (
(this->m_A == obj.m_A) &&
(this->m_B == obj.m_B) &&
(this->m_C == obj.m_C) &&
(this->m_D == obj.m_D)
);
}
bool Namespace ::
operator!=(const Namespace& obj) const
{
return !(*this == obj);
}
#ifdef BUILD_UT
std::ostream& operator<<(std::ostream& os, const Namespace& obj) {
Fw::String s;
obj.toString(s);
os << s.toChar();
return os;
}
#endif
// ----------------------------------------------------------------------
// Member functions
// ----------------------------------------------------------------------
Fw::SerializeStatus Namespace ::
serializeTo(
Fw::SerializeBufferBase& buffer,
Fw::Endianness mode
) const
{
Fw::SerializeStatus status;
status = buffer.serializeFrom(this->m_A, mode);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
status = buffer.serializeFrom(this->m_B, mode);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
status = buffer.serializeFrom(this->m_C, mode);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
status = buffer.serializeFrom(this->m_D, mode);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
return status;
}
Fw::SerializeStatus Namespace ::
deserializeFrom(
Fw::SerializeBufferBase& buffer,
Fw::Endianness mode
)
{
Fw::SerializeStatus status;
status = buffer.deserializeTo(this->m_A, mode);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
status = buffer.deserializeTo(this->m_B, mode);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
status = buffer.deserializeTo(this->m_C, mode);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
status = buffer.deserializeTo(this->m_D, mode);
if (status != Fw::FW_SERIALIZE_OK) {
return status;
}
return status;
}
FwSizeType Namespace ::
serializedSize() const
{
FwSizeType size = 0;
size += sizeof(SimpleCType);
size += sizeof(SimpleCType2);
size += sizeof(M::M2::NamespacedAliasType);
size += sizeof(M::NamespacedAliasType2);
return size;
}
#if FW_SERIALIZABLE_TO_STRING
void Namespace ::
toString(Fw::StringBase& sb) const
{
Fw::String tmp;
sb = "( ";
// Format A
sb += "A = ";
tmp.format("%" PRIu32 "", this->m_A);
sb += tmp;
sb += ", ";
// Format B
sb += "B = ";
tmp.format("%" PRIu32 "", this->m_B);
sb += tmp;
sb += ", ";
// Format C
sb += "C = ";
tmp.format("%" PRIu32 "", this->m_C);
sb += tmp;
sb += ", ";
// Format D
sb += "D = ";
tmp.format("%" PRIu32 "", this->m_D);
sb += tmp;
sb += " )";
}
#endif
// ----------------------------------------------------------------------
// Setter functions
// ----------------------------------------------------------------------
void Namespace ::
set(
SimpleCType A,
SimpleCType2 B,
M::M2::NamespacedAliasType C,
M::NamespacedAliasType2 D
)
{
this->m_A = A;
this->m_B = B;
this->m_C = C;
this->m_D = D;
}
void Namespace ::
set_A(SimpleCType A)
{
this->m_A = A;
}
void Namespace ::
set_B(SimpleCType2 B)
{
this->m_B = B;
}
void Namespace ::
set_C(M::M2::NamespacedAliasType C)
{
this->m_C = C;
}
void Namespace ::
set_D(M::NamespacedAliasType2 D)
{
this->m_D = D;
}