mirror of
https://github.com/nasa/fpp.git
synced 2025-12-11 03:05:32 -06:00
Use FpConfig instead of FppConfig, update tests to generate .cpp files so that they may be cpp-checked. Fix builtin type alias handling
This commit is contained in:
parent
46cc26cc3d
commit
0804409618
@ -41,13 +41,15 @@ case class AliasCppWriter (
|
||||
aNode: Ast.Annotated[AstNode[Ast.DefAliasType]]
|
||||
): List[String] = {
|
||||
val Right(a) = UsedSymbols.defAliasTypeAnnotatedNode(s.a, aNode)
|
||||
// Here we can assume that all symbols referenced with be numeric primitives (U/I[8-64] or F32/F64)
|
||||
// ..or an alias to one of those types.
|
||||
// We already are including `FpConfig.h` as part of the system headers so we only have to handle the
|
||||
// alias case.
|
||||
def getIncludeFiles(sym: Symbol): Option[String] = {
|
||||
val name = s.getName(sym)
|
||||
for {
|
||||
fileName <- sym match {
|
||||
case Symbol.AliasType(_) => Some(ComputeCppFiles.FileNames.getAliasType(name))
|
||||
case Symbol.AbsType(node) =>
|
||||
if s.isBuiltInType(name) then Some("FppConfig") else None
|
||||
case _ => None
|
||||
}
|
||||
}
|
||||
@ -118,29 +120,39 @@ case class AliasCppWriter (
|
||||
return linesMember(List())
|
||||
}
|
||||
|
||||
val systemHHeaders = List(
|
||||
"FpConfig.h"
|
||||
).map(CppWriter.systemHeaderString).map(line)
|
||||
|
||||
val standardHeaders = List(
|
||||
"Fw/Types/BasicTypes.h",
|
||||
).map(CppWriter.headerString)
|
||||
|
||||
val symbolHeaders = writeHIncludeDirectives(s, aNode)
|
||||
val headers = standardHeaders ++ symbolHeaders
|
||||
linesMember(addBlankPrefix(headers.distinct.sorted.map(line)))
|
||||
val headers = (standardHeaders ++ symbolHeaders).distinct.sorted.map(line)
|
||||
linesMember(List.concat(
|
||||
addBlankPrefix(systemHHeaders),
|
||||
addBlankPrefix(headers)
|
||||
))
|
||||
}
|
||||
|
||||
private def getHppIncludes: CppDoc.Member.Lines = {
|
||||
val systemHppHeaders = List(
|
||||
"FpConfig.hpp"
|
||||
).map(CppWriter.systemHeaderString).map(line)
|
||||
|
||||
val standardHeaders = List(
|
||||
aliasType.aliasType match {
|
||||
case Type.String(_) => "Fw/Types/String.hpp"
|
||||
case Type.AbsType(node) =>
|
||||
s.isBuiltInType(node._2._1.name) match {
|
||||
case true => "FppConfig.hpp"
|
||||
case false => "Fw/Types/BasicTypes.h"
|
||||
}
|
||||
case _ => "Fw/Types/BasicTypes.h"
|
||||
},
|
||||
).map(CppWriter.headerString)
|
||||
val symbolHeaders = writeHppIncludeDirectives(s, aNode)
|
||||
val headers = standardHeaders ++ symbolHeaders
|
||||
linesMember(addBlankPrefix(headers.distinct.sorted.map(line)))
|
||||
linesMember(List.concat(
|
||||
addBlankPrefix(systemHppHeaders),
|
||||
addBlankPrefix(headers.distinct.sorted.map(line))
|
||||
))
|
||||
}
|
||||
|
||||
private def getHppDefinition: CppDoc.Member.Lines = {
|
||||
|
||||
@ -192,7 +192,12 @@ case class CppWriterState(
|
||||
}
|
||||
|
||||
/** Is t a primitive type (not serializable)? */
|
||||
def isPrimitive(t: Type, typeName: String): Boolean = isBuiltInType(typeName) || t.getUnderlyingType.isPrimitive
|
||||
def isPrimitive(t: Type, typeName: String): Boolean = (
|
||||
isBuiltInType(typeName) ||
|
||||
t.getUnderlyingType.isPrimitive ||
|
||||
// See if this an alias of a builtin type
|
||||
isBuiltInType(t.getUnderlyingType.toString())
|
||||
)
|
||||
|
||||
/** Is t a string type? */
|
||||
def isStringType(t: Type) = t.getUnderlyingType match {
|
||||
|
||||
144
compiler/tools/fpp-to-cpp/test/alias/AbsSerializableAc.ref.cpp
Normal file
144
compiler/tools/fpp-to-cpp/test/alias/AbsSerializableAc.ref.cpp
Normal file
@ -0,0 +1,144 @@
|
||||
// ======================================================================
|
||||
// \title AbsSerializableAc.cpp
|
||||
// \author Generated by fpp-to-cpp
|
||||
// \brief cpp file for Abs struct
|
||||
// ======================================================================
|
||||
|
||||
#include "AbsSerializableAc.hpp"
|
||||
#include "Fw/Types/Assert.hpp"
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Abs ::
|
||||
Abs() :
|
||||
Serializable(),
|
||||
m_A()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Abs ::
|
||||
Abs(const AbsType& A) :
|
||||
Serializable(),
|
||||
m_A(A)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Abs ::
|
||||
Abs(const Abs& obj) :
|
||||
Serializable(),
|
||||
m_A(obj.m_A)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Operators
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Abs& Abs ::
|
||||
operator=(const Abs& obj)
|
||||
{
|
||||
if (this == &obj) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
set(obj.m_A);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Abs ::
|
||||
operator==(const Abs& obj) const
|
||||
{
|
||||
return (this->m_A == obj.m_A);
|
||||
}
|
||||
|
||||
bool Abs ::
|
||||
operator!=(const Abs& obj) const
|
||||
{
|
||||
return !(*this == obj);
|
||||
}
|
||||
|
||||
#ifdef BUILD_UT
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Abs& obj) {
|
||||
Fw::String s;
|
||||
obj.toString(s);
|
||||
os << s.toChar();
|
||||
return os;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Fw::SerializeStatus Abs ::
|
||||
serialize(Fw::SerializeBufferBase& buffer) const
|
||||
{
|
||||
Fw::SerializeStatus status;
|
||||
|
||||
status = buffer.serialize(this->m_A);
|
||||
if (status != Fw::FW_SERIALIZE_OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
Fw::SerializeStatus Abs ::
|
||||
deserialize(Fw::SerializeBufferBase& buffer)
|
||||
{
|
||||
Fw::SerializeStatus status;
|
||||
|
||||
status = buffer.deserialize(this->m_A);
|
||||
if (status != Fw::FW_SERIALIZE_OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#if FW_SERIALIZABLE_TO_STRING
|
||||
|
||||
void Abs ::
|
||||
toString(Fw::StringBase& sb) const
|
||||
{
|
||||
static const char* formatString =
|
||||
"( "
|
||||
"A = %s"
|
||||
" )";
|
||||
|
||||
// Declare strings to hold any serializable toString() arguments
|
||||
Fw::String AStr;
|
||||
|
||||
// Call toString for arrays and serializable types
|
||||
this->m_A.toString(AStr);
|
||||
|
||||
sb.format(
|
||||
formatString,
|
||||
AStr.toChar()
|
||||
);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Setter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void Abs ::
|
||||
set(const AbsType& A)
|
||||
{
|
||||
this->m_A = A;
|
||||
}
|
||||
|
||||
void Abs ::
|
||||
setA(const AbsType& A)
|
||||
{
|
||||
this->m_A = A;
|
||||
}
|
||||
141
compiler/tools/fpp-to-cpp/test/alias/AbsSerializableAc.ref.hpp
Normal file
141
compiler/tools/fpp-to-cpp/test/alias/AbsSerializableAc.ref.hpp
Normal file
@ -0,0 +1,141 @@
|
||||
// ======================================================================
|
||||
// \title AbsSerializableAc.hpp
|
||||
// \author Generated by fpp-to-cpp
|
||||
// \brief hpp file for Abs struct
|
||||
// ======================================================================
|
||||
|
||||
#ifndef AbsSerializableAc_HPP
|
||||
#define AbsSerializableAc_HPP
|
||||
|
||||
#include "AbsTypeAliasAc.hpp"
|
||||
#include "FpConfig.hpp"
|
||||
#include "Fw/Types/ExternalString.hpp"
|
||||
#include "Fw/Types/Serializable.hpp"
|
||||
#include "Fw/Types/String.hpp"
|
||||
|
||||
class Abs :
|
||||
public Fw::Serializable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constants
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
//! The size of the serial representation
|
||||
SERIALIZED_SIZE =
|
||||
AbsType::SERIALIZED_SIZE
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Constructor (default value)
|
||||
Abs();
|
||||
|
||||
//! Member constructor
|
||||
Abs(const AbsType& A);
|
||||
|
||||
//! Copy constructor
|
||||
Abs(
|
||||
const Abs& obj //!< The source object
|
||||
);
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Operators
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Copy assignment operator
|
||||
Abs& operator=(
|
||||
const Abs& obj //!< The source object
|
||||
);
|
||||
|
||||
//! Equality operator
|
||||
bool operator==(
|
||||
const Abs& obj //!< The other object
|
||||
) const;
|
||||
|
||||
//! Inequality operator
|
||||
bool operator!=(
|
||||
const Abs& obj //!< The other object
|
||||
) const;
|
||||
|
||||
#ifdef BUILD_UT
|
||||
|
||||
//! Ostream operator
|
||||
friend std::ostream& operator<<(
|
||||
std::ostream& os, //!< The ostream
|
||||
const Abs& 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 A
|
||||
AbsType& getA()
|
||||
{
|
||||
return this->m_A;
|
||||
}
|
||||
|
||||
//! Get member A (const)
|
||||
const AbsType& getA() const
|
||||
{
|
||||
return this->m_A;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Setter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Set all members
|
||||
void set(const AbsType& A);
|
||||
|
||||
//! Set member A
|
||||
void setA(const AbsType& A);
|
||||
|
||||
protected:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member variables
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
AbsType m_A;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef AbsTypeAliasAc_HPP
|
||||
#define AbsTypeAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
#include "T.hpp"
|
||||
|
||||
|
||||
214
compiler/tools/fpp-to-cpp/test/alias/BasicSerializableAc.ref.cpp
Normal file
214
compiler/tools/fpp-to-cpp/test/alias/BasicSerializableAc.ref.cpp
Normal file
@ -0,0 +1,214 @@
|
||||
// ======================================================================
|
||||
// \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;
|
||||
}
|
||||
195
compiler/tools/fpp-to-cpp/test/alias/BasicSerializableAc.ref.hpp
Normal file
195
compiler/tools/fpp-to-cpp/test/alias/BasicSerializableAc.ref.hpp
Normal file
@ -0,0 +1,195 @@
|
||||
// ======================================================================
|
||||
// \title BasicSerializableAc.hpp
|
||||
// \author Generated by fpp-to-cpp
|
||||
// \brief hpp file for Basic struct
|
||||
// ======================================================================
|
||||
|
||||
#ifndef BasicSerializableAc_HPP
|
||||
#define BasicSerializableAc_HPP
|
||||
|
||||
#include "FpConfig.hpp"
|
||||
#include "Fw/Types/ExternalString.hpp"
|
||||
#include "Fw/Types/Serializable.hpp"
|
||||
#include "Fw/Types/String.hpp"
|
||||
#include "TF32AliasAc.hpp"
|
||||
#include "TStringAliasAc.hpp"
|
||||
#include "TStringSizeAliasAc.hpp"
|
||||
#include "TU32AliasAc.hpp"
|
||||
|
||||
class Basic :
|
||||
public Fw::Serializable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constants
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
//! The size of the serial representation
|
||||
SERIALIZED_SIZE =
|
||||
sizeof(TU32) +
|
||||
sizeof(TF32) +
|
||||
TString::SERIALIZED_SIZE +
|
||||
TStringSize::SERIALIZED_SIZE
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Constructor (default value)
|
||||
Basic();
|
||||
|
||||
//! Member constructor
|
||||
Basic(
|
||||
TU32 A,
|
||||
TF32 B,
|
||||
const Fw::StringBase& C,
|
||||
const Fw::StringBase& D
|
||||
);
|
||||
|
||||
//! Copy constructor
|
||||
Basic(
|
||||
const Basic& obj //!< The source object
|
||||
);
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Operators
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Copy assignment operator
|
||||
Basic& operator=(
|
||||
const Basic& obj //!< The source object
|
||||
);
|
||||
|
||||
//! Equality operator
|
||||
bool operator==(
|
||||
const Basic& obj //!< The other object
|
||||
) const;
|
||||
|
||||
//! Inequality operator
|
||||
bool operator!=(
|
||||
const Basic& obj //!< The other object
|
||||
) const;
|
||||
|
||||
#ifdef BUILD_UT
|
||||
|
||||
//! Ostream operator
|
||||
friend std::ostream& operator<<(
|
||||
std::ostream& os, //!< The ostream
|
||||
const Basic& 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 A
|
||||
TU32 getA() const
|
||||
{
|
||||
return this->m_A;
|
||||
}
|
||||
|
||||
//! Get member B
|
||||
TF32 getB() const
|
||||
{
|
||||
return this->m_B;
|
||||
}
|
||||
|
||||
//! Get member C
|
||||
Fw::ExternalString& getC()
|
||||
{
|
||||
return this->m_C;
|
||||
}
|
||||
|
||||
//! Get member C (const)
|
||||
const Fw::ExternalString& getC() const
|
||||
{
|
||||
return this->m_C;
|
||||
}
|
||||
|
||||
//! Get member D
|
||||
Fw::ExternalString& getD()
|
||||
{
|
||||
return this->m_D;
|
||||
}
|
||||
|
||||
//! Get member D (const)
|
||||
const Fw::ExternalString& getD() const
|
||||
{
|
||||
return this->m_D;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Setter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Set all members
|
||||
void set(
|
||||
TU32 A,
|
||||
TF32 B,
|
||||
const Fw::StringBase& C,
|
||||
const Fw::StringBase& D
|
||||
);
|
||||
|
||||
//! Set member A
|
||||
void setA(TU32 A);
|
||||
|
||||
//! Set member B
|
||||
void setB(TF32 B);
|
||||
|
||||
//! Set member C
|
||||
void setC(const Fw::StringBase& C);
|
||||
|
||||
//! Set member D
|
||||
void setD(const Fw::StringBase& D);
|
||||
|
||||
protected:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member variables
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
TU32 m_A;
|
||||
TF32 m_B;
|
||||
char m___fprime_ac_C_buffer[Fw::StringBase::BUFFER_SIZE(80)];
|
||||
Fw::ExternalString m_C;
|
||||
char m___fprime_ac_D_buffer[Fw::StringBase::BUFFER_SIZE(2)];
|
||||
Fw::ExternalString m_D;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -7,7 +7,8 @@
|
||||
#ifndef BuiltInTypeAliasAc_H
|
||||
#define BuiltInTypeAliasAc_H
|
||||
|
||||
#include "FppConfig.h"
|
||||
#include <FpConfig.h>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
//! An alias of a built-in type
|
||||
|
||||
@ -7,7 +7,9 @@
|
||||
#ifndef BuiltInTypeAliasAc_HPP
|
||||
#define BuiltInTypeAliasAc_HPP
|
||||
|
||||
#include "FppConfig.hpp"
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
#include "BuiltInTypeAliasAc.h"
|
||||
|
||||
@ -0,0 +1,191 @@
|
||||
// ======================================================================
|
||||
// \title BuiltinSerializableAc.cpp
|
||||
// \author Generated by fpp-to-cpp
|
||||
// \brief cpp file for Builtin struct
|
||||
// ======================================================================
|
||||
|
||||
#include "BuiltinSerializableAc.hpp"
|
||||
#include "Fw/Types/Assert.hpp"
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Builtin ::
|
||||
Builtin() :
|
||||
Serializable(),
|
||||
m_A(),
|
||||
m_B(),
|
||||
m_C()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Builtin ::
|
||||
Builtin(
|
||||
BuiltInType A,
|
||||
M::NamespacedBuiltin1 B,
|
||||
M::NamespacedBuiltin2 C
|
||||
) :
|
||||
Serializable(),
|
||||
m_A(A),
|
||||
m_B(B),
|
||||
m_C(C)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Builtin ::
|
||||
Builtin(const Builtin& obj) :
|
||||
Serializable(),
|
||||
m_A(obj.m_A),
|
||||
m_B(obj.m_B),
|
||||
m_C(obj.m_C)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Operators
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Builtin& Builtin ::
|
||||
operator=(const Builtin& obj)
|
||||
{
|
||||
if (this == &obj) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
set(obj.m_A, obj.m_B, obj.m_C);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Builtin ::
|
||||
operator==(const Builtin& 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)
|
||||
);
|
||||
}
|
||||
|
||||
bool Builtin ::
|
||||
operator!=(const Builtin& obj) const
|
||||
{
|
||||
return !(*this == obj);
|
||||
}
|
||||
|
||||
#ifdef BUILD_UT
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Builtin& obj) {
|
||||
Fw::String s;
|
||||
obj.toString(s);
|
||||
os << s.toChar();
|
||||
return os;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Fw::SerializeStatus Builtin ::
|
||||
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;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
Fw::SerializeStatus Builtin ::
|
||||
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;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#if FW_SERIALIZABLE_TO_STRING
|
||||
|
||||
void Builtin ::
|
||||
toString(Fw::StringBase& sb) const
|
||||
{
|
||||
static const char* formatString =
|
||||
"( "
|
||||
"A = %s, "
|
||||
"B = %s, "
|
||||
"C = %s"
|
||||
" )";
|
||||
|
||||
sb.format(
|
||||
formatString,
|
||||
this->m_A,
|
||||
this->m_B,
|
||||
this->m_C
|
||||
);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Setter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void Builtin ::
|
||||
set(
|
||||
BuiltInType A,
|
||||
M::NamespacedBuiltin1 B,
|
||||
M::NamespacedBuiltin2 C
|
||||
)
|
||||
{
|
||||
this->m_A = A;
|
||||
this->m_B = B;
|
||||
this->m_C = C;
|
||||
}
|
||||
|
||||
void Builtin ::
|
||||
setA(BuiltInType A)
|
||||
{
|
||||
this->m_A = A;
|
||||
}
|
||||
|
||||
void Builtin ::
|
||||
setB(M::NamespacedBuiltin1 B)
|
||||
{
|
||||
this->m_B = B;
|
||||
}
|
||||
|
||||
void Builtin ::
|
||||
setC(M::NamespacedBuiltin2 C)
|
||||
{
|
||||
this->m_C = C;
|
||||
}
|
||||
@ -0,0 +1,167 @@
|
||||
// ======================================================================
|
||||
// \title BuiltinSerializableAc.hpp
|
||||
// \author Generated by fpp-to-cpp
|
||||
// \brief hpp file for Builtin struct
|
||||
// ======================================================================
|
||||
|
||||
#ifndef BuiltinSerializableAc_HPP
|
||||
#define BuiltinSerializableAc_HPP
|
||||
|
||||
#include "BuiltInTypeAliasAc.hpp"
|
||||
#include "FpConfig.hpp"
|
||||
#include "Fw/Types/ExternalString.hpp"
|
||||
#include "Fw/Types/Serializable.hpp"
|
||||
#include "Fw/Types/String.hpp"
|
||||
#include "NamespacedBuiltin1AliasAc.hpp"
|
||||
#include "NamespacedBuiltin2AliasAc.hpp"
|
||||
|
||||
class Builtin :
|
||||
public Fw::Serializable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constants
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
//! The size of the serial representation
|
||||
SERIALIZED_SIZE =
|
||||
sizeof(BuiltInType) +
|
||||
sizeof(M::NamespacedBuiltin1) +
|
||||
sizeof(M::NamespacedBuiltin2)
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Constructor (default value)
|
||||
Builtin();
|
||||
|
||||
//! Member constructor
|
||||
Builtin(
|
||||
BuiltInType A,
|
||||
M::NamespacedBuiltin1 B,
|
||||
M::NamespacedBuiltin2 C
|
||||
);
|
||||
|
||||
//! Copy constructor
|
||||
Builtin(
|
||||
const Builtin& obj //!< The source object
|
||||
);
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Operators
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Copy assignment operator
|
||||
Builtin& operator=(
|
||||
const Builtin& obj //!< The source object
|
||||
);
|
||||
|
||||
//! Equality operator
|
||||
bool operator==(
|
||||
const Builtin& obj //!< The other object
|
||||
) const;
|
||||
|
||||
//! Inequality operator
|
||||
bool operator!=(
|
||||
const Builtin& obj //!< The other object
|
||||
) const;
|
||||
|
||||
#ifdef BUILD_UT
|
||||
|
||||
//! Ostream operator
|
||||
friend std::ostream& operator<<(
|
||||
std::ostream& os, //!< The ostream
|
||||
const Builtin& 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 A
|
||||
BuiltInType getA() const
|
||||
{
|
||||
return this->m_A;
|
||||
}
|
||||
|
||||
//! Get member B
|
||||
M::NamespacedBuiltin1 getB() const
|
||||
{
|
||||
return this->m_B;
|
||||
}
|
||||
|
||||
//! Get member C
|
||||
M::NamespacedBuiltin2 getC() const
|
||||
{
|
||||
return this->m_C;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Setter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Set all members
|
||||
void set(
|
||||
BuiltInType A,
|
||||
M::NamespacedBuiltin1 B,
|
||||
M::NamespacedBuiltin2 C
|
||||
);
|
||||
|
||||
//! Set member A
|
||||
void setA(BuiltInType A);
|
||||
|
||||
//! Set member B
|
||||
void setB(M::NamespacedBuiltin1 B);
|
||||
|
||||
//! Set member C
|
||||
void setC(M::NamespacedBuiltin2 C);
|
||||
|
||||
protected:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member variables
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
BuiltInType m_A;
|
||||
M::NamespacedBuiltin1 m_B;
|
||||
M::NamespacedBuiltin2 m_C;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,214 @@
|
||||
// ======================================================================
|
||||
// \title NamespaceSerializableAc.cpp
|
||||
// \author Generated by fpp-to-cpp
|
||||
// \brief cpp file for Namespace struct
|
||||
// ======================================================================
|
||||
|
||||
#include "Fw/Types/Assert.hpp"
|
||||
#include "NamespaceSerializableAc.hpp"
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Namespace ::
|
||||
Namespace() :
|
||||
Serializable(),
|
||||
m_A(0),
|
||||
m_B(0),
|
||||
m_C(0),
|
||||
m_D(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Namespace ::
|
||||
Namespace(
|
||||
SimpleCType A,
|
||||
SimpleCType2 B,
|
||||
M::M2::NamespacedAliasType C,
|
||||
M::NamespacedAliasType2 D
|
||||
) :
|
||||
Serializable(),
|
||||
m_A(A),
|
||||
m_B(B),
|
||||
m_C(C),
|
||||
m_D(D)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Namespace ::
|
||||
Namespace(const Namespace& obj) :
|
||||
Serializable(),
|
||||
m_A(obj.m_A),
|
||||
m_B(obj.m_B),
|
||||
m_C(obj.m_C),
|
||||
m_D(obj.m_D)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Operators
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Namespace& Namespace ::
|
||||
operator=(const Namespace& obj)
|
||||
{
|
||||
if (this == &obj) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
set(obj.m_A, obj.m_B, obj.m_C, obj.m_D);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Namespace ::
|
||||
operator==(const Namespace& 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 Namespace ::
|
||||
operator!=(const Namespace& obj) const
|
||||
{
|
||||
return !(*this == obj);
|
||||
}
|
||||
|
||||
#ifdef BUILD_UT
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Namespace& obj) {
|
||||
Fw::String s;
|
||||
obj.toString(s);
|
||||
os << s.toChar();
|
||||
return os;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Fw::SerializeStatus Namespace ::
|
||||
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 Namespace ::
|
||||
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 Namespace ::
|
||||
toString(Fw::StringBase& sb) const
|
||||
{
|
||||
static const char* formatString =
|
||||
"( "
|
||||
"A = %s, "
|
||||
"B = %s, "
|
||||
"C = %s, "
|
||||
"D = %s"
|
||||
" )";
|
||||
|
||||
sb.format(
|
||||
formatString,
|
||||
this->m_A,
|
||||
this->m_B,
|
||||
this->m_C,
|
||||
this->m_D
|
||||
);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Setter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void Namespace ::
|
||||
set(
|
||||
SimpleCType A,
|
||||
SimpleCType2 B,
|
||||
M::M2::NamespacedAliasType C,
|
||||
M::NamespacedAliasType2 D
|
||||
)
|
||||
{
|
||||
this->m_A = A;
|
||||
this->m_B = B;
|
||||
this->m_C = C;
|
||||
this->m_D = D;
|
||||
}
|
||||
|
||||
void Namespace ::
|
||||
setA(SimpleCType A)
|
||||
{
|
||||
this->m_A = A;
|
||||
}
|
||||
|
||||
void Namespace ::
|
||||
setB(SimpleCType2 B)
|
||||
{
|
||||
this->m_B = B;
|
||||
}
|
||||
|
||||
void Namespace ::
|
||||
setC(M::M2::NamespacedAliasType C)
|
||||
{
|
||||
this->m_C = C;
|
||||
}
|
||||
|
||||
void Namespace ::
|
||||
setD(M::NamespacedAliasType2 D)
|
||||
{
|
||||
this->m_D = D;
|
||||
}
|
||||
@ -0,0 +1,181 @@
|
||||
// ======================================================================
|
||||
// \title NamespaceSerializableAc.hpp
|
||||
// \author Generated by fpp-to-cpp
|
||||
// \brief hpp file for Namespace struct
|
||||
// ======================================================================
|
||||
|
||||
#ifndef NamespaceSerializableAc_HPP
|
||||
#define NamespaceSerializableAc_HPP
|
||||
|
||||
#include "FpConfig.hpp"
|
||||
#include "Fw/Types/ExternalString.hpp"
|
||||
#include "Fw/Types/Serializable.hpp"
|
||||
#include "Fw/Types/String.hpp"
|
||||
#include "NamespacedAliasType2AliasAc.hpp"
|
||||
#include "NamespacedAliasTypeAliasAc.hpp"
|
||||
#include "SimpleCType2AliasAc.hpp"
|
||||
#include "SimpleCTypeAliasAc.hpp"
|
||||
|
||||
class Namespace :
|
||||
public Fw::Serializable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constants
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
//! The size of the serial representation
|
||||
SERIALIZED_SIZE =
|
||||
sizeof(SimpleCType) +
|
||||
sizeof(SimpleCType2) +
|
||||
sizeof(M::M2::NamespacedAliasType) +
|
||||
sizeof(M::NamespacedAliasType2)
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Constructor (default value)
|
||||
Namespace();
|
||||
|
||||
//! Member constructor
|
||||
Namespace(
|
||||
SimpleCType A,
|
||||
SimpleCType2 B,
|
||||
M::M2::NamespacedAliasType C,
|
||||
M::NamespacedAliasType2 D
|
||||
);
|
||||
|
||||
//! Copy constructor
|
||||
Namespace(
|
||||
const Namespace& obj //!< The source object
|
||||
);
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Operators
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Copy assignment operator
|
||||
Namespace& operator=(
|
||||
const Namespace& obj //!< The source object
|
||||
);
|
||||
|
||||
//! Equality operator
|
||||
bool operator==(
|
||||
const Namespace& obj //!< The other object
|
||||
) const;
|
||||
|
||||
//! Inequality operator
|
||||
bool operator!=(
|
||||
const Namespace& obj //!< The other object
|
||||
) const;
|
||||
|
||||
#ifdef BUILD_UT
|
||||
|
||||
//! Ostream operator
|
||||
friend std::ostream& operator<<(
|
||||
std::ostream& os, //!< The ostream
|
||||
const Namespace& 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 A
|
||||
SimpleCType getA() const
|
||||
{
|
||||
return this->m_A;
|
||||
}
|
||||
|
||||
//! Get member B
|
||||
SimpleCType2 getB() const
|
||||
{
|
||||
return this->m_B;
|
||||
}
|
||||
|
||||
//! Get member C
|
||||
M::M2::NamespacedAliasType getC() const
|
||||
{
|
||||
return this->m_C;
|
||||
}
|
||||
|
||||
//! Get member D
|
||||
M::NamespacedAliasType2 getD() const
|
||||
{
|
||||
return this->m_D;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Setter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Set all members
|
||||
void set(
|
||||
SimpleCType A,
|
||||
SimpleCType2 B,
|
||||
M::M2::NamespacedAliasType C,
|
||||
M::NamespacedAliasType2 D
|
||||
);
|
||||
|
||||
//! Set member A
|
||||
void setA(SimpleCType A);
|
||||
|
||||
//! Set member B
|
||||
void setB(SimpleCType2 B);
|
||||
|
||||
//! Set member C
|
||||
void setC(M::M2::NamespacedAliasType C);
|
||||
|
||||
//! Set member D
|
||||
void setD(M::NamespacedAliasType2 D);
|
||||
|
||||
protected:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member variables
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
SimpleCType m_A;
|
||||
SimpleCType2 m_B;
|
||||
M::M2::NamespacedAliasType m_C;
|
||||
M::NamespacedAliasType2 m_D;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef M_NamespacedAliasType2AliasAc_HPP
|
||||
#define M_NamespacedAliasType2AliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
#include "NamespacedAliasTypeAliasAc.hpp"
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef M_M2_NamespacedAliasTypeAliasAc_HPP
|
||||
#define M_M2_NamespacedAliasTypeAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
#include "SimpleCType2AliasAc.hpp"
|
||||
|
||||
|
||||
@ -7,7 +7,9 @@
|
||||
#ifndef M_NamespacedBuiltin1AliasAc_HPP
|
||||
#define M_NamespacedBuiltin1AliasAc_HPP
|
||||
|
||||
#include "FppConfig.hpp"
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
namespace M {
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef M_NamespacedBuiltin2AliasAc_HPP
|
||||
#define M_NamespacedBuiltin2AliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "BuiltInTypeAliasAc.hpp"
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef SimpleCType2AliasAc_H
|
||||
#define SimpleCType2AliasAc_H
|
||||
|
||||
#include <FpConfig.h>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
#include "SimpleCTypeAliasAc.h"
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef SimpleCType2AliasAc_HPP
|
||||
#define SimpleCType2AliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
#include "SimpleCTypeAliasAc.hpp"
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef SimpleCTypeAliasAc_H
|
||||
#define SimpleCTypeAliasAc_H
|
||||
|
||||
#include <FpConfig.h>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
//! A simple type alias that supports C codegen
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef SimpleCTypeAliasAc_HPP
|
||||
#define SimpleCTypeAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
35
compiler/tools/fpp-to-cpp/test/alias/T.hpp
Normal file
35
compiler/tools/fpp-to-cpp/test/alias/T.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
// A minimal implementation of abstract type T
|
||||
|
||||
#ifndef T_HPP
|
||||
#define T_HPP
|
||||
|
||||
// Include Fw/Types/Serializable.fpp from the F Prime framework
|
||||
#include "Fw/Types/Serializable.hpp"
|
||||
|
||||
struct T : public Fw::Serializable { // Extend Fw::Serializable
|
||||
|
||||
// Define some shorthand for F Prime types
|
||||
typedef Fw::SerializeStatus SS;
|
||||
typedef Fw::SerializeBufferBase B;
|
||||
|
||||
// Define the constant SERIALIZED_SIZE
|
||||
enum Constants { SERIALIZED_SIZE = sizeof(U32) };
|
||||
|
||||
// Provide a zero-argument constructor
|
||||
T() : x(0) { }
|
||||
|
||||
// Define a comparison operator
|
||||
bool operator==(const T& that) const { return this->x == that.x; }
|
||||
|
||||
// Define the virtual serialize method
|
||||
SS serialize(B& b) const { return b.serialize(x); }
|
||||
|
||||
// Define the virtual deserialize method
|
||||
SS deserialize(B& b) { return b.deserialize(x); }
|
||||
|
||||
// Provide some data
|
||||
U32 x;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef TF32AliasAc_H
|
||||
#define TF32AliasAc_H
|
||||
|
||||
#include <FpConfig.h>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
typedef F32 TF32;
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef TF32AliasAc_HPP
|
||||
#define TF32AliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef TStringAliasAc_HPP
|
||||
#define TStringAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/String.hpp"
|
||||
|
||||
using TString = Fw::String;
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef TStringSizeAliasAc_HPP
|
||||
#define TStringSizeAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/String.hpp"
|
||||
|
||||
using TStringSize = Fw::String;
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef TU32AliasAc_H
|
||||
#define TU32AliasAc_H
|
||||
|
||||
#include <FpConfig.h>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
typedef U32 TU32;
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef TU32AliasAc_HPP
|
||||
#define TU32AliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
@ -2,3 +2,7 @@ type T
|
||||
|
||||
@ An alias of abstract type
|
||||
type AbsType = T
|
||||
|
||||
struct Abs {
|
||||
A: AbsType
|
||||
}
|
||||
|
||||
@ -2,3 +2,10 @@ type TU32 = U32
|
||||
type TF32 = F32
|
||||
type TString = string
|
||||
type TStringSize = string size 2
|
||||
|
||||
struct Basic {
|
||||
A: TU32,
|
||||
B: TF32,
|
||||
C: TString,
|
||||
D: TStringSize
|
||||
}
|
||||
|
||||
@ -7,3 +7,9 @@ module M {
|
||||
type NamespacedBuiltin1 = FwOpcodeType
|
||||
type NamespacedBuiltin2 = BuiltInType
|
||||
}
|
||||
|
||||
struct Builtin {
|
||||
A: BuiltInType,
|
||||
B: M.NamespacedBuiltin1,
|
||||
C: M.NamespacedBuiltin2,
|
||||
}
|
||||
|
||||
@ -14,3 +14,10 @@ module M {
|
||||
@ Type within a namespace that references another namespaces type
|
||||
type NamespacedAliasType2 = M2.NamespacedAliasType
|
||||
}
|
||||
|
||||
struct Namespace {
|
||||
A: SimpleCType,
|
||||
B: SimpleCType2,
|
||||
C: M.M2.NamespacedAliasType,
|
||||
D: M.NamespacedAliasType2
|
||||
}
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
abs_type()
|
||||
{
|
||||
run_test "-p $PWD" abs_type && \
|
||||
diff_hpp AbsTypeAlias
|
||||
diff_hpp AbsTypeAlias && \
|
||||
diff_cpp AbsSerializable
|
||||
}
|
||||
|
||||
basic()
|
||||
@ -10,7 +11,8 @@ basic()
|
||||
diff_h_hpp TU32Alias && \
|
||||
diff_h_hpp TF32Alias && \
|
||||
diff_hpp TStringAlias && \
|
||||
diff_hpp TStringSizeAlias
|
||||
diff_hpp TStringSizeAlias && \
|
||||
diff_cpp BasicSerializable
|
||||
}
|
||||
|
||||
builtin_type()
|
||||
@ -18,7 +20,8 @@ builtin_type()
|
||||
run_test "-p $PWD" builtin_type && \
|
||||
diff_h_hpp BuiltInTypeAlias && \
|
||||
diff_hpp NamespacedBuiltin1Alias && \
|
||||
diff_hpp NamespacedBuiltin2Alias
|
||||
diff_hpp NamespacedBuiltin2Alias && \
|
||||
diff_cpp BuiltinSerializable
|
||||
}
|
||||
|
||||
namespace()
|
||||
@ -27,5 +30,6 @@ namespace()
|
||||
diff_h_hpp SimpleCTypeAlias && \
|
||||
diff_h_hpp SimpleCType2Alias && \
|
||||
diff_hpp NamespacedAliasTypeAlias && \
|
||||
diff_hpp NamespacedAliasType2Alias
|
||||
diff_hpp NamespacedAliasType2Alias && \
|
||||
diff_cpp NamespaceSerializable
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ abs_type()
|
||||
{
|
||||
update "-p $PWD" abs_type
|
||||
move_hpp AbsTypeAlias
|
||||
move_cpp AbsSerializable
|
||||
}
|
||||
|
||||
basic()
|
||||
@ -11,6 +12,7 @@ basic()
|
||||
move_h_hpp TU32Alias
|
||||
move_hpp TStringAlias
|
||||
move_hpp TStringSizeAlias
|
||||
move_cpp BasicSerializable
|
||||
}
|
||||
|
||||
builtin_type()
|
||||
@ -19,6 +21,7 @@ builtin_type()
|
||||
move_h_hpp BuiltInTypeAlias
|
||||
move_hpp NamespacedBuiltin1Alias
|
||||
move_hpp NamespacedBuiltin2Alias
|
||||
move_cpp BuiltinSerializable
|
||||
}
|
||||
|
||||
namespace()
|
||||
@ -28,5 +31,5 @@ namespace()
|
||||
move_h_hpp SimpleCType2Alias
|
||||
move_hpp NamespacedAliasTypeAlias
|
||||
move_hpp NamespacedAliasType2Alias
|
||||
move_cpp NamespaceSerializable
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef ATAliasAc_HPP
|
||||
#define ATAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef AliasAliasArrayAliasAc_HPP
|
||||
#define AliasAliasArrayAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "AliasArrayAliasAc.hpp"
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef AliasArrayAliasAc_HPP
|
||||
#define AliasArrayAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "AArrayAc.hpp"
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef AliasBoolAliasAc_HPP
|
||||
#define AliasBoolAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
//! Alias of a boolean
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef AliasEnumAliasAc_HPP
|
||||
#define AliasEnumAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "EEnumAc.hpp"
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef AliasPrim1AliasAc_HPP
|
||||
#define AliasPrim1AliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef AliasPrim2AliasAc_HPP
|
||||
#define AliasPrim2AliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef AliasStringAliasAc_HPP
|
||||
#define AliasStringAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/String.hpp"
|
||||
|
||||
//! Alias of a string
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef AliasStructAliasAc_HPP
|
||||
#define AliasStructAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
#include "SSerializableAc.hpp"
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef AnotherAliasStructAliasAc_HPP
|
||||
#define AnotherAliasStructAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
#include "StructWithAliasSerializableAc.hpp"
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef TAliasAliasAc_HPP
|
||||
#define TAliasAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
#include "T.hpp"
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#ifndef U16AliasAliasAc_HPP
|
||||
#define U16AliasAliasAc_HPP
|
||||
|
||||
#include <FpConfig.hpp>
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user