From 20219222fcd7fa6c3ba7ac4da220f0581e073193 Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Wed, 10 Apr 2024 08:09:35 -0700 Subject: [PATCH 01/12] Revise component code gen for data products --- .../ComponentCppWriter.scala | 1 + .../ComponentDataProducts.scala | 71 +++++++++++++------ ...veAsyncProductPortsOnlyComponentAc.ref.cpp | 1 + .../ActiveAsyncProductsComponentAc.ref.cpp | 24 +++++++ .../ActiveAsyncProductsComponentAc.ref.hpp | 7 ++ .../base/ActiveCommandsComponentAc.ref.cpp | 1 + .../base/ActiveEventsComponentAc.ref.cpp | 1 + .../base/ActiveGetProductsComponentAc.ref.cpp | 24 +++++++ .../base/ActiveGetProductsComponentAc.ref.hpp | 7 ++ .../ActiveGuardedProductsComponentAc.ref.cpp | 24 +++++++ .../ActiveGuardedProductsComponentAc.ref.hpp | 7 ++ .../ActiveNoArgsPortsOnlyComponentAc.ref.cpp | 1 + .../base/ActiveParamsComponentAc.ref.cpp | 1 + .../base/ActiveSerialComponentAc.ref.cpp | 1 + .../ActiveSyncProductsComponentAc.ref.cpp | 24 +++++++ .../ActiveSyncProductsComponentAc.ref.hpp | 7 ++ .../base/ActiveTelemetryComponentAc.ref.cpp | 1 + .../base/ActiveTestComponentAc.ref.cpp | 24 +++++++ .../base/ActiveTestComponentAc.ref.hpp | 7 ++ .../component/base/EmptyComponentAc.ref.cpp | 1 + .../base/PassiveCommandsComponentAc.ref.cpp | 1 + .../base/PassiveEventsComponentAc.ref.cpp | 1 + ...siveGetProductPortsOnlyComponentAc.ref.cpp | 1 + .../PassiveGetProductsComponentAc.ref.cpp | 24 +++++++ .../PassiveGetProductsComponentAc.ref.hpp | 7 ++ .../PassiveGuardedProductsComponentAc.ref.cpp | 24 +++++++ .../PassiveGuardedProductsComponentAc.ref.hpp | 7 ++ .../base/PassiveParamsComponentAc.ref.cpp | 1 + .../base/PassiveSerialComponentAc.ref.cpp | 1 + ...iveSyncProductPortsOnlyComponentAc.ref.cpp | 1 + .../PassiveSyncProductsComponentAc.ref.cpp | 24 +++++++ .../PassiveSyncProductsComponentAc.ref.hpp | 7 ++ .../base/PassiveTelemetryComponentAc.ref.cpp | 1 + .../base/PassiveTestComponentAc.ref.cpp | 24 +++++++ .../base/PassiveTestComponentAc.ref.hpp | 7 ++ ...edAsyncProductPortsOnlyComponentAc.ref.cpp | 1 + .../QueuedAsyncProductsComponentAc.ref.cpp | 24 +++++++ .../QueuedAsyncProductsComponentAc.ref.hpp | 7 ++ .../base/QueuedCommandsComponentAc.ref.cpp | 1 + .../base/QueuedEventsComponentAc.ref.cpp | 1 + .../base/QueuedGetProductsComponentAc.ref.cpp | 24 +++++++ .../base/QueuedGetProductsComponentAc.ref.hpp | 7 ++ .../QueuedGuardedProductsComponentAc.ref.cpp | 24 +++++++ .../QueuedGuardedProductsComponentAc.ref.hpp | 7 ++ .../QueuedNoArgsPortsOnlyComponentAc.ref.cpp | 1 + .../base/QueuedParamsComponentAc.ref.cpp | 1 + .../base/QueuedSerialComponentAc.ref.cpp | 1 + .../QueuedSyncProductsComponentAc.ref.cpp | 24 +++++++ .../QueuedSyncProductsComponentAc.ref.hpp | 7 ++ .../base/QueuedTelemetryComponentAc.ref.cpp | 1 + .../base/QueuedTestComponentAc.ref.cpp | 24 +++++++ .../base/QueuedTestComponentAc.ref.hpp | 7 ++ .../test/component/include/products.fppi | 3 + 53 files changed, 510 insertions(+), 21 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala index fca455f50..7b055d3a0 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala @@ -128,6 +128,7 @@ case class ComponentCppWriter ( ).map(CppWriter.systemHeaderString).map(line) val userHeaders = List( "Fw/Types/Assert.hpp", + "Fw/Types/ExternalString.hpp", "Fw/Types/String.hpp", s"${s.getRelativePath(fileName).toString}.hpp" ).sorted.map(CppWriter.headerString).flatMap({ diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala index 5e17cd7a3..330e12397 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala @@ -362,10 +362,56 @@ case class ComponentDataProducts ( ) private def singleRecordSerializeFn(name: String, t: Type) = { + // Get the type name val typeName = TypeCppWriter.getName(s, t) - val paramType = if (s.isPrimitive(t, typeName)) - typeName else s"const ${typeName}&" - val typeSize = s.getSerializedSizeExpr(t, typeName) + // Get the parameter type + val paramType = t match { + case Type.String(_) => "const Fw::StringBase&" + case _ => + if s.isPrimitive(t, typeName) + then typeName + else s"const ${typeName}&" + } + // Construct part 1 of the function body + val body1 = t match { + case ts: Type.String => + val stringSize = StringCppWriter(s).getSize(ts).toString + lines( + s"""|char esData[$stringSize]; + |Fw::ExternalString es(esData, sizeof esData, elt);""" + ) + case _ => Nil + } + // Get the serialized size + val serialSize = t match { + case Type.String(_) => "es.serializedSize()" + case _ => s.getSerializedSizeExpr(t, typeName) + } + // Get the variable holding the element to serialize + val serialElt = t match { + case Type.String(_) => "es" + case _ => "elt" + } + // Construct part 2 of the function body + val body2 = lines( + s"""|const FwSizeType sizeDelta = + | sizeof(FwDpIdType) + + | $serialSize; + |Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + |if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + | const FwDpIdType id = this->baseId + RecordId::$name; + | status = this->m_dataBuffer.serialize(id); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + | status = this->m_dataBuffer.serialize($serialElt); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + | this->m_dataSize += sizeDelta; + |} + |else { + | status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + |} + |return status;""" + ) + // Construct the function class member functionClassMember( Some(s"""|Serialize a $name record into the packet buffer |\\return The serialize status"""), @@ -378,24 +424,7 @@ case class ComponentDataProducts ( ) ), CppDoc.Type("Fw::SerializeStatus"), - lines( - s"""|const FwSizeType sizeDelta = - | sizeof(FwDpIdType) + - | $typeSize; - |Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - |if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { - | const FwDpIdType id = this->baseId + RecordId::$name; - | status = this->m_dataBuffer.serialize(id); - | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - | status = this->m_dataBuffer.serialize(elt); - | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - | this->m_dataSize += sizeDelta; - |} - |else { - | status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; - |} - |return status;""" - ) + List.concat(body1, body2) ) } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.cpp index fdb95289c..9c80b79cf 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp index 9ed591d2f..7f29ec5d9 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -144,6 +145,29 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.hpp index 88abc4054..fbdc101d0 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.hpp @@ -135,6 +135,7 @@ class ActiveAsyncProductsComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -170,6 +171,12 @@ class ActiveAsyncProductsComponentBase : const ActiveAsyncProducts_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.cpp index c27c0dc84..cb58824eb 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.cpp index 146c83958..94bcbb6be 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp index 442ecf3af..ef56310b8 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -142,6 +143,29 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.hpp index 48d0dc278..41713c16b 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.hpp @@ -133,6 +133,7 @@ class ActiveGetProductsComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -168,6 +169,12 @@ class ActiveGetProductsComponentBase : const ActiveGetProducts_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp index 9b776e79d..5bf029307 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -142,6 +143,29 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.hpp index bafda607f..59d46c802 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.hpp @@ -135,6 +135,7 @@ class ActiveGuardedProductsComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -170,6 +171,12 @@ class ActiveGuardedProductsComponentBase : const ActiveGuardedProducts_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveNoArgsPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveNoArgsPortsOnlyComponentAc.ref.cpp index c076b9a2d..5fedf7a04 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveNoArgsPortsOnlyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveNoArgsPortsOnlyComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.cpp index 4f21a2e20..ff28f3cae 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.cpp index 63defc6b1..0b9c85888 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp index 1f1ea0bab..4003bd475 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -142,6 +143,29 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.hpp index 9f882711e..eb65c84fc 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.hpp @@ -135,6 +135,7 @@ class ActiveSyncProductsComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -170,6 +171,12 @@ class ActiveSyncProductsComponentBase : const ActiveSyncProducts_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.cpp index 39b9b9913..2e4c30729 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp index 2158e4133..411ec5317 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -180,6 +181,29 @@ namespace M { return status; } + Fw::SerializeStatus ActiveTestComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) + { + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; + } + Fw::SerializeStatus ActiveTestComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp index 66ff2f3eb..807c7eb3c 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp @@ -222,6 +222,7 @@ namespace M { U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -257,6 +258,12 @@ namespace M { const M::ActiveTest_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/EmptyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/EmptyComponentAc.ref.cpp index bce5eaccf..9d9d7e8fa 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/EmptyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/EmptyComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.cpp index 4ce2fa09a..6e7231443 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.cpp index 62638dd08..3e2f0f5a3 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.cpp index 25deafa55..f5012859a 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp index 435fbdab8..b2dd88d87 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -87,6 +88,29 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.hpp index 04b470ef6..cace06a75 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.hpp @@ -128,6 +128,7 @@ class PassiveGetProductsComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -163,6 +164,12 @@ class PassiveGetProductsComponentBase : const PassiveGetProducts_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp index 747908856..52f499b0f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -87,6 +88,29 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.hpp index 5b535f980..d52e2d648 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.hpp @@ -130,6 +130,7 @@ class PassiveGuardedProductsComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -165,6 +166,12 @@ class PassiveGuardedProductsComponentBase : const PassiveGuardedProducts_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.cpp index 89b6c45e4..ada389c18 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.cpp index fe5bc3906..a96516278 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.cpp index 801860ba0..f73bf95de 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp index 8610afcd0..512753782 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -87,6 +88,29 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.hpp index 44ee457ac..68b77d7c5 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.hpp @@ -130,6 +130,7 @@ class PassiveSyncProductsComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -165,6 +166,12 @@ class PassiveSyncProductsComponentBase : const PassiveSyncProducts_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.cpp index 2c741db1f..393f43020 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp index 7d7f17184..a7d0c815f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -87,6 +88,29 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: return status; } +Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp index 4ff515b1b..e295c2b94 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp @@ -209,6 +209,7 @@ class PassiveTestComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -244,6 +245,12 @@ class PassiveTestComponentBase : const PassiveTest_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.cpp index b09b3d5f0..fc2a64ea0 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp index c3ebf697b..f985e570c 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -144,6 +145,29 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.hpp index a93b02b6c..763b245a7 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.hpp @@ -135,6 +135,7 @@ class QueuedAsyncProductsComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -170,6 +171,12 @@ class QueuedAsyncProductsComponentBase : const QueuedAsyncProducts_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.cpp index c5e9fff24..b6d6d2190 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.cpp index 53bc51d71..1ed24255f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp index 0038d5c33..0e64c2441 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -142,6 +143,29 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.hpp index 98938547d..ba7d34a10 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.hpp @@ -133,6 +133,7 @@ class QueuedGetProductsComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -168,6 +169,12 @@ class QueuedGetProductsComponentBase : const QueuedGetProducts_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp index 0d0f080fd..bd08f02b7 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -142,6 +143,29 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.hpp index 3a414c7e7..6a24eed39 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.hpp @@ -135,6 +135,7 @@ class QueuedGuardedProductsComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -170,6 +171,12 @@ class QueuedGuardedProductsComponentBase : const QueuedGuardedProducts_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedNoArgsPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedNoArgsPortsOnlyComponentAc.ref.cpp index 19296baf8..9e48b5bed 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedNoArgsPortsOnlyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedNoArgsPortsOnlyComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.cpp index 4b547482f..0e9cbf7ef 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.cpp index a8cdde73d..ad4bf2a51 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp index 5bd63091f..4a29fb0dd 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -142,6 +143,29 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.hpp index 0f8e4353a..3a6dbceb7 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.hpp @@ -135,6 +135,7 @@ class QueuedSyncProductsComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -170,6 +171,12 @@ class QueuedSyncProductsComponentBase : const QueuedSyncProducts_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.cpp index e688896be..7a35d090c 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp index 34078f840..4187b4aaa 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp @@ -7,6 +7,7 @@ #include #include "Fw/Types/Assert.hpp" +#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -178,6 +179,29 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: return status; } +Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: + serializeRecord_StringRecord(const Fw::StringBase& elt) +{ + char esData[80]; + Fw::ExternalString es(esData, sizeof esData, elt); + const FwSizeType sizeDelta = + sizeof(FwDpIdType) + + es.serializedSize(); + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serialize(es); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: serializeRecord_U32ArrayRecord( const U32* array, diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp index d8f6dd3e4..77ce4fcf3 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp @@ -220,6 +220,7 @@ class QueuedTestComponentBase : U8ArrayRecord = 300, U32ArrayRecord = 400, DataArrayRecord = 500, + StringRecord = 600, }; }; @@ -255,6 +256,12 @@ class QueuedTestComponentBase : const QueuedTest_Data& elt //!< The element ); + //! Serialize a StringRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringRecord( + const Fw::StringBase& elt //!< The element + ); + //! Serialize a U32ArrayRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_U32ArrayRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/include/products.fppi b/compiler/tools/fpp-to-cpp/test/component/include/products.fppi index 5dcb43819..e85cd08e7 100644 --- a/compiler/tools/fpp-to-cpp/test/component/include/products.fppi +++ b/compiler/tools/fpp-to-cpp/test/component/include/products.fppi @@ -27,6 +27,9 @@ product record U32ArrayRecord: U32 array id 400 @ Record 5 product record DataArrayRecord: Data array id 500 +@ Record 6 +product record StringRecord: string id 600 + # ---------------------------------------------------------------------- # Containers # ---------------------------------------------------------------------- From f634d54beaf351d49be0388e9af2567bfbc7b7f8 Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Wed, 10 Apr 2024 08:28:54 -0700 Subject: [PATCH 02/12] Refactor component data products --- .../ComponentCppWriter/ComponentDataProducts.scala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala index 330e12397..627f89c17 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala @@ -365,14 +365,19 @@ case class ComponentDataProducts ( // Get the type name val typeName = TypeCppWriter.getName(s, t) // Get the parameter type + // For strings this is a const reference to Fw::StringBase + // For primitive types it is the type name + // For othe types it is a const reference to the type name val paramType = t match { case Type.String(_) => "const Fw::StringBase&" case _ => if s.isPrimitive(t, typeName) then typeName - else s"const ${typeName}&" + else s"const $typeName&" } // Construct part 1 of the function body + // For strings this declares a string of the specified size + // For other types it is empty val body1 = t match { case ts: Type.String => val stringSize = StringCppWriter(s).getSize(ts).toString @@ -383,11 +388,15 @@ case class ComponentDataProducts ( case _ => Nil } // Get the serialized size + // For strings this is the serialized size of the data + // For other types it is the serialized size of the type val serialSize = t match { case Type.String(_) => "es.serializedSize()" case _ => s.getSerializedSizeExpr(t, typeName) } // Get the variable holding the element to serialize + // For strings this is the variable we declared above + // For other types it is the elt parameter to the function val serialElt = t match { case Type.String(_) => "es" case _ => "elt" From d7401ce5fac0d7db06a92309e2cde181938d80ee Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Wed, 10 Apr 2024 09:11:53 -0700 Subject: [PATCH 03/12] Revise code gen for data products --- .../ComponentDataProducts.scala | 109 ++++++++++++------ 1 file changed, 71 insertions(+), 38 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala index 627f89c17..9503bc254 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala @@ -438,10 +438,71 @@ case class ComponentDataProducts ( } private def arrayRecordSerializeFn(name: String, t: Type) = { + // Get the type name and parameter type val typeName = TypeCppWriter.getName(s, t) - val paramType = s"const ${typeName}*" - val eltSize = if (s.isPrimitive(t, typeName)) - s"sizeof($typeName)" else s"${typeName}::SERIALIZED_SIZE" + val paramType = t match { + case Type.String(_) => "const Fw::StringBase**" + case _ => s"const ${typeName}*" + } + // Generate the code for computing the size delta + val computeSizeDelta = (t match { + case Type.String(_) => + """|FwSizeType sizeDelta = 0; + |for (FwSizeType i = 0; i < size; i++) { + | Fw::StringBase *const sbPtr = array[i]; + | FW_ASSERT(sbPtr != nullptr); + | sizeDelta += sbPtr->serializedSize(); + |}""" + case _ => + val eltSize = if s.isPrimitive(t, typeName) + then s"sizeof($typeName)" + else s"${typeName}::SERIALIZED_SIZE" + s"""|const FwSizeType sizeDelta = + | sizeof(FwDpIdType) + + | sizeof(FwSizeStoreType) + + | size * $eltSize;""" + }).stripMargin + // Generate the code for serializing the elements + val serializeElts = (t match { + // Optimize the U8 case + case Type.U8 => + """| status = this->m_dataBuffer.serialize(array, size, Fw::Serialization::OMIT_LENGTH); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);""" + // Handle the string case + case Type.String(_) => + """| for (FwSizeType i = 0; i < size; i++) { + | Fw::StringBase *const sbPtr = array[i]; + | FW_ASSERT(sbPtr != nullptr); + | status = this->m_dataBuffer.serialize(*sbPtr); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + | }""" + // Handle the general case + case _ => + """| for (FwSizeType i = 0; i < size; i++) { + | status = this->m_dataBuffer.serialize(array[i]); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + | }""" + }).stripMargin + // Construct the function body + val body = lines( + s"""|FW_ASSERT(array != nullptr); + |$computeSizeDelta + |Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + |if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + | const FwDpIdType id = this->baseId + RecordId::$name; + | status = this->m_dataBuffer.serialize(id); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + | status = this->m_dataBuffer.serializeSize(size); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + |$serializeElts + | this->m_dataSize += sizeDelta; + |} + |else { + | status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + |} + |return status;""" + ) + // Construct the function class member functionClassMember( Some(s"""|Serialize a $name record into the packet buffer |\\return The serialize status"""), @@ -450,7 +511,12 @@ case class ComponentDataProducts ( CppDoc.Function.Param( CppDoc.Type(paramType), "array", - Some(s"An array of ${typeName} elements") + Some( + t match { + case Type.String(_) => "An array of pointers to StringBase objects" + case _ => s"An array of $typeName elements" + } + ) ), CppDoc.Function.Param( CppDoc.Type("FwSizeType"), @@ -459,40 +525,7 @@ case class ComponentDataProducts ( ) ), CppDoc.Type("Fw::SerializeStatus"), - { - val serializeElts = (t match { - // Optimize the U8 case - case Type.U8 => - """| status = this->m_dataBuffer.serialize(array, size, Fw::Serialization::OMIT_LENGTH); - | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);""" - case _ => - """| for (FwSizeType i = 0; i < size; i++) { - | status = this->m_dataBuffer.serialize(array[i]); - | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - | }""" - }).stripMargin - lines( - s"""|FW_ASSERT(array != nullptr); - |const FwSizeType sizeDelta = - | sizeof(FwDpIdType) + - | sizeof(FwSizeStoreType) + - | size * $eltSize; - |Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - |if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { - | const FwDpIdType id = this->baseId + RecordId::$name; - | status = this->m_dataBuffer.serialize(id); - | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - | status = this->m_dataBuffer.serializeSize(size); - | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - |$serializeElts - | this->m_dataSize += sizeDelta; - |} - |else { - | status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; - |} - |return status;""" - ) - } + body ) } From 071986f8b0ad8573dd12d389321a0431ebd340e1 Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Wed, 10 Apr 2024 09:20:03 -0700 Subject: [PATCH 04/12] Revise data product code gen and tests --- .../ComponentDataProducts.scala | 4 +-- .../ActiveAsyncProductsComponentAc.ref.cpp | 34 +++++++++++++++++++ .../ActiveAsyncProductsComponentAc.ref.hpp | 8 +++++ .../base/ActiveGetProductsComponentAc.ref.cpp | 34 +++++++++++++++++++ .../base/ActiveGetProductsComponentAc.ref.hpp | 8 +++++ .../ActiveGuardedProductsComponentAc.ref.cpp | 34 +++++++++++++++++++ .../ActiveGuardedProductsComponentAc.ref.hpp | 8 +++++ .../ActiveSyncProductsComponentAc.ref.cpp | 34 +++++++++++++++++++ .../ActiveSyncProductsComponentAc.ref.hpp | 8 +++++ .../base/ActiveTestComponentAc.ref.cpp | 34 +++++++++++++++++++ .../base/ActiveTestComponentAc.ref.hpp | 8 +++++ .../PassiveGetProductsComponentAc.ref.cpp | 34 +++++++++++++++++++ .../PassiveGetProductsComponentAc.ref.hpp | 8 +++++ .../PassiveGuardedProductsComponentAc.ref.cpp | 34 +++++++++++++++++++ .../PassiveGuardedProductsComponentAc.ref.hpp | 8 +++++ .../PassiveSyncProductsComponentAc.ref.cpp | 34 +++++++++++++++++++ .../PassiveSyncProductsComponentAc.ref.hpp | 8 +++++ .../base/PassiveTestComponentAc.ref.cpp | 34 +++++++++++++++++++ .../base/PassiveTestComponentAc.ref.hpp | 8 +++++ .../QueuedAsyncProductsComponentAc.ref.cpp | 34 +++++++++++++++++++ .../QueuedAsyncProductsComponentAc.ref.hpp | 8 +++++ .../base/QueuedGetProductsComponentAc.ref.cpp | 34 +++++++++++++++++++ .../base/QueuedGetProductsComponentAc.ref.hpp | 8 +++++ .../QueuedGuardedProductsComponentAc.ref.cpp | 34 +++++++++++++++++++ .../QueuedGuardedProductsComponentAc.ref.hpp | 8 +++++ .../QueuedSyncProductsComponentAc.ref.cpp | 34 +++++++++++++++++++ .../QueuedSyncProductsComponentAc.ref.hpp | 8 +++++ .../base/QueuedTestComponentAc.ref.cpp | 34 +++++++++++++++++++ .../base/QueuedTestComponentAc.ref.hpp | 8 +++++ .../test/component/include/products.fppi | 3 ++ 30 files changed, 593 insertions(+), 2 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala index 9503bc254..24e0e6d12 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala @@ -449,7 +449,7 @@ case class ComponentDataProducts ( case Type.String(_) => """|FwSizeType sizeDelta = 0; |for (FwSizeType i = 0; i < size; i++) { - | Fw::StringBase *const sbPtr = array[i]; + | const Fw::StringBase *const sbPtr = array[i]; | FW_ASSERT(sbPtr != nullptr); | sizeDelta += sbPtr->serializedSize(); |}""" @@ -471,7 +471,7 @@ case class ComponentDataProducts ( // Handle the string case case Type.String(_) => """| for (FwSizeType i = 0; i < size; i++) { - | Fw::StringBase *const sbPtr = array[i]; + | const Fw::StringBase *const sbPtr = array[i]; | FW_ASSERT(sbPtr != nullptr); | status = this->m_dataBuffer.serialize(*sbPtr); | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp index 7f29ec5d9..11e3b9f6e 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp @@ -145,6 +145,40 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.hpp index fbdc101d0..91dfc54f1 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.hpp @@ -136,6 +136,7 @@ class ActiveAsyncProductsComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -171,6 +172,13 @@ class ActiveAsyncProductsComponentBase : const ActiveAsyncProducts_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp index ef56310b8..c68c7042b 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp @@ -143,6 +143,40 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.hpp index 41713c16b..d8dac872e 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.hpp @@ -134,6 +134,7 @@ class ActiveGetProductsComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -169,6 +170,13 @@ class ActiveGetProductsComponentBase : const ActiveGetProducts_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp index 5bf029307..21dac5061 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp @@ -143,6 +143,40 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.hpp index 59d46c802..42d63dadd 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.hpp @@ -136,6 +136,7 @@ class ActiveGuardedProductsComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -171,6 +172,13 @@ class ActiveGuardedProductsComponentBase : const ActiveGuardedProducts_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp index 4003bd475..9a7f7422b 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp @@ -143,6 +143,40 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.hpp index eb65c84fc..1ad7ab700 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.hpp @@ -136,6 +136,7 @@ class ActiveSyncProductsComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -171,6 +172,13 @@ class ActiveSyncProductsComponentBase : const ActiveSyncProducts_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp index 411ec5317..ff0b5e5d4 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp @@ -181,6 +181,40 @@ namespace M { return status; } + Fw::SerializeStatus ActiveTestComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) + { + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; + } + Fw::SerializeStatus ActiveTestComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp index 807c7eb3c..9aaa6e2bf 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.hpp @@ -223,6 +223,7 @@ namespace M { U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -258,6 +259,13 @@ namespace M { const M::ActiveTest_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp index b2dd88d87..4b6376cdd 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp @@ -88,6 +88,40 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.hpp index cace06a75..282abea3c 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.hpp @@ -129,6 +129,7 @@ class PassiveGetProductsComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -164,6 +165,13 @@ class PassiveGetProductsComponentBase : const PassiveGetProducts_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp index 52f499b0f..5db7fbbf0 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp @@ -88,6 +88,40 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.hpp index d52e2d648..ddfc14118 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.hpp @@ -131,6 +131,7 @@ class PassiveGuardedProductsComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -166,6 +167,13 @@ class PassiveGuardedProductsComponentBase : const PassiveGuardedProducts_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp index 512753782..77a9971ba 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp @@ -88,6 +88,40 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.hpp index 68b77d7c5..683c7c010 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.hpp @@ -131,6 +131,7 @@ class PassiveSyncProductsComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -166,6 +167,13 @@ class PassiveSyncProductsComponentBase : const PassiveSyncProducts_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp index a7d0c815f..906dde262 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp @@ -88,6 +88,40 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: return status; } +Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp index e295c2b94..f804186e0 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.hpp @@ -210,6 +210,7 @@ class PassiveTestComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -245,6 +246,13 @@ class PassiveTestComponentBase : const PassiveTest_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp index f985e570c..3d31b5195 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp @@ -145,6 +145,40 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.hpp index 763b245a7..c524ce732 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.hpp @@ -136,6 +136,7 @@ class QueuedAsyncProductsComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -171,6 +172,13 @@ class QueuedAsyncProductsComponentBase : const QueuedAsyncProducts_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp index 0e64c2441..9495e6c50 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp @@ -143,6 +143,40 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.hpp index ba7d34a10..fa6e80f57 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.hpp @@ -134,6 +134,7 @@ class QueuedGetProductsComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -169,6 +170,13 @@ class QueuedGetProductsComponentBase : const QueuedGetProducts_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp index bd08f02b7..89f5fa462 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp @@ -143,6 +143,40 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.hpp index 6a24eed39..f2fed5842 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.hpp @@ -136,6 +136,7 @@ class QueuedGuardedProductsComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -171,6 +172,13 @@ class QueuedGuardedProductsComponentBase : const QueuedGuardedProducts_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp index 4a29fb0dd..e3e32d730 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp @@ -143,6 +143,40 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: return status; } +Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.hpp index 3a6dbceb7..b3594df01 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.hpp @@ -136,6 +136,7 @@ class QueuedSyncProductsComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -171,6 +172,13 @@ class QueuedSyncProductsComponentBase : const QueuedSyncProducts_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp index 4187b4aaa..99aa92355 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp @@ -179,6 +179,40 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: return status; } +Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: + serializeRecord_StringArrayRecord( + const Fw::StringBase** array, + FwSizeType size + ) +{ + FW_ASSERT(array != nullptr); + FwSizeType sizeDelta = 0; + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + sizeDelta += sbPtr->serializedSize(); + } + Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; + if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; + status = this->m_dataBuffer.serialize(id); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + status = this->m_dataBuffer.serializeSize(size); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + for (FwSizeType i = 0; i < size; i++) { + const Fw::StringBase *const sbPtr = array[i]; + FW_ASSERT(sbPtr != nullptr); + status = this->m_dataBuffer.serialize(*sbPtr); + FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + } + this->m_dataSize += sizeDelta; + } + else { + status = Fw::FW_SERIALIZE_NO_ROOM_LEFT; + } + return status; +} + Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp index 77ce4fcf3..e2a9e0314 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.hpp @@ -221,6 +221,7 @@ class QueuedTestComponentBase : U32ArrayRecord = 400, DataArrayRecord = 500, StringRecord = 600, + StringArrayRecord = 700, }; }; @@ -256,6 +257,13 @@ class QueuedTestComponentBase : const QueuedTest_Data& elt //!< The element ); + //! Serialize a StringArrayRecord record into the packet buffer + //! \return The serialize status + Fw::SerializeStatus serializeRecord_StringArrayRecord( + const Fw::StringBase** array, //!< An array of pointers to StringBase objects + FwSizeType size //!< The array size + ); + //! Serialize a StringRecord record into the packet buffer //! \return The serialize status Fw::SerializeStatus serializeRecord_StringRecord( diff --git a/compiler/tools/fpp-to-cpp/test/component/include/products.fppi b/compiler/tools/fpp-to-cpp/test/component/include/products.fppi index e85cd08e7..72b42e786 100644 --- a/compiler/tools/fpp-to-cpp/test/component/include/products.fppi +++ b/compiler/tools/fpp-to-cpp/test/component/include/products.fppi @@ -30,6 +30,9 @@ product record DataArrayRecord: Data array id 500 @ Record 6 product record StringRecord: string id 600 +@ Record 7 +product record StringArrayRecord: string array id 700 + # ---------------------------------------------------------------------- # Containers # ---------------------------------------------------------------------- From 05686b2c892f21642e940af4891453936de01aaf Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Wed, 10 Apr 2024 17:04:09 -0700 Subject: [PATCH 05/12] Fix typo in spec --- docs/fpp-spec.html | 4 ++-- docs/fpp-users-guide.html | 2 +- docs/spec/Types.adoc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/fpp-spec.html b/docs/fpp-spec.html index 933b77c1a..0a47d9f6f 100644 --- a/docs/fpp-spec.html +++ b/docs/fpp-spec.html @@ -7154,7 +7154,7 @@

16.6. String Types

The string types correspond to the string type names. A string type is written string or string size n, -where n is an integer value in the range [0,231]. +where n is an integer value in the range [1,231]. There is one string type string and one string type string n for each legal value of n.

@@ -8494,7 +8494,7 @@

20.4. Translation Tools

diff --git a/docs/fpp-users-guide.html b/docs/fpp-users-guide.html index e830482fd..b0d07bcc4 100644 --- a/docs/fpp-users-guide.html +++ b/docs/fpp-users-guide.html @@ -11729,7 +11729,7 @@

diff --git a/docs/spec/Types.adoc b/docs/spec/Types.adoc index 46ff12fea..cdeadd5b8 100644 --- a/docs/spec/Types.adoc +++ b/docs/spec/Types.adoc @@ -36,7 +36,7 @@ are called the *primitive types*. The *string types* correspond to the <>. A string type is written `string` or `string size` _n_, -where _n_ is an integer value in the range [0,2^31^]. +where _n_ is an integer value in the range [1,2^31^]. There is one string type `string` and one string type `string` _n_ for each legal value of _n_. From 7d4bc728c751002eae87611eeb36933646f0aead Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Wed, 10 Apr 2024 17:05:38 -0700 Subject: [PATCH 06/12] Fix typo in spec --- docs/spec/Types.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/spec/Types.adoc b/docs/spec/Types.adoc index cdeadd5b8..69cd8c620 100644 --- a/docs/spec/Types.adoc +++ b/docs/spec/Types.adoc @@ -36,7 +36,7 @@ are called the *primitive types*. The *string types* correspond to the <>. A string type is written `string` or `string size` _n_, -where _n_ is an integer value in the range [1,2^31^]. +where _n_ is an integer value in the range [1,2^31-1]. There is one string type `string` and one string type `string` _n_ for each legal value of _n_. From bb7ed8606df23c96c865d7ed72ef8b7b2d6a73ae Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Thu, 11 Apr 2024 15:11:51 -0700 Subject: [PATCH 07/12] Revise code gen for string records --- .../ComponentCppWriter.scala | 1 - .../ComponentDataProducts.scala | 73 ++++++++++--------- ...veAsyncProductPortsOnlyComponentAc.ref.cpp | 1 - .../ActiveAsyncProductsComponentAc.ref.cpp | 19 +++-- .../base/ActiveCommandsComponentAc.ref.cpp | 1 - .../base/ActiveEventsComponentAc.ref.cpp | 1 - .../base/ActiveGetProductsComponentAc.ref.cpp | 19 +++-- .../ActiveGuardedProductsComponentAc.ref.cpp | 19 +++-- .../ActiveNoArgsPortsOnlyComponentAc.ref.cpp | 1 - .../base/ActiveParamsComponentAc.ref.cpp | 1 - .../base/ActiveSerialComponentAc.ref.cpp | 1 - .../ActiveSyncProductsComponentAc.ref.cpp | 19 +++-- .../base/ActiveTelemetryComponentAc.ref.cpp | 1 - .../base/ActiveTestComponentAc.ref.cpp | 19 +++-- .../component/base/EmptyComponentAc.ref.cpp | 1 - .../base/PassiveCommandsComponentAc.ref.cpp | 1 - .../base/PassiveEventsComponentAc.ref.cpp | 1 - ...siveGetProductPortsOnlyComponentAc.ref.cpp | 1 - .../PassiveGetProductsComponentAc.ref.cpp | 19 +++-- .../PassiveGuardedProductsComponentAc.ref.cpp | 19 +++-- .../base/PassiveParamsComponentAc.ref.cpp | 1 - .../base/PassiveSerialComponentAc.ref.cpp | 1 - ...iveSyncProductPortsOnlyComponentAc.ref.cpp | 1 - .../PassiveSyncProductsComponentAc.ref.cpp | 19 +++-- .../base/PassiveTelemetryComponentAc.ref.cpp | 1 - .../base/PassiveTestComponentAc.ref.cpp | 19 +++-- ...edAsyncProductPortsOnlyComponentAc.ref.cpp | 1 - .../QueuedAsyncProductsComponentAc.ref.cpp | 19 +++-- .../base/QueuedCommandsComponentAc.ref.cpp | 1 - .../base/QueuedEventsComponentAc.ref.cpp | 1 - .../base/QueuedGetProductsComponentAc.ref.cpp | 19 +++-- .../QueuedGuardedProductsComponentAc.ref.cpp | 19 +++-- .../QueuedNoArgsPortsOnlyComponentAc.ref.cpp | 1 - .../base/QueuedParamsComponentAc.ref.cpp | 1 - .../base/QueuedSerialComponentAc.ref.cpp | 1 - .../QueuedSyncProductsComponentAc.ref.cpp | 19 +++-- .../base/QueuedTelemetryComponentAc.ref.cpp | 1 - .../base/QueuedTestComponentAc.ref.cpp | 19 +++-- 38 files changed, 205 insertions(+), 157 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala index 7b055d3a0..fca455f50 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala @@ -128,7 +128,6 @@ case class ComponentCppWriter ( ).map(CppWriter.systemHeaderString).map(line) val userHeaders = List( "Fw/Types/Assert.hpp", - "Fw/Types/ExternalString.hpp", "Fw/Types/String.hpp", s"${s.getRelativePath(fileName).toString}.hpp" ).sorted.map(CppWriter.headerString).flatMap({ diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala index f7bc24501..2afc7a07e 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala @@ -386,34 +386,28 @@ case class ComponentDataProducts ( then typeName else s"const $typeName&" } - // Construct part 1 of the function body - // For strings this declares a string of the specified size - // For other types it is empty - val body1 = t match { - case ts: Type.String => - val stringSize = StringCppWriter(s).getSize(ts).toString - lines( - s"""|char esData[$stringSize]; - |Fw::ExternalString es(esData, sizeof esData, elt);""" - ) - case _ => Nil + // Get the string size, if any + val stringSize = t match { + case ts: Type.String => StringCppWriter(s).getSize(ts).toString + case _ => "0" } // Get the serialized size // For strings this is the serialized size of the data // For other types it is the serialized size of the type val serialSize = t match { - case Type.String(_) => "es.serializedSize()" + case ts: Type.String => + s"elt.serializedTruncatedSize($stringSize)" case _ => s.getSerializedSizeExpr(t, typeName) } - // Get the variable holding the element to serialize - // For strings this is the variable we declared above - // For other types it is the elt parameter to the function - val serialElt = t match { - case Type.String(_) => "es" - case _ => "elt" + // Get the expression that does the serialization + // For strings this is a truncated serialization + val serialExpr = t match { + case ts: Type.String => + s"elt.serialize(this->m_dataBuffer, $stringSize)" + case _ => "this->m_dataBuffer.serialize(elt)" } - // Construct part 2 of the function body - val body2 = lines( + // Construct the function body + val body = lines( s"""|const FwSizeType sizeDelta = | sizeof(FwDpIdType) + | $serialSize; @@ -422,7 +416,7 @@ case class ComponentDataProducts ( | const FwDpIdType id = this->baseId + RecordId::$name; | status = this->m_dataBuffer.serialize(id); | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - | status = this->m_dataBuffer.serialize($serialElt); + | status = $serialExpr; | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); | this->m_dataSize += sizeDelta; |} @@ -444,7 +438,7 @@ case class ComponentDataProducts ( ) ), CppDoc.Type("Fw::SerializeStatus"), - List.concat(body1, body2) + body ) } @@ -455,15 +449,20 @@ case class ComponentDataProducts ( case Type.String(_) => "const Fw::StringBase**" case _ => s"const ${typeName}*" } + // Get the string size, if any + val stringSize = t match { + case ts: Type.String => StringCppWriter(s).getSize(ts).toString + case _ => "0" + } // Generate the code for computing the size delta val computeSizeDelta = (t match { - case Type.String(_) => - """|FwSizeType sizeDelta = 0; - |for (FwSizeType i = 0; i < size; i++) { - | const Fw::StringBase *const sbPtr = array[i]; - | FW_ASSERT(sbPtr != nullptr); - | sizeDelta += sbPtr->serializedSize(); - |}""" + case ts: Type.String => + s"""|FwSizeType sizeDelta = 0; + |for (FwSizeType i = 0; i < size; i++) { + | const Fw::StringBase *const sbPtr = array[i]; + | FW_ASSERT(sbPtr != nullptr); + | sizeDelta += sbPtr->serializedTruncatedSize($stringSize); + |}""" case _ => val eltSize = if s.isPrimitive(t, typeName) then s"sizeof($typeName)" @@ -480,13 +479,13 @@ case class ComponentDataProducts ( """| status = this->m_dataBuffer.serialize(array, size, Fw::Serialization::OMIT_LENGTH); | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);""" // Handle the string case - case Type.String(_) => - """| for (FwSizeType i = 0; i < size; i++) { - | const Fw::StringBase *const sbPtr = array[i]; - | FW_ASSERT(sbPtr != nullptr); - | status = this->m_dataBuffer.serialize(*sbPtr); - | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - | }""" + case ts: Type.String => + s"""| for (FwSizeType i = 0; i < size; i++) { + | const Fw::StringBase *const sbPtr = array[i]; + | FW_ASSERT(sbPtr != nullptr); + | status = sbPtr->serialize(this->m_dataBuffer, $stringSize); + | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); + | }""" // Handle the general case case _ => """| for (FwSizeType i = 0; i < size; i++) { @@ -497,7 +496,9 @@ case class ComponentDataProducts ( // Construct the function body val body = lines( s"""|FW_ASSERT(array != nullptr); + |// Compute the size delta |$computeSizeDelta + |// Serialize the elements if they will fit |Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; |if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { | const FwDpIdType id = this->baseId + RecordId::$name; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.cpp index 9c80b79cf..fdb95289c 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductPortsOnlyComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp index 11e3b9f6e..161189b0f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -101,10 +100,12 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * ActiveAsyncProducts_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -152,12 +153,14 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -168,7 +171,7 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -182,17 +185,15 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -209,10 +210,12 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -260,10 +263,12 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.cpp index cb58824eb..c27c0dc84 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveCommandsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.cpp index 94bcbb6be..146c83958 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveEventsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp index f30dc31fa..c578d55b5 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -99,10 +98,12 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * ActiveGetProducts_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -150,12 +151,14 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -166,7 +169,7 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -180,17 +183,15 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -207,10 +208,12 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -258,10 +261,12 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp index 21dac5061..f9082aaff 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -99,10 +98,12 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * ActiveGuardedProducts_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -150,12 +151,14 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -166,7 +169,7 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -180,17 +183,15 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -207,10 +208,12 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -258,10 +261,12 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveNoArgsPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveNoArgsPortsOnlyComponentAc.ref.cpp index 5fedf7a04..c076b9a2d 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveNoArgsPortsOnlyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveNoArgsPortsOnlyComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.cpp index ff28f3cae..4f21a2e20 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveParamsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.cpp index 0b9c85888..63defc6b1 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSerialComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp index 9a7f7422b..a87359996 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -99,10 +98,12 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * ActiveSyncProducts_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -150,12 +151,14 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -166,7 +169,7 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -180,17 +183,15 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -207,10 +208,12 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -258,10 +261,12 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.cpp index 2e4c30729..39b9b9913 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTelemetryComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp index ff0b5e5d4..b262e2b27 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -137,10 +136,12 @@ namespace M { ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * M::ActiveTest_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -188,12 +189,14 @@ namespace M { ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -204,7 +207,7 @@ namespace M { for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -218,17 +221,15 @@ namespace M { Fw::SerializeStatus ActiveTestComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -245,10 +246,12 @@ namespace M { ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -296,10 +299,12 @@ namespace M { ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/EmptyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/EmptyComponentAc.ref.cpp index 9d9d7e8fa..bce5eaccf 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/EmptyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/EmptyComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.cpp index 6e7231443..4ce2fa09a 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveCommandsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.cpp index 3e2f0f5a3..62638dd08 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveEventsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.cpp index f5012859a..25deafa55 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductPortsOnlyComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp index 5c744c76b..9d31429e9 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -44,10 +43,12 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * PassiveGetProducts_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -95,12 +96,14 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -111,7 +114,7 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -125,17 +128,15 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -152,10 +153,12 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -203,10 +206,12 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp index 5db7fbbf0..2ac4ed807 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -44,10 +43,12 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * PassiveGuardedProducts_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -95,12 +96,14 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -111,7 +114,7 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -125,17 +128,15 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -152,10 +153,12 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -203,10 +206,12 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.cpp index ada389c18..89b6c45e4 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveParamsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.cpp index a96516278..fe5bc3906 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSerialComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.cpp index f73bf95de..801860ba0 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductPortsOnlyComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp index 77a9971ba..ac2d897dc 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -44,10 +43,12 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * PassiveSyncProducts_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -95,12 +96,14 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -111,7 +114,7 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -125,17 +128,15 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -152,10 +153,12 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -203,10 +206,12 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.cpp index 393f43020..2c741db1f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTelemetryComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp index 906dde262..4534ea510 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -44,10 +43,12 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * PassiveTest_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -95,12 +96,14 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -111,7 +114,7 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -125,17 +128,15 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -152,10 +153,12 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -203,10 +206,12 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.cpp index fc2a64ea0..b09b3d5f0 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductPortsOnlyComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp index 3d31b5195..079ada984 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -101,10 +100,12 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * QueuedAsyncProducts_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -152,12 +153,14 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -168,7 +171,7 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -182,17 +185,15 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -209,10 +210,12 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -260,10 +263,12 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.cpp index b6d6d2190..c5e9fff24 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedCommandsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.cpp index 1ed24255f..53bc51d71 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedEventsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp index d8cdfccd6..d76b8bd9b 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -99,10 +98,12 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * QueuedGetProducts_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -150,12 +151,14 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -166,7 +169,7 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -180,17 +183,15 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -207,10 +208,12 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -258,10 +261,12 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp index 89f5fa462..6feefff50 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -99,10 +98,12 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * QueuedGuardedProducts_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -150,12 +151,14 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -166,7 +169,7 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -180,17 +183,15 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -207,10 +208,12 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -258,10 +261,12 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedNoArgsPortsOnlyComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedNoArgsPortsOnlyComponentAc.ref.cpp index 9e48b5bed..19296baf8 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedNoArgsPortsOnlyComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedNoArgsPortsOnlyComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.cpp index 0e9cbf7ef..4b547482f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedParamsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.cpp index ad4bf2a51..a8cdde73d 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSerialComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp index e3e32d730..ed88a0994 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -99,10 +98,12 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * QueuedSyncProducts_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -150,12 +151,14 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -166,7 +169,7 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -180,17 +183,15 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -207,10 +208,12 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -258,10 +261,12 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.cpp index 7a35d090c..e688896be 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTelemetryComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp index 99aa92355..5a428eec9 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp @@ -7,7 +7,6 @@ #include #include "Fw/Types/Assert.hpp" -#include "Fw/Types/ExternalString.hpp" #if FW_ENABLE_TEXT_LOGGING #include "Fw/Types/String.hpp" #endif @@ -135,10 +134,12 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * QueuedTest_Data::SERIALIZED_SIZE; + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; @@ -186,12 +187,14 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedSize(); + sizeDelta += sbPtr->serializedTruncatedSize(80); } + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; @@ -202,7 +205,7 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = this->m_dataBuffer.serialize(*sbPtr); + status = sbPtr->serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; @@ -216,17 +219,15 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { - char esData[80]; - Fw::ExternalString es(esData, sizeof esData, elt); const FwSizeType sizeDelta = sizeof(FwDpIdType) + - es.serializedSize(); + elt.serializedTruncatedSize(80); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = this->m_dataBuffer.serialize(es); + status = elt.serialize(this->m_dataBuffer, 80); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } @@ -243,10 +244,12 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U32); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; @@ -294,10 +297,12 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: ) { FW_ASSERT(array != nullptr); + // Compute the size delta const FwSizeType sizeDelta = sizeof(FwDpIdType) + sizeof(FwSizeStoreType) + size * sizeof(U8); + // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; From 5cdf3e8851d13c5f023b355457cf37ddf7dae37b Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Thu, 11 Apr 2024 15:55:30 -0700 Subject: [PATCH 08/12] Revise code gen for string records --- .../ComponentDataProducts.scala | 31 +++++++++---------- .../ActiveAsyncProductsComponentAc.ref.cpp | 5 +-- .../base/ActiveGetProductsComponentAc.ref.cpp | 5 +-- .../ActiveGuardedProductsComponentAc.ref.cpp | 5 +-- .../ActiveSyncProductsComponentAc.ref.cpp | 5 +-- .../base/ActiveTestComponentAc.ref.cpp | 5 +-- .../PassiveGetProductsComponentAc.ref.cpp | 5 +-- .../PassiveGuardedProductsComponentAc.ref.cpp | 5 +-- .../PassiveSyncProductsComponentAc.ref.cpp | 5 +-- .../base/PassiveTestComponentAc.ref.cpp | 5 +-- .../QueuedAsyncProductsComponentAc.ref.cpp | 5 +-- .../base/QueuedGetProductsComponentAc.ref.cpp | 5 +-- .../QueuedGuardedProductsComponentAc.ref.cpp | 5 +-- .../QueuedSyncProductsComponentAc.ref.cpp | 5 +-- .../base/QueuedTestComponentAc.ref.cpp | 5 +-- 15 files changed, 57 insertions(+), 44 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala index 2afc7a07e..5415706c0 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala @@ -386,31 +386,30 @@ case class ComponentDataProducts ( then typeName else s"const $typeName&" } - // Get the string size, if any - val stringSize = t match { - case ts: Type.String => StringCppWriter(s).getSize(ts).toString - case _ => "0" - } - // Get the serialized size - // For strings this is the serialized size of the data - // For other types it is the serialized size of the type - val serialSize = t match { + // Generate the code for computing the size delta + val computeSizeDelta = (t match { case ts: Type.String => - s"elt.serializedTruncatedSize($stringSize)" - case _ => s.getSerializedSizeExpr(t, typeName) - } + val stringSize = StringCppWriter(s).getSize(ts).toString + s"""|const FwSizeType stringSize = $stringSize; + |const FwSizeType sizeDelta = + | sizeof(FwDpIdType) + + | elt.serializedTruncatedSize(stringSize);""" + case _ => + val serialSize = s.getSerializedSizeExpr(t, typeName) + s"""|const FwSizeType sizeDelta = + | sizeof(FwDpIdType) + + | $serialSize;""" + }).stripMargin // Get the expression that does the serialization // For strings this is a truncated serialization val serialExpr = t match { case ts: Type.String => - s"elt.serialize(this->m_dataBuffer, $stringSize)" + "elt.serialize(this->m_dataBuffer, stringSize)" case _ => "this->m_dataBuffer.serialize(elt)" } // Construct the function body val body = lines( - s"""|const FwSizeType sizeDelta = - | sizeof(FwDpIdType) + - | $serialSize; + s"""|$computeSizeDelta |Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; |if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { | const FwDpIdType id = this->baseId + RecordId::$name; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp index 161189b0f..1cf685ae5 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp @@ -185,15 +185,16 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp index c578d55b5..7e8d62ca3 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp @@ -183,15 +183,16 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp index f9082aaff..882af73c9 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp @@ -183,15 +183,16 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp index a87359996..179e6da6f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp @@ -183,15 +183,16 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp index b262e2b27..d9777a194 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp @@ -221,15 +221,16 @@ namespace M { Fw::SerializeStatus ActiveTestComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp index 9d31429e9..f52df71ec 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp @@ -128,15 +128,16 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp index 2ac4ed807..9ca5ba319 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp @@ -128,15 +128,16 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp index ac2d897dc..cec245b11 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp @@ -128,15 +128,16 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp index 4534ea510..bb13f05e0 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp @@ -128,15 +128,16 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp index 079ada984..11df811b3 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp @@ -185,15 +185,16 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp index d76b8bd9b..73f064d64 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp @@ -183,15 +183,16 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp index 6feefff50..513f1f7b6 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp @@ -183,15 +183,16 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp index ed88a0994..8b3112314 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp @@ -183,15 +183,16 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp index 5a428eec9..1f0c9db51 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp @@ -219,15 +219,16 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: serializeRecord_StringRecord(const Fw::StringBase& elt) { + const FwSizeType stringSize = 80; const FwSizeType sizeDelta = sizeof(FwDpIdType) + - elt.serializedTruncatedSize(80); + elt.serializedTruncatedSize(stringSize); Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); - status = elt.serialize(this->m_dataBuffer, 80); + status = elt.serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); this->m_dataSize += sizeDelta; } From 5d35098a9a3ea4884353587b395106c7dffcf525 Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Thu, 11 Apr 2024 16:04:03 -0700 Subject: [PATCH 09/12] Revise dp code gen for string records --- .../ComponentCppWriter/ComponentDataProducts.scala | 13 +++++-------- .../base/ActiveAsyncProductsComponentAc.ref.cpp | 5 +++-- .../base/ActiveGetProductsComponentAc.ref.cpp | 5 +++-- .../base/ActiveGuardedProductsComponentAc.ref.cpp | 5 +++-- .../base/ActiveSyncProductsComponentAc.ref.cpp | 5 +++-- .../component/base/ActiveTestComponentAc.ref.cpp | 5 +++-- .../base/PassiveGetProductsComponentAc.ref.cpp | 5 +++-- .../base/PassiveGuardedProductsComponentAc.ref.cpp | 5 +++-- .../base/PassiveSyncProductsComponentAc.ref.cpp | 5 +++-- .../component/base/PassiveTestComponentAc.ref.cpp | 5 +++-- .../base/QueuedAsyncProductsComponentAc.ref.cpp | 5 +++-- .../base/QueuedGetProductsComponentAc.ref.cpp | 5 +++-- .../base/QueuedGuardedProductsComponentAc.ref.cpp | 5 +++-- .../base/QueuedSyncProductsComponentAc.ref.cpp | 5 +++-- .../component/base/QueuedTestComponentAc.ref.cpp | 5 +++-- 15 files changed, 47 insertions(+), 36 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala index 5415706c0..c4cbb564c 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala @@ -448,19 +448,16 @@ case class ComponentDataProducts ( case Type.String(_) => "const Fw::StringBase**" case _ => s"const ${typeName}*" } - // Get the string size, if any - val stringSize = t match { - case ts: Type.String => StringCppWriter(s).getSize(ts).toString - case _ => "0" - } // Generate the code for computing the size delta val computeSizeDelta = (t match { case ts: Type.String => - s"""|FwSizeType sizeDelta = 0; + val stringSize = StringCppWriter(s).getSize(ts).toString + s"""|const FwSizeType stringSize = $stringSize; + |FwSizeType sizeDelta = 0; |for (FwSizeType i = 0; i < size; i++) { | const Fw::StringBase *const sbPtr = array[i]; | FW_ASSERT(sbPtr != nullptr); - | sizeDelta += sbPtr->serializedTruncatedSize($stringSize); + | sizeDelta += sbPtr->serializedTruncatedSize(stringSize); |}""" case _ => val eltSize = if s.isPrimitive(t, typeName) @@ -482,7 +479,7 @@ case class ComponentDataProducts ( s"""| for (FwSizeType i = 0; i < size; i++) { | const Fw::StringBase *const sbPtr = array[i]; | FW_ASSERT(sbPtr != nullptr); - | status = sbPtr->serialize(this->m_dataBuffer, $stringSize); + | status = sbPtr->serialize(this->m_dataBuffer, stringSize); | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); | }""" // Handle the general case diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp index 1cf685ae5..5a741184e 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp @@ -154,11 +154,12 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -171,7 +172,7 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp index 7e8d62ca3..e780f4c12 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp @@ -152,11 +152,12 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -169,7 +170,7 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp index 882af73c9..3066f8e4e 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp @@ -152,11 +152,12 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -169,7 +170,7 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp index 179e6da6f..f2538bba1 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp @@ -152,11 +152,12 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -169,7 +170,7 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp index d9777a194..154de9db0 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp @@ -190,11 +190,12 @@ namespace M { { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -207,7 +208,7 @@ namespace M { for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp index f52df71ec..834205e9f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp @@ -97,11 +97,12 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -114,7 +115,7 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp index 9ca5ba319..26ed7afce 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp @@ -97,11 +97,12 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -114,7 +115,7 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp index cec245b11..b6becbea2 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp @@ -97,11 +97,12 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -114,7 +115,7 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp index bb13f05e0..3fed95f86 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp @@ -97,11 +97,12 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -114,7 +115,7 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp index 11df811b3..651a7f76d 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp @@ -154,11 +154,12 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -171,7 +172,7 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp index 73f064d64..159d4cc52 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp @@ -152,11 +152,12 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -169,7 +170,7 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp index 513f1f7b6..43570613f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp @@ -152,11 +152,12 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -169,7 +170,7 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp index 8b3112314..aa498a1db 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp @@ -152,11 +152,12 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -169,7 +170,7 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp index 1f0c9db51..cafdea0cf 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp @@ -188,11 +188,12 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: { FW_ASSERT(array != nullptr); // Compute the size delta + const FwSizeType stringSize = 80; FwSizeType sizeDelta = 0; for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - sizeDelta += sbPtr->serializedTruncatedSize(80); + sizeDelta += sbPtr->serializedTruncatedSize(stringSize); } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; @@ -205,7 +206,7 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); - status = sbPtr->serialize(this->m_dataBuffer, 80); + status = sbPtr->serialize(this->m_dataBuffer, stringSize); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); } this->m_dataSize += sizeDelta; From 80f3082dc4d4ad0d1ec3976186b62f98a0ce0389 Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Thu, 11 Apr 2024 18:18:12 -0700 Subject: [PATCH 10/12] Revise code gen for string array records --- .../CppWriter/ComponentCppWriter/ComponentDataProducts.scala | 4 +++- .../component/base/ActiveAsyncProductsComponentAc.ref.cpp | 4 +++- .../test/component/base/ActiveGetProductsComponentAc.ref.cpp | 4 +++- .../component/base/ActiveGuardedProductsComponentAc.ref.cpp | 4 +++- .../test/component/base/ActiveSyncProductsComponentAc.ref.cpp | 4 +++- .../test/component/base/ActiveTestComponentAc.ref.cpp | 4 +++- .../test/component/base/PassiveGetProductsComponentAc.ref.cpp | 4 +++- .../component/base/PassiveGuardedProductsComponentAc.ref.cpp | 4 +++- .../component/base/PassiveSyncProductsComponentAc.ref.cpp | 4 +++- .../test/component/base/PassiveTestComponentAc.ref.cpp | 4 +++- .../component/base/QueuedAsyncProductsComponentAc.ref.cpp | 4 +++- .../test/component/base/QueuedGetProductsComponentAc.ref.cpp | 4 +++- .../component/base/QueuedGuardedProductsComponentAc.ref.cpp | 4 +++- .../test/component/base/QueuedSyncProductsComponentAc.ref.cpp | 4 +++- .../test/component/base/QueuedTestComponentAc.ref.cpp | 4 +++- 15 files changed, 45 insertions(+), 15 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala index c4cbb564c..3fb2a7118 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala @@ -453,7 +453,9 @@ case class ComponentDataProducts ( case ts: Type.String => val stringSize = StringCppWriter(s).getSize(ts).toString s"""|const FwSizeType stringSize = $stringSize; - |FwSizeType sizeDelta = 0; + |FwSizeType sizeDelta = + | sizeof(FwDpIdType) + + | sizeof(FwSizeStoreType); |for (FwSizeType i = 0; i < size; i++) { | const Fw::StringBase *const sbPtr = array[i]; | FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp index 5a741184e..946401856 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp @@ -155,7 +155,9 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp index e780f4c12..1529c3b34 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp @@ -153,7 +153,9 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp index 3066f8e4e..4a4c8624f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp @@ -153,7 +153,9 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp index f2538bba1..cb287eca3 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp @@ -153,7 +153,9 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp index 154de9db0..a97f603a1 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp @@ -191,7 +191,9 @@ namespace M { FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp index 834205e9f..ed7c1dabe 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp @@ -98,7 +98,9 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp index 26ed7afce..54dc94c48 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp @@ -98,7 +98,9 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp index b6becbea2..9aa7a0bbb 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp @@ -98,7 +98,9 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp index 3fed95f86..4ecaaa8d7 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp @@ -98,7 +98,9 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp index 651a7f76d..e02a8cf87 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp @@ -155,7 +155,9 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp index 159d4cc52..edb802157 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp @@ -153,7 +153,9 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp index 43570613f..22beaf2c2 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp @@ -153,7 +153,9 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp index aa498a1db..36ed298fe 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp @@ -153,7 +153,9 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp index cafdea0cf..725036488 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp @@ -189,7 +189,9 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: FW_ASSERT(array != nullptr); // Compute the size delta const FwSizeType stringSize = 80; - FwSizeType sizeDelta = 0; + FwSizeType sizeDelta = + sizeof(FwDpIdType) + + sizeof(FwSizeStoreType); for (FwSizeType i = 0; i < size; i++) { const Fw::StringBase *const sbPtr = array[i]; FW_ASSERT(sbPtr != nullptr); From e0444a9c85c84dd0425fb7ed3fd4178cbb3d8917 Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Fri, 12 Apr 2024 11:02:56 -0700 Subject: [PATCH 11/12] Remove trailing space --- .../CppWriter/ComponentCppWriter/ComponentDataProducts.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala index 3fb2a7118..9a0ccb807 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala @@ -388,7 +388,7 @@ case class ComponentDataProducts ( } // Generate the code for computing the size delta val computeSizeDelta = (t match { - case ts: Type.String => + case ts: Type.String => val stringSize = StringCppWriter(s).getSize(ts).toString s"""|const FwSizeType stringSize = $stringSize; |const FwSizeType sizeDelta = From 577d7d5601dfeb2afc1656d65d7c79cce7b5f20f Mon Sep 17 00:00:00 2001 From: "Robert L. Bocchino Jr." Date: Wed, 17 Apr 2024 18:31:09 -0700 Subject: [PATCH 12/12] Add parentheses in generated code --- .../ComponentCppWriter/ComponentDataProducts.scala | 2 +- .../component/base/ActiveAsyncProductsComponentAc.ref.cpp | 8 ++++---- .../component/base/ActiveGetProductsComponentAc.ref.cpp | 8 ++++---- .../base/ActiveGuardedProductsComponentAc.ref.cpp | 8 ++++---- .../component/base/ActiveSyncProductsComponentAc.ref.cpp | 8 ++++---- .../test/component/base/ActiveTestComponentAc.ref.cpp | 8 ++++---- .../component/base/PassiveGetProductsComponentAc.ref.cpp | 8 ++++---- .../base/PassiveGuardedProductsComponentAc.ref.cpp | 8 ++++---- .../component/base/PassiveSyncProductsComponentAc.ref.cpp | 8 ++++---- .../test/component/base/PassiveTestComponentAc.ref.cpp | 8 ++++---- .../component/base/QueuedAsyncProductsComponentAc.ref.cpp | 8 ++++---- .../component/base/QueuedGetProductsComponentAc.ref.cpp | 8 ++++---- .../base/QueuedGuardedProductsComponentAc.ref.cpp | 8 ++++---- .../component/base/QueuedSyncProductsComponentAc.ref.cpp | 8 ++++---- .../test/component/base/QueuedTestComponentAc.ref.cpp | 8 ++++---- 15 files changed, 57 insertions(+), 57 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala index 9a0ccb807..f261340a9 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentDataProducts.scala @@ -498,7 +498,7 @@ case class ComponentDataProducts ( |$computeSizeDelta |// Serialize the elements if they will fit |Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - |if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + |if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { | const FwDpIdType id = this->baseId + RecordId::$name; | status = this->m_dataBuffer.serialize(id); | FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp index 946401856..b36226aff 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveAsyncProductsComponentAc.ref.cpp @@ -107,7 +107,7 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: size * ActiveAsyncProducts_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -165,7 +165,7 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -221,7 +221,7 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -274,7 +274,7 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp index 1529c3b34..e135fa5e3 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGetProductsComponentAc.ref.cpp @@ -105,7 +105,7 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: size * ActiveGetProducts_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -163,7 +163,7 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -219,7 +219,7 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -272,7 +272,7 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp index 4a4c8624f..a5353a0b5 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveGuardedProductsComponentAc.ref.cpp @@ -105,7 +105,7 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: size * ActiveGuardedProducts_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -163,7 +163,7 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -219,7 +219,7 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -272,7 +272,7 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp index cb287eca3..5dbeb1edf 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveSyncProductsComponentAc.ref.cpp @@ -105,7 +105,7 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: size * ActiveSyncProducts_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -163,7 +163,7 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -219,7 +219,7 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -272,7 +272,7 @@ Fw::SerializeStatus ActiveSyncProductsComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp index a97f603a1..29957ad66 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveTestComponentAc.ref.cpp @@ -143,7 +143,7 @@ namespace M { size * M::ActiveTest_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -201,7 +201,7 @@ namespace M { } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -257,7 +257,7 @@ namespace M { size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -310,7 +310,7 @@ namespace M { size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp index ed7c1dabe..56a2c233e 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGetProductsComponentAc.ref.cpp @@ -50,7 +50,7 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: size * PassiveGetProducts_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -108,7 +108,7 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -164,7 +164,7 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -217,7 +217,7 @@ Fw::SerializeStatus PassiveGetProductsComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp index 54dc94c48..0c7c8a7b3 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveGuardedProductsComponentAc.ref.cpp @@ -50,7 +50,7 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: size * PassiveGuardedProducts_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -108,7 +108,7 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -164,7 +164,7 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -217,7 +217,7 @@ Fw::SerializeStatus PassiveGuardedProductsComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp index 9aa7a0bbb..5cafc2ff8 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveSyncProductsComponentAc.ref.cpp @@ -50,7 +50,7 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: size * PassiveSyncProducts_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -108,7 +108,7 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -164,7 +164,7 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -217,7 +217,7 @@ Fw::SerializeStatus PassiveSyncProductsComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp index 4ecaaa8d7..7c21fa661 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/PassiveTestComponentAc.ref.cpp @@ -50,7 +50,7 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: size * PassiveTest_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -108,7 +108,7 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -164,7 +164,7 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -217,7 +217,7 @@ Fw::SerializeStatus PassiveTestComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp index e02a8cf87..1dc016cd8 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedAsyncProductsComponentAc.ref.cpp @@ -107,7 +107,7 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: size * QueuedAsyncProducts_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -165,7 +165,7 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -221,7 +221,7 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -274,7 +274,7 @@ Fw::SerializeStatus QueuedAsyncProductsComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp index edb802157..70ef15c68 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGetProductsComponentAc.ref.cpp @@ -105,7 +105,7 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: size * QueuedGetProducts_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -163,7 +163,7 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -219,7 +219,7 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -272,7 +272,7 @@ Fw::SerializeStatus QueuedGetProductsComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp index 22beaf2c2..e9afd222f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedGuardedProductsComponentAc.ref.cpp @@ -105,7 +105,7 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: size * QueuedGuardedProducts_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -163,7 +163,7 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -219,7 +219,7 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -272,7 +272,7 @@ Fw::SerializeStatus QueuedGuardedProductsComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp index 36ed298fe..9b35b7c0a 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedSyncProductsComponentAc.ref.cpp @@ -105,7 +105,7 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: size * QueuedSyncProducts_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -163,7 +163,7 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -219,7 +219,7 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -272,7 +272,7 @@ Fw::SerializeStatus QueuedSyncProductsComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); diff --git a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp index 725036488..b11d08e03 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/QueuedTestComponentAc.ref.cpp @@ -141,7 +141,7 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: size * QueuedTest_Data::SERIALIZED_SIZE; // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::DataArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -199,7 +199,7 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: } // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::StringArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -255,7 +255,7 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: size * sizeof(U32); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status); @@ -308,7 +308,7 @@ Fw::SerializeStatus QueuedTestComponentBase::DpContainer :: size * sizeof(U8); // Serialize the elements if they will fit Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) { + if ((this->m_dataBuffer.getBuffLength() + sizeDelta) <= this->m_dataBuffer.getBuffCapacity()) { const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord; status = this->m_dataBuffer.serialize(id); FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);