fpp/compiler/tools/fpp-to-cpp/test/component/base/SSerializableAc.ref.hpp
2024-04-30 11:14:54 -07:00

221 lines
5.0 KiB
C++

// ======================================================================
// \title SSerializableAc.hpp
// \author Generated by fpp-to-cpp
// \brief hpp file for S struct
// ======================================================================
#ifndef SSerializableAc_HPP
#define SSerializableAc_HPP
#include "FpConfig.hpp"
#include "Fw/Types/Serializable.hpp"
#include "Fw/Types/String.hpp"
//! A struct
class S :
public Fw::Serializable
{
public:
// ----------------------------------------------------------------------
// StringSize80 class
// ----------------------------------------------------------------------
class StringSize80 :
public Fw::StringBase
{
public:
enum {
STRING_SIZE = 80,
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE)
};
StringSize80() : StringBase() { *this = ""; }
StringSize80(const StringSize80& src) : StringBase() { *this = src; }
StringSize80(const StringBase& src) : StringBase() { *this = src; }
StringSize80(const char* src) : StringBase() { *this = src; }
~StringSize80() {}
StringSize80& operator=(const StringSize80& src) {
(void)StringBase::operator=(src);
return *this;
}
StringSize80& operator=(const StringBase& src) {
(void)StringBase::operator=(src);
return *this;
}
StringSize80& operator=(const char* src) {
(void)StringBase::operator=(src);
return *this;
}
const char* toChar() const { return this->m_buf; }
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }
private:
char m_buf[BUFFER_SIZE(STRING_SIZE)];
};
public:
// ----------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------
//! The type of x
using Type_of_x = U32;
//! The type of y
using Type_of_y = StringSize80;
public:
// ----------------------------------------------------------------------
// Constants
// ----------------------------------------------------------------------
enum {
//! The size of the serial representation
SERIALIZED_SIZE =
sizeof(U32) +
StringSize80::SERIALIZED_SIZE
};
public:
// ----------------------------------------------------------------------
// Constructors
// ----------------------------------------------------------------------
//! Constructor (default value)
S();
//! Member constructor
S(
U32 x,
const Fw::StringBase& y
);
//! Copy constructor
S(
const S& obj //!< The source object
);
public:
// ----------------------------------------------------------------------
// Operators
// ----------------------------------------------------------------------
//! Copy assignment operator
S& operator=(
const S& obj //!< The source object
);
//! Equality operator
bool operator==(
const S& obj //!< The other object
) const;
//! Inequality operator
bool operator!=(
const S& obj //!< The other object
) const;
#ifdef BUILD_UT
//! Ostream operator
friend std::ostream& operator<<(
std::ostream& os, //!< The ostream
const S& obj //!< The object
);
#endif
public:
// ----------------------------------------------------------------------
// Member functions
// ----------------------------------------------------------------------
//! Serialization
Fw::SerializeStatus serialize(
Fw::SerializeBufferBase& buffer //!< The serial buffer
) const;
//! Deserialization
Fw::SerializeStatus deserialize(
Fw::SerializeBufferBase& buffer //!< The serial buffer
);
#if FW_SERIALIZABLE_TO_STRING
//! Convert struct to string
void toString(
Fw::StringBase& sb //!< The StringBase object to hold the result
) const;
#endif
// ----------------------------------------------------------------------
// Getter functions
// ----------------------------------------------------------------------
//! Get member x
U32 getx() const
{
return this->m_x;
}
//! Get member y
Type_of_y& gety()
{
return this->m_y;
}
//! Get member y (const)
const Type_of_y& gety() const
{
return this->m_y;
}
// ----------------------------------------------------------------------
// Setter functions
// ----------------------------------------------------------------------
//! Set all members
void set(
U32 x,
const Fw::StringBase& y
);
//! Set member x
void setx(U32 x);
//! Set member y
void sety(const Fw::StringBase& y);
protected:
// ----------------------------------------------------------------------
// Member variables
// ----------------------------------------------------------------------
U32 m_x;
StringSize80 m_y;
};
#endif