From 99223329c0af6cc200d93abf8c9922958344d340 Mon Sep 17 00:00:00 2001 From: Andrei Tumbar Date: Fri, 20 Mar 2026 12:56:17 -0700 Subject: [PATCH 1/3] UpdateStruct/Array operator<< codegen to recursively use operator<< --- .../codegen/CppWriter/ArrayCppWriter.scala | 16 ++++-- .../codegen/CppWriter/StructCppWriter.scala | 39 +++++++++++-- .../test/alias/AbsSerializableAc.ref.cpp | 7 ++- .../test/alias/BasicSerializableAc.ref.cpp | 16 +++++- .../fpp-to-cpp/test/alias/C_AArrayAc.ref.cpp | 13 ++++- .../alias/NamespaceSerializableAc.ref.cpp | 16 +++++- .../fpp-to-cpp/test/alias/SM_AArrayAc.ref.cpp | 13 ++++- .../fpp-to-cpp/test/array/AArrayAc.ref.cpp | 13 ++++- .../test/array/AbsTypeArrayAc.ref.cpp | 13 ++++- .../test/array/AliasTypeArrayAc.ref.cpp | 13 ++++- .../fpp-to-cpp/test/array/C_AArrayAc.ref.cpp | 13 ++++- .../test/array/Enum1ArrayAc.ref.cpp | 13 ++++- .../test/array/Enum2ArrayAc.ref.cpp | 13 ++++- .../test/array/HeaderPathArrayAc.ref.cpp | 13 ++++- .../test/array/LargeSizeArrayAc.ref.cpp | 13 ++++- .../test/array/PrimitiveArrayArrayAc.ref.cpp | 13 ++++- .../test/array/PrimitiveBoolArrayAc.ref.cpp | 13 ++++- .../test/array/PrimitiveF32eArrayAc.ref.cpp | 13 ++++- .../test/array/PrimitiveF32fArrayAc.ref.cpp | 13 ++++- .../test/array/PrimitiveF64ArrayAc.ref.cpp | 13 ++++- .../test/array/PrimitiveI32ArrayAc.ref.cpp | 13 ++++- .../test/array/PrimitiveI64ArrayAc.ref.cpp | 13 ++++- .../test/array/PrimitiveU16ArrayAc.ref.cpp | 13 ++++- .../test/array/PrimitiveU8ArrayAc.ref.cpp | 13 ++++- .../test/array/S1SerializableAc.ref.cpp | 40 +++++++++++++- .../test/array/S2SerializableAc.ref.cpp | 7 ++- .../test/array/S3SerializableAc.ref.cpp | 17 +++++- .../test/array/SDefaultSerializableAc.ref.cpp | 7 ++- .../fpp-to-cpp/test/array/SM_AArrayAc.ref.cpp | 13 ++++- .../test/array/SWrapperSerializableAc.ref.cpp | 7 ++- .../test/array/SingleElementArrayAc.ref.cpp | 13 ++++- .../test/array/String1ArrayAc.ref.cpp | 13 ++++- .../test/array/String2ArrayAc.ref.cpp | 13 ++++- .../test/array/StringArrayArrayAc.ref.cpp | 13 ++++- .../test/array/Struct1ArrayAc.ref.cpp | 13 ++++- .../test/array/Struct2ArrayAc.ref.cpp | 13 ++++- .../test/array/Struct3ArrayAc.ref.cpp | 13 ++++- .../test/array/Struct4ArrayAc.ref.cpp | 13 ++++- .../test/component/base/AArrayAc.ref.cpp | 13 ++++- .../base/ArrayAliasArrayArrayAc.ref.cpp | 13 ++++- .../component/base/SSerializableAc.ref.cpp | 10 +++- .../StructWithAliasSerializableAc.ref.cpp | 19 ++++++- .../fpp-to-cpp/test/struct/AArrayAc.ref.cpp | 13 ++++- .../test/struct/AbsTypeSerializableAc.ref.cpp | 7 ++- .../struct/AliasTypeSerializableAc.ref.cpp | 20 ++++++- .../test/struct/C_SSerializableAc.ref.cpp | 7 ++- .../test/struct/DefaultSerializableAc.ref.cpp | 13 ++++- .../test/struct/EnumSerializableAc.ref.cpp | 17 +++++- .../test/struct/FormatSerializableAc.ref.cpp | 55 ++++++++++++++++++- .../struct/IncludedSerializableAc.ref.cpp | 7 ++- .../struct/IncludingSerializableAc.ref.cpp | 7 ++- .../struct/Modules1SerializableAc.ref.cpp | 10 +++- .../struct/Modules2SerializableAc.ref.cpp | 7 ++- .../struct/Modules3SerializableAc.ref.cpp | 17 +++++- .../struct/Modules4SerializableAc.ref.cpp | 24 +++++++- .../struct/PrimitiveSerializableAc.ref.cpp | 47 +++++++++++++++- .../PrimitiveStructSerializableAc.ref.cpp | 7 ++- .../test/struct/SM_SSerializableAc.ref.cpp | 7 ++- .../test/struct/SSerializableAc.ref.cpp | 7 ++- .../struct/StringArraySerializableAc.ref.cpp | 17 +++++- .../test/struct/StringSerializableAc.ref.cpp | 10 +++- 61 files changed, 702 insertions(+), 188 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ArrayCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ArrayCppWriter.scala index bb22c9837..a11089af3 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ArrayCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ArrayCppWriter.scala @@ -429,11 +429,17 @@ case class ArrayCppWriter ( CppDoc.Lines.Both ) :: writeOstreamOperator( name, - lines( - """|Fw::String s; - |obj.toString(s); - |os << s; - |return os;""" + List.concat( + lines("os << \"[\";"), + indexIterator(lines( + s"""|if (index > 0) { + | os << ", "; + |} + | + |os << this->elements[index]; + """)), + lines("""|os << "]"; + |return os;""") ) ) ) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/StructCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/StructCppWriter.scala index 367ea80b7..ddc018047 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/StructCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/StructCppWriter.scala @@ -247,6 +247,38 @@ case class StructCppWriter( scalarConstructor } + private def writeOstreamBody: List[Line] = { + val memberOutputs = memberList.zipWithIndex.flatMap { case ((n, tn), idx) => + val prefix = if idx > 0 then lines("""os << ", ";""") else Nil + val fieldLabel = lines(s"""os << "$n = ";""") + + val fieldValue = if sizes.contains(n) then + // Array member - iterate and output each element + List.concat( + lines("""os << "[ ";"""), + iterateN(sizes(n), lines( + """|if (i > 0) { + | os << ", "; + |} + |os << obj.m_""" + n + "[i];" + )), + lines("""os << " ]";""") + ) + else + // Non-array member - output directly + lines(s"os << obj.m_$n;") + + List.concat(prefix, fieldLabel, fieldValue) + } + + List.concat( + lines("""os << "{ ";"""), + memberOutputs, + lines("""os << " }";"""), + lines("return os;") + ) + } + private def getOperatorMembers: List[CppDoc.Class.Member] = { val nonArrayMemberCheck = lines( nonArrayMemberNames.map(n => s"(this->m_$n == obj.m_$n)" @@ -363,12 +395,7 @@ case class StructCppWriter( CppDoc.Lines.Both ) :: writeOstreamOperator( name, - lines( - """|Fw::String s; - |obj.toString(s); - |os << s.toChar(); - |return os;""" - ) + writeOstreamBody ) ) } diff --git a/compiler/tools/fpp-to-cpp/test/alias/AbsSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/alias/AbsSerializableAc.ref.cpp index 40de7de96..d45d7f187 100644 --- a/compiler/tools/fpp-to-cpp/test/alias/AbsSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/alias/AbsSerializableAc.ref.cpp @@ -65,9 +65,10 @@ bool Abs :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Abs& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "A = "; + os << obj.m_A; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/alias/BasicSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/alias/BasicSerializableAc.ref.cpp index a1cdd8e73..409243682 100644 --- a/compiler/tools/fpp-to-cpp/test/alias/BasicSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/alias/BasicSerializableAc.ref.cpp @@ -85,9 +85,19 @@ bool Basic :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Basic& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "A = "; + os << obj.m_A; + os << ", "; + os << "B = "; + os << obj.m_B; + os << ", "; + os << "C = "; + os << obj.m_C; + os << ", "; + os << "D = "; + os << obj.m_D; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/alias/C_AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/alias/C_AArrayAc.ref.cpp index b5375f5c5..d2e4682eb 100644 --- a/compiler/tools/fpp-to-cpp/test/alias/C_AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/alias/C_AArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool C_A :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const C_A& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/alias/NamespaceSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/alias/NamespaceSerializableAc.ref.cpp index 755820c8d..80fc1601a 100644 --- a/compiler/tools/fpp-to-cpp/test/alias/NamespaceSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/alias/NamespaceSerializableAc.ref.cpp @@ -85,9 +85,19 @@ bool Namespace :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Namespace& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "A = "; + os << obj.m_A; + os << ", "; + os << "B = "; + os << obj.m_B; + os << ", "; + os << "C = "; + os << obj.m_C; + os << ", "; + os << "D = "; + os << obj.m_D; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/alias/SM_AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/alias/SM_AArrayAc.ref.cpp index 09afbe270..9ca8eefc8 100644 --- a/compiler/tools/fpp-to-cpp/test/alias/SM_AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/alias/SM_AArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool SM_A :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const SM_A& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.cpp index 6c2bab263..20d9b0abe 100644 --- a/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool A :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const A& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.cpp index d9303845e..6b933e6e3 100644 --- a/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool AbsType :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const AbsType& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/AliasTypeArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/AliasTypeArrayAc.ref.cpp index 2a487737d..23a8127df 100644 --- a/compiler/tools/fpp-to-cpp/test/array/AliasTypeArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/AliasTypeArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool AliasType :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const AliasType& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.cpp index b5375f5c5..d2e4682eb 100644 --- a/compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool C_A :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const C_A& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.cpp index 86389295a..0413bc940 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool Enum1 :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Enum1& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.cpp index 394cbf71c..89ef33e2b 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool Enum2 :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Enum2& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.cpp index 6d012c9e2..75c016d2d 100644 --- a/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool HeaderPath :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const HeaderPath& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/LargeSizeArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/LargeSizeArrayAc.ref.cpp index caa97649c..b83e4656f 100644 --- a/compiler/tools/fpp-to-cpp/test/array/LargeSizeArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/LargeSizeArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool LargeSize :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const LargeSize& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.cpp index a72cd206a..0042290e0 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool PrimitiveArray :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const PrimitiveArray& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.cpp index 962593667..c9e029413 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.cpp @@ -130,9 +130,16 @@ namespace M { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const PrimitiveBool& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.cpp index 4e2619c65..160cb604c 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.cpp @@ -130,9 +130,16 @@ namespace M { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const PrimitiveF32e& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.cpp index 1504b79f4..9cb29035c 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.cpp @@ -130,9 +130,16 @@ namespace M { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const PrimitiveF32f& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.cpp index 707e88722..cc33984d9 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.cpp @@ -130,9 +130,16 @@ namespace M { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const PrimitiveF64& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.cpp index 143ad8aa4..3d7d36e43 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.cpp @@ -130,9 +130,16 @@ namespace M { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const PrimitiveI32& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.cpp index 27c1dc38b..3d9ff60c9 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.cpp @@ -130,9 +130,16 @@ namespace M { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const PrimitiveI64& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.cpp index f40249f68..044546324 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.cpp @@ -130,9 +130,16 @@ namespace M { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const PrimitiveU16& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.cpp index 395f2972f..764f3b2e8 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.cpp @@ -130,9 +130,16 @@ namespace M { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const PrimitiveU8& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/S1SerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/S1SerializableAc.ref.cpp index 1a4513119..58a642f4b 100644 --- a/compiler/tools/fpp-to-cpp/test/array/S1SerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/S1SerializableAc.ref.cpp @@ -127,9 +127,43 @@ namespace M { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const S1& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "mF32 = "; + os << obj.m_mF32; + os << ", "; + os << "mF64 = "; + os << obj.m_mF64; + os << ", "; + os << "mI16 = "; + os << obj.m_mI16; + os << ", "; + os << "mI32 = "; + os << obj.m_mI32; + os << ", "; + os << "mI64 = "; + os << obj.m_mI64; + os << ", "; + os << "mI8 = "; + os << obj.m_mI8; + os << ", "; + os << "mU16 = "; + os << obj.m_mU16; + os << ", "; + os << "mU32 = "; + os << obj.m_mU32; + os << ", "; + os << "mU64 = "; + os << obj.m_mU64; + os << ", "; + os << "mU8 = "; + os << obj.m_mU8; + os << ", "; + os << "mBool = "; + os << obj.m_mBool; + os << ", "; + os << "mString = "; + os << obj.m_mString; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/S2SerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/S2SerializableAc.ref.cpp index d7368082d..6fc649adf 100644 --- a/compiler/tools/fpp-to-cpp/test/array/S2SerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/S2SerializableAc.ref.cpp @@ -65,9 +65,10 @@ bool S2 :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const S2& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "s1 = "; + os << obj.m_s1; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/S3SerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/S3SerializableAc.ref.cpp index 05fd96b42..7061728b6 100644 --- a/compiler/tools/fpp-to-cpp/test/array/S3SerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/S3SerializableAc.ref.cpp @@ -102,9 +102,20 @@ namespace S { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const S3& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "mU32Array = "; + os << "[ "; + for (FwSizeType i = 0; i < 3; i++) { + if (i > 0) { + os << ", "; + } + os << obj.m_mU32Array[i]; + } + os << " ]"; + os << ", "; + os << "mF64 = "; + os << obj.m_mF64; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/SDefaultSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/SDefaultSerializableAc.ref.cpp index e5b89a7b5..0c643f83a 100644 --- a/compiler/tools/fpp-to-cpp/test/array/SDefaultSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/SDefaultSerializableAc.ref.cpp @@ -65,9 +65,10 @@ bool SDefault :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const SDefault& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "x = "; + os << obj.m_x; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/SM_AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/SM_AArrayAc.ref.cpp index 09afbe270..9ca8eefc8 100644 --- a/compiler/tools/fpp-to-cpp/test/array/SM_AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/SM_AArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool SM_A :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const SM_A& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/SWrapperSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/SWrapperSerializableAc.ref.cpp index 67f913c64..9d937b136 100644 --- a/compiler/tools/fpp-to-cpp/test/array/SWrapperSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/SWrapperSerializableAc.ref.cpp @@ -65,9 +65,10 @@ bool SWrapper :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const SWrapper& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "s = "; + os << obj.m_s; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.cpp index 9be2377d5..9b8e14b27 100644 --- a/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool SingleElement :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const SingleElement& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.cpp index d47e1ee96..2b243c133 100644 --- a/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.cpp @@ -134,9 +134,16 @@ bool String1 :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const String1& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.cpp index 18e1014a2..35f3599b9 100644 --- a/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.cpp @@ -135,9 +135,16 @@ bool String2 :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const String2& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.cpp index 5dda59e96..cfeabe36a 100644 --- a/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool StringArray :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const StringArray& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.cpp index 0587ff733..d1ba2f5d7 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool Struct1 :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Struct1& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.cpp index 634f559c5..38a0905af 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool Struct2 :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Struct2& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.cpp index b8fbe5170..06b0ff7e3 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool Struct3 :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Struct3& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/array/Struct4ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/Struct4ArrayAc.ref.cpp index 255604be9..615bbc167 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct4ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct4ArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool Struct4 :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Struct4& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/AArrayAc.ref.cpp index 982b02a31..27aec876f 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/AArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool A :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const A& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ArrayAliasArrayArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ArrayAliasArrayArrayAc.ref.cpp index d0233139b..e446ce8c2 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ArrayAliasArrayArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ArrayAliasArrayArrayAc.ref.cpp @@ -128,9 +128,16 @@ bool ArrayAliasArray :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const ArrayAliasArray& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/SSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/SSerializableAc.ref.cpp index 9efb39244..585fb2c21 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/SSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/SSerializableAc.ref.cpp @@ -75,9 +75,13 @@ bool S :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const S& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "x = "; + os << obj.m_x; + os << ", "; + os << "y = "; + os << obj.m_y; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/component/base/StructWithAliasSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/StructWithAliasSerializableAc.ref.cpp index b59c848bb..7aa25394a 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/StructWithAliasSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/StructWithAliasSerializableAc.ref.cpp @@ -90,9 +90,22 @@ bool StructWithAlias :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const StructWithAlias& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "x = "; + os << obj.m_x; + os << ", "; + os << "y = "; + os << obj.m_y; + os << ", "; + os << "z = "; + os << obj.m_z; + os << ", "; + os << "w = "; + os << obj.m_w; + os << ", "; + os << "q = "; + os << obj.m_q; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/AArrayAc.ref.cpp index 4cd9a7a43..7388ac3b3 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/AArrayAc.ref.cpp @@ -130,9 +130,16 @@ namespace M { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const A& obj) { - Fw::String s; - obj.toString(s); - os << s; + os << "["; + for (FwSizeType index = 0; index < SIZE; index++) { + if (index > 0) { + os << ", "; + } + + os << this->elements[index]; + + } + os << "]"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/AbsTypeSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/AbsTypeSerializableAc.ref.cpp index 067a652c9..e4a76e37e 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/AbsTypeSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/AbsTypeSerializableAc.ref.cpp @@ -65,9 +65,10 @@ bool AbsType :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const AbsType& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "t = "; + os << obj.m_t; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/AliasTypeSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/AliasTypeSerializableAc.ref.cpp index 854b89587..19dff4ff7 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/AliasTypeSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/AliasTypeSerializableAc.ref.cpp @@ -122,9 +122,23 @@ bool AliasType :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const AliasType& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "x = "; + os << obj.m_x; + os << ", "; + os << "y = "; + os << obj.m_y; + os << ", "; + os << "z = "; + os << "[ "; + for (FwSizeType i = 0; i < 10; i++) { + if (i > 0) { + os << ", "; + } + os << obj.m_z[i]; + } + os << " ]"; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/C_SSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/C_SSerializableAc.ref.cpp index 183cda6da..09ef91514 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/C_SSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/C_SSerializableAc.ref.cpp @@ -65,9 +65,10 @@ bool C_S :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const C_S& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "x = "; + os << obj.m_x; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/DefaultSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/DefaultSerializableAc.ref.cpp index f910938ba..99f544c6c 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/DefaultSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/DefaultSerializableAc.ref.cpp @@ -80,9 +80,16 @@ bool Default :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Default& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "mU32 = "; + os << obj.m_mU32; + os << ", "; + os << "mS1 = "; + os << obj.m_mS1; + os << ", "; + os << "mF64 = "; + os << obj.m_mF64; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/EnumSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/EnumSerializableAc.ref.cpp index 8b99904fb..5a23bbf9d 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/EnumSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/EnumSerializableAc.ref.cpp @@ -100,9 +100,20 @@ bool Enum :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Enum& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "e = "; + os << obj.m_e; + os << ", "; + os << "eArr = "; + os << "[ "; + for (FwSizeType i = 0; i < 3; i++) { + if (i > 0) { + os << ", "; + } + os << obj.m_eArr[i]; + } + os << " ]"; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/FormatSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/FormatSerializableAc.ref.cpp index 94eae8699..abd9f8be0 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/FormatSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/FormatSerializableAc.ref.cpp @@ -150,9 +150,58 @@ bool Format :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Format& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "m1 = "; + os << obj.m_m1; + os << ", "; + os << "m2 = "; + os << obj.m_m2; + os << ", "; + os << "m3 = "; + os << obj.m_m3; + os << ", "; + os << "m4 = "; + os << obj.m_m4; + os << ", "; + os << "m5 = "; + os << obj.m_m5; + os << ", "; + os << "m6 = "; + os << obj.m_m6; + os << ", "; + os << "m7 = "; + os << obj.m_m7; + os << ", "; + os << "m8 = "; + os << obj.m_m8; + os << ", "; + os << "m9 = "; + os << obj.m_m9; + os << ", "; + os << "m10 = "; + os << obj.m_m10; + os << ", "; + os << "m11 = "; + os << obj.m_m11; + os << ", "; + os << "m12 = "; + os << obj.m_m12; + os << ", "; + os << "m13 = "; + os << obj.m_m13; + os << ", "; + os << "m14 = "; + os << obj.m_m14; + os << ", "; + os << "m15 = "; + os << obj.m_m15; + os << ", "; + os << "m16 = "; + os << obj.m_m16; + os << ", "; + os << "m17 = "; + os << obj.m_m17; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/IncludedSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/IncludedSerializableAc.ref.cpp index 0785cdbed..baaeead2d 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/IncludedSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/IncludedSerializableAc.ref.cpp @@ -65,9 +65,10 @@ bool Included :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Included& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "x = "; + os << obj.m_x; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/IncludingSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/IncludingSerializableAc.ref.cpp index a42a65647..4afac0993 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/IncludingSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/IncludingSerializableAc.ref.cpp @@ -65,9 +65,10 @@ bool Including :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Including& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "x = "; + os << obj.m_x; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/Modules1SerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/Modules1SerializableAc.ref.cpp index c4b7b6442..2649748f5 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/Modules1SerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/Modules1SerializableAc.ref.cpp @@ -77,9 +77,13 @@ namespace M { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Modules1& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "x = "; + os << obj.m_x; + os << ", "; + os << "y = "; + os << obj.m_y; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/Modules2SerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/Modules2SerializableAc.ref.cpp index e7e2310d5..572d0b9ea 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/Modules2SerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/Modules2SerializableAc.ref.cpp @@ -67,9 +67,10 @@ namespace M { #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Modules2& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "x = "; + os << obj.m_x; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/Modules3SerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/Modules3SerializableAc.ref.cpp index bf84d5d57..44493acf4 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/Modules3SerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/Modules3SerializableAc.ref.cpp @@ -100,9 +100,20 @@ bool Modules3 :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Modules3& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "x = "; + os << obj.m_x; + os << ", "; + os << "arr = "; + os << "[ "; + for (FwSizeType i = 0; i < 3; i++) { + if (i > 0) { + os << ", "; + } + os << obj.m_arr[i]; + } + os << " ]"; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/Modules4SerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/Modules4SerializableAc.ref.cpp index 30eeaac54..9f26be4ec 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/Modules4SerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/Modules4SerializableAc.ref.cpp @@ -108,9 +108,27 @@ bool Modules4 :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Modules4& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "arr1 = "; + os << "[ "; + for (FwSizeType i = 0; i < 3; i++) { + if (i > 0) { + os << ", "; + } + os << obj.m_arr1[i]; + } + os << " ]"; + os << ", "; + os << "arr2 = "; + os << "[ "; + for (FwSizeType i = 0; i < 6; i++) { + if (i > 0) { + os << ", "; + } + os << obj.m_arr2[i]; + } + os << " ]"; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/PrimitiveSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/PrimitiveSerializableAc.ref.cpp index 462fb521c..2c9165faa 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/PrimitiveSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/PrimitiveSerializableAc.ref.cpp @@ -172,9 +172,50 @@ bool Primitive :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const Primitive& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "mF32 = "; + os << "[ "; + for (FwSizeType i = 0; i < 3; i++) { + if (i > 0) { + os << ", "; + } + os << obj.m_mF32[i]; + } + os << " ]"; + os << ", "; + os << "mF64 = "; + os << obj.m_mF64; + os << ", "; + os << "mI16 = "; + os << obj.m_mI16; + os << ", "; + os << "mI32 = "; + os << obj.m_mI32; + os << ", "; + os << "mI64 = "; + os << obj.m_mI64; + os << ", "; + os << "mI8 = "; + os << obj.m_mI8; + os << ", "; + os << "mU16 = "; + os << obj.m_mU16; + os << ", "; + os << "mU32 = "; + os << obj.m_mU32; + os << ", "; + os << "mU64 = "; + os << obj.m_mU64; + os << ", "; + os << "mU8 = "; + os << obj.m_mU8; + os << ", "; + os << "m_bool = "; + os << obj.m_m_bool; + os << ", "; + os << "m_string = "; + os << obj.m_m_string; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/PrimitiveStructSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/PrimitiveStructSerializableAc.ref.cpp index 9d2226922..a1ff44d4f 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/PrimitiveStructSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/PrimitiveStructSerializableAc.ref.cpp @@ -65,9 +65,10 @@ bool PrimitiveStruct :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const PrimitiveStruct& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "s1 = "; + os << obj.m_s1; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/SM_SSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/SM_SSerializableAc.ref.cpp index e4546b343..3889be682 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/SM_SSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/SM_SSerializableAc.ref.cpp @@ -65,9 +65,10 @@ bool SM_S :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const SM_S& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "x = "; + os << obj.m_x; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/SSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/SSerializableAc.ref.cpp index d6384e641..a465d9f3a 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/SSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/SSerializableAc.ref.cpp @@ -65,9 +65,10 @@ bool S :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const S& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "x = "; + os << obj.m_x; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/StringArraySerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/StringArraySerializableAc.ref.cpp index e5f62c386..172b2252d 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/StringArraySerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/StringArraySerializableAc.ref.cpp @@ -113,9 +113,20 @@ bool StringArray :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const StringArray& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "s1 = "; + os << obj.m_s1; + os << ", "; + os << "s2 = "; + os << "[ "; + for (FwSizeType i = 0; i < 16; i++) { + if (i > 0) { + os << ", "; + } + os << obj.m_s2[i]; + } + os << " ]"; + os << " }"; return os; } diff --git a/compiler/tools/fpp-to-cpp/test/struct/StringSerializableAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/StringSerializableAc.ref.cpp index d6c789ded..e61ec92a4 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/StringSerializableAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/StringSerializableAc.ref.cpp @@ -75,9 +75,13 @@ bool String :: #ifdef BUILD_UT std::ostream& operator<<(std::ostream& os, const String& obj) { - Fw::String s; - obj.toString(s); - os << s.toChar(); + os << "{ "; + os << "s1 = "; + os << obj.m_s1; + os << ", "; + os << "s2 = "; + os << obj.m_s2; + os << " }"; return os; } From 452b8ea66fbcafe928af095422baeceec21668ba Mon Sep 17 00:00:00 2001 From: Andrei Tumbar Date: Fri, 20 Mar 2026 17:48:04 -0700 Subject: [PATCH 2/3] Clean up some errors --- .../src/main/scala/codegen/CppWriter/ArrayCppWriter.scala | 5 +++-- compiler/tools/fpp-to-cpp/test/alias/C_AArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/alias/SM_AArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/AliasTypeArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/LargeSizeArrayAc.ref.cpp | 3 ++- .../fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/array/SM_AArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/array/Struct4ArrayAc.ref.cpp | 3 ++- .../tools/fpp-to-cpp/test/component/base/AArrayAc.ref.cpp | 3 ++- .../test/component/base/ArrayAliasArrayArrayAc.ref.cpp | 3 ++- compiler/tools/fpp-to-cpp/test/struct/AArrayAc.ref.cpp | 3 ++- 32 files changed, 65 insertions(+), 33 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ArrayCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ArrayCppWriter.scala index a11089af3..0ff736c32 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ArrayCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ArrayCppWriter.scala @@ -430,13 +430,14 @@ case class ArrayCppWriter ( ) :: writeOstreamOperator( name, List.concat( - lines("os << \"[\";"), + lines(s"""|os << "["; + |constexpr auto SIZE = $name::SIZE;"""), indexIterator(lines( s"""|if (index > 0) { | os << ", "; |} | - |os << this->elements[index]; + |os << obj.elements[index]; """)), lines("""|os << "]"; |return os;""") diff --git a/compiler/tools/fpp-to-cpp/test/alias/C_AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/alias/C_AArrayAc.ref.cpp index d2e4682eb..d6b2d5908 100644 --- a/compiler/tools/fpp-to-cpp/test/alias/C_AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/alias/C_AArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool C_A :: std::ostream& operator<<(std::ostream& os, const C_A& obj) { os << "["; + constexpr auto SIZE = C_A::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/alias/SM_AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/alias/SM_AArrayAc.ref.cpp index 9ca8eefc8..885fe83fd 100644 --- a/compiler/tools/fpp-to-cpp/test/alias/SM_AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/alias/SM_AArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool SM_A :: std::ostream& operator<<(std::ostream& os, const SM_A& obj) { os << "["; + constexpr auto SIZE = SM_A::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.cpp index 20d9b0abe..3c6c92738 100644 --- a/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool A :: std::ostream& operator<<(std::ostream& os, const A& obj) { os << "["; + constexpr auto SIZE = A::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.cpp index 6b933e6e3..925004f77 100644 --- a/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool AbsType :: std::ostream& operator<<(std::ostream& os, const AbsType& obj) { os << "["; + constexpr auto SIZE = AbsType::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/AliasTypeArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/AliasTypeArrayAc.ref.cpp index 23a8127df..4b093096b 100644 --- a/compiler/tools/fpp-to-cpp/test/array/AliasTypeArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/AliasTypeArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool AliasType :: std::ostream& operator<<(std::ostream& os, const AliasType& obj) { os << "["; + constexpr auto SIZE = AliasType::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.cpp index d2e4682eb..d6b2d5908 100644 --- a/compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool C_A :: std::ostream& operator<<(std::ostream& os, const C_A& obj) { os << "["; + constexpr auto SIZE = C_A::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.cpp index 0413bc940..c1160fcbc 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool Enum1 :: std::ostream& operator<<(std::ostream& os, const Enum1& obj) { os << "["; + constexpr auto SIZE = Enum1::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.cpp index 89ef33e2b..fa07a9f09 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool Enum2 :: std::ostream& operator<<(std::ostream& os, const Enum2& obj) { os << "["; + constexpr auto SIZE = Enum2::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.cpp index 75c016d2d..131b5b2a2 100644 --- a/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool HeaderPath :: std::ostream& operator<<(std::ostream& os, const HeaderPath& obj) { os << "["; + constexpr auto SIZE = HeaderPath::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/LargeSizeArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/LargeSizeArrayAc.ref.cpp index b83e4656f..c56c3303e 100644 --- a/compiler/tools/fpp-to-cpp/test/array/LargeSizeArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/LargeSizeArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool LargeSize :: std::ostream& operator<<(std::ostream& os, const LargeSize& obj) { os << "["; + constexpr auto SIZE = LargeSize::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.cpp index 0042290e0..2f542c14f 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool PrimitiveArray :: std::ostream& operator<<(std::ostream& os, const PrimitiveArray& obj) { os << "["; + constexpr auto SIZE = PrimitiveArray::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.cpp index c9e029413..ba1c2c0b1 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.cpp @@ -131,12 +131,13 @@ namespace M { std::ostream& operator<<(std::ostream& os, const PrimitiveBool& obj) { os << "["; + constexpr auto SIZE = PrimitiveBool::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.cpp index 160cb604c..eb4a26a12 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.cpp @@ -131,12 +131,13 @@ namespace M { std::ostream& operator<<(std::ostream& os, const PrimitiveF32e& obj) { os << "["; + constexpr auto SIZE = PrimitiveF32e::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.cpp index 9cb29035c..5bff96ae4 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.cpp @@ -131,12 +131,13 @@ namespace M { std::ostream& operator<<(std::ostream& os, const PrimitiveF32f& obj) { os << "["; + constexpr auto SIZE = PrimitiveF32f::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.cpp index cc33984d9..59f59b277 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.cpp @@ -131,12 +131,13 @@ namespace M { std::ostream& operator<<(std::ostream& os, const PrimitiveF64& obj) { os << "["; + constexpr auto SIZE = PrimitiveF64::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.cpp index 3d7d36e43..dc27a5453 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.cpp @@ -131,12 +131,13 @@ namespace M { std::ostream& operator<<(std::ostream& os, const PrimitiveI32& obj) { os << "["; + constexpr auto SIZE = PrimitiveI32::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.cpp index 3d9ff60c9..3f36b9200 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.cpp @@ -131,12 +131,13 @@ namespace M { std::ostream& operator<<(std::ostream& os, const PrimitiveI64& obj) { os << "["; + constexpr auto SIZE = PrimitiveI64::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.cpp index 044546324..7f68947b2 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.cpp @@ -131,12 +131,13 @@ namespace M { std::ostream& operator<<(std::ostream& os, const PrimitiveU16& obj) { os << "["; + constexpr auto SIZE = PrimitiveU16::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.cpp index 764f3b2e8..ae8aad80b 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.cpp @@ -131,12 +131,13 @@ namespace M { std::ostream& operator<<(std::ostream& os, const PrimitiveU8& obj) { os << "["; + constexpr auto SIZE = PrimitiveU8::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/SM_AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/SM_AArrayAc.ref.cpp index 9ca8eefc8..885fe83fd 100644 --- a/compiler/tools/fpp-to-cpp/test/array/SM_AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/SM_AArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool SM_A :: std::ostream& operator<<(std::ostream& os, const SM_A& obj) { os << "["; + constexpr auto SIZE = SM_A::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.cpp index 9b8e14b27..ac531ba59 100644 --- a/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool SingleElement :: std::ostream& operator<<(std::ostream& os, const SingleElement& obj) { os << "["; + constexpr auto SIZE = SingleElement::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.cpp index 2b243c133..4ac1b3b3f 100644 --- a/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.cpp @@ -135,12 +135,13 @@ bool String1 :: std::ostream& operator<<(std::ostream& os, const String1& obj) { os << "["; + constexpr auto SIZE = String1::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.cpp index 35f3599b9..c89bfb306 100644 --- a/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.cpp @@ -136,12 +136,13 @@ bool String2 :: std::ostream& operator<<(std::ostream& os, const String2& obj) { os << "["; + constexpr auto SIZE = String2::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.cpp index cfeabe36a..b65afd653 100644 --- a/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool StringArray :: std::ostream& operator<<(std::ostream& os, const StringArray& obj) { os << "["; + constexpr auto SIZE = StringArray::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.cpp index d1ba2f5d7..c9da18206 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool Struct1 :: std::ostream& operator<<(std::ostream& os, const Struct1& obj) { os << "["; + constexpr auto SIZE = Struct1::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.cpp index 38a0905af..245b19c1b 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool Struct2 :: std::ostream& operator<<(std::ostream& os, const Struct2& obj) { os << "["; + constexpr auto SIZE = Struct2::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.cpp index 06b0ff7e3..4a6ad5711 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool Struct3 :: std::ostream& operator<<(std::ostream& os, const Struct3& obj) { os << "["; + constexpr auto SIZE = Struct3::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/array/Struct4ArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/Struct4ArrayAc.ref.cpp index 615bbc167..71e9a9314 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct4ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct4ArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool Struct4 :: std::ostream& operator<<(std::ostream& os, const Struct4& obj) { os << "["; + constexpr auto SIZE = Struct4::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/AArrayAc.ref.cpp index 27aec876f..58e5d62bf 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/AArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool A :: std::ostream& operator<<(std::ostream& os, const A& obj) { os << "["; + constexpr auto SIZE = A::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ArrayAliasArrayArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ArrayAliasArrayArrayAc.ref.cpp index e446ce8c2..81223ccee 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ArrayAliasArrayArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ArrayAliasArrayArrayAc.ref.cpp @@ -129,12 +129,13 @@ bool ArrayAliasArray :: std::ostream& operator<<(std::ostream& os, const ArrayAliasArray& obj) { os << "["; + constexpr auto SIZE = ArrayAliasArray::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; diff --git a/compiler/tools/fpp-to-cpp/test/struct/AArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/struct/AArrayAc.ref.cpp index 7388ac3b3..afcc0415e 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/struct/AArrayAc.ref.cpp @@ -131,12 +131,13 @@ namespace M { std::ostream& operator<<(std::ostream& os, const A& obj) { os << "["; + constexpr auto SIZE = A::SIZE; for (FwSizeType index = 0; index < SIZE; index++) { if (index > 0) { os << ", "; } - os << this->elements[index]; + os << obj.elements[index]; } os << "]"; From bcab08cb3ba5d0d49ae30c54c0f13fc1fd21075a Mon Sep 17 00:00:00 2001 From: Andrei Tumbar Date: Fri, 20 Mar 2026 17:58:32 -0700 Subject: [PATCH 3/3] Remove useless comments --- .../lib/src/main/scala/codegen/CppWriter/StructCppWriter.scala | 2 -- 1 file changed, 2 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/StructCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/StructCppWriter.scala index ddc018047..75cb0e2c6 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/StructCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/StructCppWriter.scala @@ -253,7 +253,6 @@ case class StructCppWriter( val fieldLabel = lines(s"""os << "$n = ";""") val fieldValue = if sizes.contains(n) then - // Array member - iterate and output each element List.concat( lines("""os << "[ ";"""), iterateN(sizes(n), lines( @@ -265,7 +264,6 @@ case class StructCppWriter( lines("""os << " ]";""") ) else - // Non-array member - output directly lines(s"os << obj.m_$n;") List.concat(prefix, fieldLabel, fieldValue)