mirror of
https://github.com/nasa/fpp.git
synced 2025-12-12 15:59:33 -06:00
270 lines
5.4 KiB
C++
Vendored
270 lines
5.4 KiB
C++
Vendored
// ======================================================================
|
|
// \title StructWithAliasSerializableAc.cpp
|
|
// \author Generated by fpp-to-cpp
|
|
// \brief cpp file for StructWithAlias struct
|
|
// ======================================================================
|
|
|
|
#include "Fw/Types/Assert.hpp"
|
|
#include "base/StructWithAliasSerializableAc.hpp"
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Constructors
|
|
// ----------------------------------------------------------------------
|
|
|
|
StructWithAlias ::
|
|
StructWithAlias() :
|
|
Serializable(),
|
|
m_x(0),
|
|
m_y(m___fprime_ac_y_buffer, sizeof m___fprime_ac_y_buffer, Fw::String("")),
|
|
m_z(A(0)),
|
|
m_w(A(0)),
|
|
m_q(ArrayAliasArray(A(0)))
|
|
{
|
|
|
|
}
|
|
|
|
StructWithAlias ::
|
|
StructWithAlias(
|
|
AliasPrim1 x,
|
|
const Fw::StringBase& y,
|
|
const AliasArray& z,
|
|
const AliasAliasArray& w,
|
|
const AliasArrayAliasArray& q
|
|
) :
|
|
Serializable(),
|
|
m_x(x),
|
|
m_y(m___fprime_ac_y_buffer, sizeof m___fprime_ac_y_buffer, y),
|
|
m_z(z),
|
|
m_w(w),
|
|
m_q(q)
|
|
{
|
|
|
|
}
|
|
|
|
StructWithAlias ::
|
|
StructWithAlias(const StructWithAlias& obj) :
|
|
Serializable(),
|
|
m_x(obj.m_x),
|
|
m_y(m___fprime_ac_y_buffer, sizeof m___fprime_ac_y_buffer, obj.m_y),
|
|
m_z(obj.m_z),
|
|
m_w(obj.m_w),
|
|
m_q(obj.m_q)
|
|
{
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Operators
|
|
// ----------------------------------------------------------------------
|
|
|
|
StructWithAlias& StructWithAlias ::
|
|
operator=(const StructWithAlias& obj)
|
|
{
|
|
if (this == &obj) {
|
|
return *this;
|
|
}
|
|
|
|
set(obj.m_x, obj.m_y, obj.m_z, obj.m_w, obj.m_q);
|
|
return *this;
|
|
}
|
|
|
|
bool StructWithAlias ::
|
|
operator==(const StructWithAlias& obj) const
|
|
{
|
|
if (this == &obj) { return true; }
|
|
return (
|
|
(this->m_x == obj.m_x) &&
|
|
(this->m_y == obj.m_y) &&
|
|
(this->m_z == obj.m_z) &&
|
|
(this->m_w == obj.m_w) &&
|
|
(this->m_q == obj.m_q)
|
|
);
|
|
}
|
|
|
|
bool StructWithAlias ::
|
|
operator!=(const StructWithAlias& obj) const
|
|
{
|
|
return !(*this == obj);
|
|
}
|
|
|
|
#ifdef BUILD_UT
|
|
|
|
std::ostream& operator<<(std::ostream& os, const StructWithAlias& obj) {
|
|
Fw::String s;
|
|
obj.toString(s);
|
|
os << s.toChar();
|
|
return os;
|
|
}
|
|
|
|
#endif
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Member functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
Fw::SerializeStatus StructWithAlias ::
|
|
serializeTo(
|
|
Fw::SerializeBufferBase& buffer,
|
|
Fw::Serialization::Endianness mode
|
|
) const
|
|
{
|
|
Fw::SerializeStatus status;
|
|
|
|
status = buffer.serializeFrom(this->m_x, mode);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.serializeFrom(this->m_y, mode);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.serializeFrom(this->m_z, mode);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.serializeFrom(this->m_w, mode);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.serializeFrom(this->m_q, mode);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
Fw::SerializeStatus StructWithAlias ::
|
|
deserializeFrom(
|
|
Fw::SerializeBufferBase& buffer,
|
|
Fw::Serialization::Endianness mode
|
|
)
|
|
{
|
|
Fw::SerializeStatus status;
|
|
|
|
status = buffer.deserializeTo(this->m_x, mode);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.deserializeTo(this->m_y, mode);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.deserializeTo(this->m_z, mode);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.deserializeTo(this->m_w, mode);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.deserializeTo(this->m_q, mode);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
FwSizeType StructWithAlias ::
|
|
serializedSize() const
|
|
{
|
|
FwSizeType size = 0;
|
|
size += sizeof(AliasPrim1);
|
|
size += this->m_y.serializedSize();
|
|
size += this->m_z.serializedSize();
|
|
size += this->m_w.serializedSize();
|
|
size += this->m_q.serializedSize();
|
|
return size;
|
|
}
|
|
|
|
#if FW_SERIALIZABLE_TO_STRING
|
|
|
|
void StructWithAlias ::
|
|
toString(Fw::StringBase& sb) const
|
|
{
|
|
Fw::String tmp;
|
|
sb = "( ";
|
|
|
|
// Format x
|
|
sb += "x = ";
|
|
tmp.format("%" PRIu32 "", this->m_x);
|
|
sb += tmp;
|
|
sb += ", ";
|
|
|
|
// Format y
|
|
sb += "y = ";
|
|
sb += this->m_y;
|
|
sb += ", ";
|
|
|
|
// Format z
|
|
sb += "z = ";
|
|
this->m_z.toString(tmp);
|
|
sb += tmp;
|
|
sb += ", ";
|
|
|
|
// Format w
|
|
sb += "w = ";
|
|
this->m_w.toString(tmp);
|
|
sb += tmp;
|
|
sb += ", ";
|
|
|
|
// Format q
|
|
sb += "q = ";
|
|
this->m_q.toString(tmp);
|
|
sb += tmp;
|
|
sb += " )";
|
|
}
|
|
|
|
#endif
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Setter functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
void StructWithAlias ::
|
|
set(
|
|
AliasPrim1 x,
|
|
const Fw::StringBase& y,
|
|
const AliasArray& z,
|
|
const AliasAliasArray& w,
|
|
const AliasArrayAliasArray& q
|
|
)
|
|
{
|
|
this->m_x = x;
|
|
this->m_y = y;
|
|
this->m_z = z;
|
|
this->m_w = w;
|
|
this->m_q = q;
|
|
}
|
|
|
|
void StructWithAlias ::
|
|
set_x(AliasPrim1 x)
|
|
{
|
|
this->m_x = x;
|
|
}
|
|
|
|
void StructWithAlias ::
|
|
set_y(const Fw::StringBase& y)
|
|
{
|
|
this->m_y = y;
|
|
}
|
|
|
|
void StructWithAlias ::
|
|
set_z(const AliasArray& z)
|
|
{
|
|
this->m_z = z;
|
|
}
|
|
|
|
void StructWithAlias ::
|
|
set_w(const AliasAliasArray& w)
|
|
{
|
|
this->m_w = w;
|
|
}
|
|
|
|
void StructWithAlias ::
|
|
set_q(const AliasArrayAliasArray& q)
|
|
{
|
|
this->m_q = q;
|
|
}
|