mirror of
https://github.com/nasa/fpp.git
synced 2025-12-12 04:41:37 -06:00
215 lines
4.1 KiB
C++
215 lines
4.1 KiB
C++
// ======================================================================
|
|
// \title BasicSerializableAc.cpp
|
|
// \author Generated by fpp-to-cpp
|
|
// \brief cpp file for Basic struct
|
|
// ======================================================================
|
|
|
|
#include "BasicSerializableAc.hpp"
|
|
#include "Fw/Types/Assert.hpp"
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Constructors
|
|
// ----------------------------------------------------------------------
|
|
|
|
Basic ::
|
|
Basic() :
|
|
Serializable(),
|
|
m_A(0),
|
|
m_B(0.0f),
|
|
m_C(m___fprime_ac_C_buffer, sizeof m___fprime_ac_C_buffer, Fw::String("")),
|
|
m_D(m___fprime_ac_D_buffer, sizeof m___fprime_ac_D_buffer, Fw::String(""))
|
|
{
|
|
|
|
}
|
|
|
|
Basic ::
|
|
Basic(
|
|
TU32 A,
|
|
TF32 B,
|
|
const Fw::StringBase& C,
|
|
const Fw::StringBase& D
|
|
) :
|
|
Serializable(),
|
|
m_A(A),
|
|
m_B(B),
|
|
m_C(m___fprime_ac_C_buffer, sizeof m___fprime_ac_C_buffer, C),
|
|
m_D(m___fprime_ac_D_buffer, sizeof m___fprime_ac_D_buffer, D)
|
|
{
|
|
|
|
}
|
|
|
|
Basic ::
|
|
Basic(const Basic& obj) :
|
|
Serializable(),
|
|
m_A(obj.m_A),
|
|
m_B(obj.m_B),
|
|
m_C(m___fprime_ac_C_buffer, sizeof m___fprime_ac_C_buffer, obj.m_C),
|
|
m_D(m___fprime_ac_D_buffer, sizeof m___fprime_ac_D_buffer, obj.m_D)
|
|
{
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Operators
|
|
// ----------------------------------------------------------------------
|
|
|
|
Basic& Basic ::
|
|
operator=(const Basic& obj)
|
|
{
|
|
if (this == &obj) {
|
|
return *this;
|
|
}
|
|
|
|
set(obj.m_A, obj.m_B, obj.m_C, obj.m_D);
|
|
return *this;
|
|
}
|
|
|
|
bool Basic ::
|
|
operator==(const Basic& 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 Basic ::
|
|
operator!=(const Basic& obj) const
|
|
{
|
|
return !(*this == obj);
|
|
}
|
|
|
|
#ifdef BUILD_UT
|
|
|
|
std::ostream& operator<<(std::ostream& os, const Basic& obj) {
|
|
Fw::String s;
|
|
obj.toString(s);
|
|
os << s.toChar();
|
|
return os;
|
|
}
|
|
|
|
#endif
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Member functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
Fw::SerializeStatus Basic ::
|
|
serialize(Fw::SerializeBufferBase& buffer) const
|
|
{
|
|
Fw::SerializeStatus status;
|
|
|
|
status = buffer.serialize(this->m_A);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.serialize(this->m_B);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.serialize(this->m_C);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.serialize(this->m_D);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
Fw::SerializeStatus Basic ::
|
|
deserialize(Fw::SerializeBufferBase& buffer)
|
|
{
|
|
Fw::SerializeStatus status;
|
|
|
|
status = buffer.deserialize(this->m_A);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.deserialize(this->m_B);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.deserialize(this->m_C);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
status = buffer.deserialize(this->m_D);
|
|
if (status != Fw::FW_SERIALIZE_OK) {
|
|
return status;
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
#if FW_SERIALIZABLE_TO_STRING
|
|
|
|
void Basic ::
|
|
toString(Fw::StringBase& sb) const
|
|
{
|
|
static const char* formatString =
|
|
"( "
|
|
"A = %s, "
|
|
"B = %s, "
|
|
"C = %s, "
|
|
"D = %s"
|
|
" )";
|
|
|
|
sb.format(
|
|
formatString,
|
|
this->m_A,
|
|
static_cast<F64>(this->m_B),
|
|
this->m_C.toChar(),
|
|
this->m_D.toChar()
|
|
);
|
|
}
|
|
|
|
#endif
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Setter functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
void Basic ::
|
|
set(
|
|
TU32 A,
|
|
TF32 B,
|
|
const Fw::StringBase& C,
|
|
const Fw::StringBase& D
|
|
)
|
|
{
|
|
this->m_A = A;
|
|
this->m_B = B;
|
|
this->m_C = C;
|
|
this->m_D = D;
|
|
}
|
|
|
|
void Basic ::
|
|
setA(TU32 A)
|
|
{
|
|
this->m_A = A;
|
|
}
|
|
|
|
void Basic ::
|
|
setB(TF32 B)
|
|
{
|
|
this->m_B = B;
|
|
}
|
|
|
|
void Basic ::
|
|
setC(const Fw::StringBase& C)
|
|
{
|
|
this->m_C = C;
|
|
}
|
|
|
|
void Basic ::
|
|
setD(const Fw::StringBase& D)
|
|
{
|
|
this->m_D = D;
|
|
}
|