mirror of
https://github.com/nasa/fpp.git
synced 2025-12-11 11:16:42 -06:00
169 lines
3.9 KiB
C++
Vendored
169 lines
3.9 KiB
C++
Vendored
// ======================================================================
|
|
// \title E1EnumAc.hpp
|
|
// \author Generated by fpp-to-cpp
|
|
// \brief hpp file for E1 enum
|
|
// ======================================================================
|
|
|
|
#ifndef M_E1EnumAc_HPP
|
|
#define M_E1EnumAc_HPP
|
|
|
|
#include "Fw/FPrimeBasicTypes.hpp"
|
|
#include "Fw/Types/Serializable.hpp"
|
|
#include "Fw/Types/String.hpp"
|
|
|
|
namespace M {
|
|
|
|
class E1 :
|
|
public Fw::Serializable
|
|
{
|
|
|
|
public:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Types
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! The serial representation type
|
|
typedef I32 SerialType;
|
|
|
|
//! The raw enum type
|
|
enum T {
|
|
//! Example comment
|
|
X = 1,
|
|
Y = 2,
|
|
Z = 9,
|
|
};
|
|
|
|
//! For backwards compatibility
|
|
typedef T t;
|
|
|
|
public:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Constants
|
|
// ----------------------------------------------------------------------
|
|
|
|
enum {
|
|
//! The size of the serial representation
|
|
SERIALIZED_SIZE = sizeof(SerialType),
|
|
//! The number of enumerated constants
|
|
NUM_CONSTANTS = 3,
|
|
};
|
|
|
|
public:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Constructors
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Constructor (default value of X)
|
|
E1()
|
|
{
|
|
this->e = X;
|
|
}
|
|
|
|
//! Constructor (user-provided value)
|
|
E1(
|
|
const T e1 //!< The raw enum value
|
|
)
|
|
{
|
|
this->e = e1;
|
|
}
|
|
|
|
//! Copy constructor
|
|
E1(
|
|
const E1& obj //!< The source object
|
|
)
|
|
{
|
|
this->e = obj.e;
|
|
}
|
|
|
|
public:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Operators
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Copy assignment operator (object)
|
|
E1& operator=(
|
|
const E1& obj //!< The source object
|
|
);
|
|
|
|
//! Copy assignment operator (raw enum)
|
|
E1& operator=(
|
|
T e1 //!< The enum value
|
|
);
|
|
|
|
//! Conversion operator
|
|
operator T() const
|
|
{
|
|
return this->e;
|
|
}
|
|
|
|
//! Equality operator
|
|
bool operator==(T e1) const
|
|
{
|
|
return this->e == e1;
|
|
}
|
|
|
|
//! Inequality operator
|
|
bool operator!=(T e1) const
|
|
{
|
|
return !(*this == e1);
|
|
}
|
|
|
|
#ifdef BUILD_UT
|
|
|
|
//! Ostream operator
|
|
friend std::ostream& operator<<(
|
|
std::ostream& os, //!< The ostream
|
|
const E1& obj //!< The object
|
|
);
|
|
|
|
#endif
|
|
|
|
public:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Member functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Check raw enum value for validity
|
|
bool isValid() const;
|
|
|
|
//! Serialize raw enum value to SerialType
|
|
Fw::SerializeStatus serializeTo(
|
|
Fw::SerialBufferBase& buffer, //!< The serial buffer
|
|
Fw::Endianness mode = Fw::Endianness::BIG //!< Endianness of serialized buffer
|
|
) const;
|
|
|
|
//! Deserialize raw enum value from SerialType
|
|
Fw::SerializeStatus deserializeFrom(
|
|
Fw::SerialBufferBase& buffer, //!< The serial buffer
|
|
Fw::Endianness mode = Fw::Endianness::BIG //!< Endianness of serialized buffer
|
|
);
|
|
|
|
#if FW_SERIALIZABLE_TO_STRING
|
|
|
|
//! Convert enum to string
|
|
void toString(
|
|
Fw::StringBase& sb //!< The StringBase object to hold the result
|
|
) const;
|
|
|
|
#endif
|
|
|
|
public:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Member variables
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! The raw enum value
|
|
T e;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|