fpp/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.hpp
2025-11-03 08:51:28 -08:00

174 lines
4.6 KiB
C++
Vendored

// ======================================================================
// \title PrimitiveArrayArrayAc.hpp
// \author Generated by fpp-to-cpp
// \brief hpp file for PrimitiveArray array
// ======================================================================
#ifndef PrimitiveArrayArrayAc_HPP
#define PrimitiveArrayArrayAc_HPP
#include <initializer_list>
#include "Fw/FPrimeBasicTypes.hpp"
#include "Fw/Types/ExternalString.hpp"
#include "Fw/Types/Serializable.hpp"
#include "Fw/Types/String.hpp"
#include "PrimitiveF64ArrayAc.hpp"
//! An array of arrays
class PrimitiveArray :
public Fw::Serializable
{
public:
// ----------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------
//! The element type
using ElementType = M::PrimitiveF64;
public:
// ----------------------------------------------------------------------
// Constants
// ----------------------------------------------------------------------
enum {
//! The size of the array
SIZE = 5,
//! The serialized size of each element
ELEMENT_SERIALIZED_SIZE = M::PrimitiveF64::SERIALIZED_SIZE,
//! The size of the serial representation
SERIALIZED_SIZE = SIZE * ELEMENT_SERIALIZED_SIZE
};
public:
// ----------------------------------------------------------------------
// Constructors
// ----------------------------------------------------------------------
//! Constructor (default value)
PrimitiveArray();
//! Constructor (primitive array)
PrimitiveArray(
const ElementType (&a)[SIZE] //!< The array
);
//! Constructor (single element)
explicit PrimitiveArray(
const ElementType& e //!< The element
);
//! Constructor (initializer list)
PrimitiveArray(
const std::initializer_list<ElementType>& il //!< The initializer list
);
//! Copy constructor
PrimitiveArray(
const PrimitiveArray& obj //!< The source object
);
public:
// ----------------------------------------------------------------------
// Operators
// ----------------------------------------------------------------------
//! Subscript operator
ElementType& operator[](
const FwSizeType i //!< The subscript index
);
//! Const subscript operator
const ElementType& operator[](
const FwSizeType i //!< The subscript index
) const;
//! Copy assignment operator (object)
PrimitiveArray& operator=(
const PrimitiveArray& obj //!< The source object
);
//! Copy assignment operator (primitive array)
PrimitiveArray& operator=(
const ElementType (&a)[SIZE] //!< The source array
);
//! Copy assignment operator (initializer list)
PrimitiveArray& operator=(
const std::initializer_list<ElementType>& il //!< The initializer list
);
//! Copy assignment operator (single element)
PrimitiveArray& operator=(
const ElementType& e //!< The element
);
//! Equality operator
bool operator==(
const PrimitiveArray& obj //!< The other object
) const;
//! Inequality operator
bool operator!=(
const PrimitiveArray& obj //!< The other object
) const;
#ifdef BUILD_UT
//! Ostream operator
friend std::ostream& operator<<(
std::ostream& os, //!< The ostream
const PrimitiveArray& obj //!< The object
);
#endif
public:
// ----------------------------------------------------------------------
// Public member functions
// ----------------------------------------------------------------------
//! Serialization
Fw::SerializeStatus serializeTo(
Fw::SerialBufferBase& buffer, //!< The serial buffer
Fw::Endianness mode = Fw::Endianness::BIG //!< Endianness of serialized buffer
) const;
//! Deserialization
Fw::SerializeStatus deserializeFrom(
Fw::SerialBufferBase& buffer, //!< The serial buffer
Fw::Endianness mode = Fw::Endianness::BIG //!< Endianness of serialized buffer
);
//! Get the dynamic serialized size of the array
FwSizeType serializedSize() const;
#if FW_SERIALIZABLE_TO_STRING
//! Convert array to string
void toString(
Fw::StringBase& sb //!< The StringBase object to hold the result
) const;
#endif
private:
// ----------------------------------------------------------------------
// Member variables
// ----------------------------------------------------------------------
//! The array elements
ElementType elements[SIZE];
};
#endif