// ====================================================================== // \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 :: serializeTo( Fw::SerialBufferBase& 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 Basic :: deserializeFrom( Fw::SerialBufferBase& 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 Basic :: serializedSize() const { FwSizeType size = 0; size += sizeof(TU32); size += sizeof(TF32); size += this->m_C.serializedSize(); size += this->m_D.serializedSize(); return size; } #if FW_SERIALIZABLE_TO_STRING void Basic :: 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("%f", static_cast(this->m_B)); sb += tmp; sb += ", "; // Format C sb += "C = "; sb += this->m_C; sb += ", "; // Format D sb += "D = "; sb += this->m_D; sb += " )"; } #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 :: set_A(TU32 A) { this->m_A = A; } void Basic :: set_B(TF32 B) { this->m_B = B; } void Basic :: set_C(const Fw::StringBase& C) { this->m_C = C; } void Basic :: set_D(const Fw::StringBase& D) { this->m_D = D; }