mirror of
https://github.com/nasa/fpp.git
synced 2025-12-12 15:59:33 -06:00
191 lines
3.5 KiB
C++
Vendored
191 lines
3.5 KiB
C++
Vendored
// ======================================================================
|
|
// \title Modules1SerializableAc.cpp
|
|
// \author Generated by fpp-to-cpp
|
|
// \brief cpp file for Modules1 struct
|
|
// ======================================================================
|
|
|
|
#include "Fw/Types/Assert.hpp"
|
|
#include "Modules1SerializableAc.hpp"
|
|
|
|
namespace M {
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Constructors
|
|
// ----------------------------------------------------------------------
|
|
|
|
Modules1 ::
|
|
Modules1() :
|
|
Serializable(),
|
|
m_x{},
|
|
m_y{}
|
|
{
|
|
|
|
}
|
|
|
|
Modules1 ::
|
|
Modules1(
|
|
U32 x,
|
|
F32 y
|
|
) :
|
|
Serializable(),
|
|
m_x(x),
|
|
m_y(y)
|
|
{
|
|
|
|
}
|
|
|
|
Modules1 ::
|
|
Modules1(const Modules1& obj) :
|
|
Serializable(),
|
|
m_x(obj.m_x),
|
|
m_y(obj.m_y)
|
|
{
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Operators
|
|
// ----------------------------------------------------------------------
|
|
|
|
Modules1& Modules1 ::
|
|
operator=(const Modules1& obj)
|
|
{
|
|
if (this == &obj) {
|
|
return *this;
|
|
}
|
|
|
|
set(obj.m_x, obj.m_y);
|
|
return *this;
|
|
}
|
|
|
|
bool Modules1 ::
|
|
operator==(const Modules1& obj) const
|
|
{
|
|
if (this == &obj) { return true; }
|
|
return (
|
|
(this->m_x == obj.m_x) &&
|
|
(this->m_y == obj.m_y)
|
|
);
|
|
}
|
|
|
|
bool Modules1 ::
|
|
operator!=(const Modules1& obj) const
|
|
{
|
|
return !(*this == obj);
|
|
}
|
|
|
|
#ifdef BUILD_UT
|
|
|
|
std::ostream& operator<<(std::ostream& os, const Modules1& obj) {
|
|
Fw::String s;
|
|
obj.toString(s);
|
|
os << s.toChar();
|
|
return os;
|
|
}
|
|
|
|
#endif
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Member functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
Fw::SerializeStatus Modules1 ::
|
|
serializeTo(
|
|
Fw::SerialBufferBase& buffer,
|
|
Fw::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;
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
Fw::SerializeStatus Modules1 ::
|
|
deserializeFrom(
|
|
Fw::SerialBufferBase& buffer,
|
|
Fw::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;
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
FwSizeType Modules1 ::
|
|
serializedSize() const
|
|
{
|
|
FwSizeType size = 0;
|
|
size += sizeof(U32);
|
|
size += sizeof(F32);
|
|
return size;
|
|
}
|
|
|
|
#if FW_SERIALIZABLE_TO_STRING
|
|
|
|
void Modules1 ::
|
|
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 = ";
|
|
tmp.format("%f", static_cast<F64>(this->m_y));
|
|
sb += tmp;
|
|
sb += " )";
|
|
}
|
|
|
|
#endif
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Setter functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
void Modules1 ::
|
|
set(
|
|
U32 x,
|
|
F32 y
|
|
)
|
|
{
|
|
this->m_x = x;
|
|
this->m_y = y;
|
|
}
|
|
|
|
void Modules1 ::
|
|
set_x(U32 x)
|
|
{
|
|
this->m_x = x;
|
|
}
|
|
|
|
void Modules1 ::
|
|
set_y(F32 y)
|
|
{
|
|
this->m_y = y;
|
|
}
|
|
|
|
}
|