diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ArrayCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ArrayCppWriter.scala index ca2f00d90..042422f07 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ArrayCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ArrayCppWriter.scala @@ -477,7 +477,7 @@ case class ArrayCppWriter ( ) ) ++ wrapClassMembersInIfDirective( - "\n#if FW_ARRAY_TO_STRING", + "\n#if FW_SERIALIZABLE_TO_STRING", List( functionClassMember( Some("Convert array to string"), diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/EnumCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/EnumCppWriter.scala index f08c9514d..981c43125 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/EnumCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/EnumCppWriter.scala @@ -360,7 +360,7 @@ case class EnumCppWriter( ) ), wrapClassMembersInIfDirective( - "\n#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING", + "\n#if FW_SERIALIZABLE_TO_STRING", List( functionClassMember( Some(s"Convert enum to string"), 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 60117d36d..9a49f1756 100644 --- a/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.cpp @@ -170,7 +170,7 @@ Fw::SerializeStatus A :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void A :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.hpp index 314660751..d00e35938 100644 --- a/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/AArrayAc.ref.hpp @@ -139,7 +139,7 @@ class A : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 871f7eefb..5c93f9b19 100644 --- a/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.cpp @@ -170,7 +170,7 @@ Fw::SerializeStatus AbsType :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void AbsType :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.hpp index daa2a9b35..9be0705a6 100644 --- a/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/AbsTypeArrayAc.ref.hpp @@ -140,7 +140,7 @@ class AbsType : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( diff --git a/compiler/tools/fpp-to-cpp/test/array/BuiltInTypeArrayAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/array/BuiltInTypeArrayAc.ref.cpp index bedfc2e23..389d97e51 100644 --- a/compiler/tools/fpp-to-cpp/test/array/BuiltInTypeArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/BuiltInTypeArrayAc.ref.cpp @@ -170,7 +170,7 @@ Fw::SerializeStatus BuiltInType :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void BuiltInType :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/BuiltInTypeArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/BuiltInTypeArrayAc.ref.hpp index 486f65d5a..0e691ce1f 100644 --- a/compiler/tools/fpp-to-cpp/test/array/BuiltInTypeArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/BuiltInTypeArrayAc.ref.hpp @@ -139,7 +139,7 @@ class BuiltInType : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 f2e6ad4a0..7571300f4 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 @@ -170,7 +170,7 @@ Fw::SerializeStatus C_A :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void C_A :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.hpp index a54a8fc42..ee3cec050 100644 --- a/compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/C_AArrayAc.ref.hpp @@ -138,7 +138,7 @@ class C_A : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( diff --git a/compiler/tools/fpp-to-cpp/test/array/E1EnumAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/E1EnumAc.ref.hpp index c954c0cf9..99431d49c 100644 --- a/compiler/tools/fpp-to-cpp/test/array/E1EnumAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/E1EnumAc.ref.hpp @@ -141,7 +141,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING +#if FW_SERIALIZABLE_TO_STRING //! Convert enum to string void toString( diff --git a/compiler/tools/fpp-to-cpp/test/array/E2EnumAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/E2EnumAc.ref.hpp index a2610f550..56f884601 100644 --- a/compiler/tools/fpp-to-cpp/test/array/E2EnumAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/E2EnumAc.ref.hpp @@ -140,7 +140,7 @@ class E2 : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING +#if FW_SERIALIZABLE_TO_STRING //! Convert enum to string void toString( 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 dae47962a..af9fe7546 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.cpp @@ -167,7 +167,7 @@ Fw::SerializeStatus Enum1 :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void Enum1 :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.hpp index 9e92f8b1b..e768898ad 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/Enum1ArrayAc.ref.hpp @@ -139,7 +139,7 @@ class Enum1 : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 a7ad416f2..55e12a8c4 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.cpp @@ -176,7 +176,7 @@ Fw::SerializeStatus Enum2 :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void Enum2 :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.hpp index 30ec22682..aa9663a76 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/Enum2ArrayAc.ref.hpp @@ -141,7 +141,7 @@ class Enum2 : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 6cae6852d..6f57b0c13 100644 --- a/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.cpp @@ -170,7 +170,7 @@ Fw::SerializeStatus HeaderPath :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void HeaderPath :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.hpp index 60b0be4f4..c9c33bac2 100644 --- a/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/HeaderPathArrayAc.ref.hpp @@ -140,7 +140,7 @@ class HeaderPath : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 7593ac6ed..749e38718 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.cpp @@ -176,7 +176,7 @@ Fw::SerializeStatus PrimitiveArray :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void PrimitiveArray :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.hpp index 3264d5231..4672b90bc 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveArrayArrayAc.ref.hpp @@ -142,7 +142,7 @@ class PrimitiveArray : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 392db60ec..3f0f4f339 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.cpp @@ -172,7 +172,7 @@ namespace M { return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void PrimitiveBool :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.hpp index 7068c06cc..ed01dace5 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveBoolArrayAc.ref.hpp @@ -140,7 +140,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 019d9bc53..ff851d627 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.cpp @@ -172,7 +172,7 @@ namespace M { return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void PrimitiveF32e :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.hpp index 209e4b4f8..e94962af4 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32eArrayAc.ref.hpp @@ -141,7 +141,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 48854c9cd..af8972648 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.cpp @@ -172,7 +172,7 @@ namespace M { return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void PrimitiveF32f :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.hpp index dc9ede2da..f27be56f5 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF32fArrayAc.ref.hpp @@ -141,7 +141,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 8081ae2ca..1aaafbde8 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.cpp @@ -178,7 +178,7 @@ namespace M { return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void PrimitiveF64 :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.hpp index 9d46a711d..4624a7cfb 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveF64ArrayAc.ref.hpp @@ -143,7 +143,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 cfc72988f..89d5af85b 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.cpp @@ -172,7 +172,7 @@ namespace M { return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void PrimitiveI32 :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.hpp index 7b050f357..5f01491e3 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI32ArrayAc.ref.hpp @@ -141,7 +141,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 dbb19d1ba..24d0a7555 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.cpp @@ -172,7 +172,7 @@ namespace M { return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void PrimitiveI64 :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.hpp index bf86dbe63..41211b023 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveI64ArrayAc.ref.hpp @@ -141,7 +141,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 d677c0cae..0532a7e76 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.cpp @@ -172,7 +172,7 @@ namespace M { return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void PrimitiveU16 :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.hpp index 1231ce380..f0d2be05f 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU16ArrayAc.ref.hpp @@ -140,7 +140,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 d3211f190..6e65da6be 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.cpp @@ -172,7 +172,7 @@ namespace M { return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void PrimitiveU8 :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.hpp index 898400d4f..6d8fd2ed9 100644 --- a/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/PrimitiveU8ArrayAc.ref.hpp @@ -140,7 +140,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 fdc9d4063..b841f280d 100644 --- a/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.cpp @@ -153,7 +153,7 @@ Fw::SerializeStatus SingleElement :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void SingleElement :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.hpp index c922db751..1e20aa09a 100644 --- a/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/SingleElementArrayAc.ref.hpp @@ -132,7 +132,7 @@ class SingleElement : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 e22f423a1..f834d8b18 100644 --- a/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.cpp @@ -175,7 +175,7 @@ Fw::SerializeStatus String1 :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void String1 :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.hpp index 60c558e80..38cd8fc0c 100644 --- a/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/String1ArrayAc.ref.hpp @@ -143,7 +143,7 @@ class String1 : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 d882dbe0f..53b72bebd 100644 --- a/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.cpp @@ -172,7 +172,7 @@ Fw::SerializeStatus String2 :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void String2 :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.hpp index 58b64b93f..26092a90f 100644 --- a/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/String2ArrayAc.ref.hpp @@ -142,7 +142,7 @@ class String2 : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 1bd968ebf..377e67ce3 100644 --- a/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.cpp @@ -176,7 +176,7 @@ Fw::SerializeStatus StringArray :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void StringArray :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.hpp index abf27d2dc..9d276b464 100644 --- a/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/StringArrayArrayAc.ref.hpp @@ -142,7 +142,7 @@ class StringArray : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 b1815b7e9..1dc278645 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.cpp @@ -176,7 +176,7 @@ Fw::SerializeStatus Struct1 :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void Struct1 :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.hpp index 576c6c6af..67c989999 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct1ArrayAc.ref.hpp @@ -142,7 +142,7 @@ class Struct1 : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 9fc2dffd9..16c4e3d2e 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.cpp @@ -170,7 +170,7 @@ Fw::SerializeStatus Struct2 :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void Struct2 :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.hpp index 4be4a9bb9..3c6c22f4e 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct2ArrayAc.ref.hpp @@ -140,7 +140,7 @@ class Struct2 : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 f8e8b34e2..c109021e9 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.cpp @@ -170,7 +170,7 @@ Fw::SerializeStatus Struct3 :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void Struct3 :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.hpp index 5c5f38595..5aadb1fca 100644 --- a/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/array/Struct3ArrayAc.ref.hpp @@ -140,7 +140,7 @@ class Struct3 : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( 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 b0529d0f7..960209dcc 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 @@ -170,7 +170,7 @@ Fw::SerializeStatus A :: return status; } -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING void A :: toString(Fw::StringBase& sb) const diff --git a/compiler/tools/fpp-to-cpp/test/component/base/AArrayAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/AArrayAc.ref.hpp index 174357ba8..d6019cc01 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/AArrayAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/AArrayAc.ref.hpp @@ -139,7 +139,7 @@ class A : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_ARRAY_TO_STRING +#if FW_SERIALIZABLE_TO_STRING //! Convert array to string void toString( diff --git a/compiler/tools/fpp-to-cpp/test/component/base/EEnumAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/EEnumAc.ref.hpp index cabcb735e..72f23b454 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/EEnumAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/EEnumAc.ref.hpp @@ -139,7 +139,7 @@ class E : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING +#if FW_SERIALIZABLE_TO_STRING //! Convert enum to string void toString( diff --git a/compiler/tools/fpp-to-cpp/test/component/gen_guards.py b/compiler/tools/fpp-to-cpp/test/component/gen_guards.py index 2d5ff0da9..13a357496 100644 --- a/compiler/tools/fpp-to-cpp/test/component/gen_guards.py +++ b/compiler/tools/fpp-to-cpp/test/component/gen_guards.py @@ -6,7 +6,7 @@ # Writes a list of comma-separated lists of compiler flags specifying the # values of the F Prime guards to stdout def gen_guards(): - guards_to_remove = ['-DFW_ARRAY_TO_STRING'] + guards_to_remove = [] # First argument is the name of the script guards = sys.argv[1:] @@ -26,9 +26,6 @@ def gen_guards(): for j in range(num_guards): new_guards.append(f"{guards[j]}={values[j]}") - if guards[j] == '-DFW_SERIALIZABLE_TO_STRING': - new_guards.append(f"-DFW_ARRAY_TO_STRING={values[j]}") - guards_list.append(new_guards) i = i + 1 diff --git a/compiler/tools/fpp-to-cpp/test/enum/C_EEnumAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/enum/C_EEnumAc.ref.hpp index c8215c291..5485c1514 100644 --- a/compiler/tools/fpp-to-cpp/test/enum/C_EEnumAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/enum/C_EEnumAc.ref.hpp @@ -137,7 +137,7 @@ class C_E : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING +#if FW_SERIALIZABLE_TO_STRING //! Convert enum to string void toString( diff --git a/compiler/tools/fpp-to-cpp/test/enum/DefaultEnumAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/enum/DefaultEnumAc.ref.hpp index 92be08d90..001d67b32 100644 --- a/compiler/tools/fpp-to-cpp/test/enum/DefaultEnumAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/enum/DefaultEnumAc.ref.hpp @@ -141,7 +141,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING +#if FW_SERIALIZABLE_TO_STRING //! Convert enum to string void toString( diff --git a/compiler/tools/fpp-to-cpp/test/enum/EEnumAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/enum/EEnumAc.ref.hpp index 757ac05fd..5ec6f6074 100644 --- a/compiler/tools/fpp-to-cpp/test/enum/EEnumAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/enum/EEnumAc.ref.hpp @@ -138,7 +138,7 @@ class E : Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING +#if FW_SERIALIZABLE_TO_STRING //! Convert enum to string void toString( diff --git a/compiler/tools/fpp-to-cpp/test/enum/ExplicitEnumAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/enum/ExplicitEnumAc.ref.hpp index 8755e1674..d914df9b6 100644 --- a/compiler/tools/fpp-to-cpp/test/enum/ExplicitEnumAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/enum/ExplicitEnumAc.ref.hpp @@ -141,7 +141,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING +#if FW_SERIALIZABLE_TO_STRING //! Convert enum to string void toString( diff --git a/compiler/tools/fpp-to-cpp/test/enum/ImplicitEnumAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/enum/ImplicitEnumAc.ref.hpp index 274a7b434..8127ac00f 100644 --- a/compiler/tools/fpp-to-cpp/test/enum/ImplicitEnumAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/enum/ImplicitEnumAc.ref.hpp @@ -141,7 +141,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING +#if FW_SERIALIZABLE_TO_STRING //! Convert enum to string void toString( diff --git a/compiler/tools/fpp-to-cpp/test/enum/SerializeTypeEnumAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/enum/SerializeTypeEnumAc.ref.hpp index b581564f1..30e9798a1 100644 --- a/compiler/tools/fpp-to-cpp/test/enum/SerializeTypeEnumAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/enum/SerializeTypeEnumAc.ref.hpp @@ -141,7 +141,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING +#if FW_SERIALIZABLE_TO_STRING //! Convert enum to string void toString( diff --git a/compiler/tools/fpp-to-cpp/test/struct/EEnumAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/struct/EEnumAc.ref.hpp index 3fb77757c..0eb6cd229 100644 --- a/compiler/tools/fpp-to-cpp/test/struct/EEnumAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/struct/EEnumAc.ref.hpp @@ -139,7 +139,7 @@ namespace M { Fw::SerializeBufferBase& buffer //!< The serial buffer ); -#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING +#if FW_SERIALIZABLE_TO_STRING //! Convert enum to string void toString( diff --git a/docs/fpp-spec.html b/docs/fpp-spec.html index b1a4d45f4..844ebb074 100644 --- a/docs/fpp-spec.html +++ b/docs/fpp-spec.html @@ -8551,7 +8551,7 @@

20.4. Translation Tools

diff --git a/docs/fpp-users-guide.html b/docs/fpp-users-guide.html index 88e12caf8..1c7463317 100644 --- a/docs/fpp-users-guide.html +++ b/docs/fpp-users-guide.html @@ -11936,10 +11936,10 @@

14.1. I #ifndef T_HPP #define T_HPP -// Include Fw/Types/Serializable.fpp from the F Prime framework +// Include Fw/Types/Serializable.hpp from the F Prime framework #include "Fw/Types/Serializable.hpp" -struct T : public Fw::Serializable { // Extend Fw::Serializable +struct T final : public Fw::Serializable { // Extend Fw::Serializable // Define some shorthand for F Prime types typedef Fw::SerializeStatus SS; @@ -11955,10 +11955,10 @@

14.1. I bool operator==(const T& that) const { return this->x == that.x; } // Define the virtual serialize method - SS serialize(B& b) const { return b.serialize(x); } + SS serialize(B& b) const final { return b.serialize(x); } // Define the virtual deserialize method - SS deserialize(B& b) { return b.deserialize(x); } + SS deserialize(B& b) final { return b.deserialize(x); } // Provide some data U32 x; @@ -12360,7 +12360,7 @@

diff --git a/docs/users-guide/Writing-C-Plus-Plus-Implementations.adoc b/docs/users-guide/Writing-C-Plus-Plus-Implementations.adoc index a48325fa6..76a02f1da 100644 --- a/docs/users-guide/Writing-C-Plus-Plus-Implementations.adoc +++ b/docs/users-guide/Writing-C-Plus-Plus-Implementations.adoc @@ -110,10 +110,10 @@ all members are public by default. #ifndef T_HPP #define T_HPP -// Include Fw/Types/Serializable.fpp from the F Prime framework +// Include Fw/Types/Serializable.hpp from the F Prime framework #include "Fw/Types/Serializable.hpp" -struct T : public Fw::Serializable { // Extend Fw::Serializable +struct T final : public Fw::Serializable { // Extend Fw::Serializable // Define some shorthand for F Prime types typedef Fw::SerializeStatus SS; @@ -129,10 +129,10 @@ struct T : public Fw::Serializable { // Extend Fw::Serializable bool operator==(const T& that) const { return this->x == that.x; } // Define the virtual serialize method - SS serialize(B& b) const { return b.serialize(x); } + SS serialize(B& b) const final { return b.serialize(x); } // Define the virtual deserialize method - SS deserialize(B& b) { return b.deserialize(x); } + SS deserialize(B& b) final { return b.deserialize(x); } // Provide some data U32 x; diff --git a/docs/users-guide/examples/impl-abs-type/.gitignore b/docs/users-guide/examples/impl-abs-type/.gitignore index cba7efc8e..b2db01e04 100644 --- a/docs/users-guide/examples/impl-abs-type/.gitignore +++ b/docs/users-guide/examples/impl-abs-type/.gitignore @@ -1 +1,2 @@ -a.out +T.hpp +T.hpp.gch diff --git a/docs/users-guide/examples/impl-abs-type/AArrayAc.cpp b/docs/users-guide/examples/impl-abs-type/AArrayAc.cpp deleted file mode 100644 index 2ae7a1f93..000000000 --- a/docs/users-guide/examples/impl-abs-type/AArrayAc.cpp +++ /dev/null @@ -1,217 +0,0 @@ -// ====================================================================== -// \title A -// \author Auto-generated -// \brief cpp file for A -// -// \copyright -// Copyright 2020 California Institute of Technology. -// ALL RIGHTS RESERVED. United States Government Sponsorship -// acknowledged. Any commercial use must be negotiated with the Office -// of Technology Transfer at the California Institute of Technology. -// -// This software may be subject to U.S. export control laws and -// regulations. By accepting this document, the user agrees to comply -// with all U.S. export laws and regulations. User has the -// responsibility to obtain export licenses, or other export authority -// as may be required before exporting such information to foreign -// countries or providing access to foreign persons. -// ====================================================================== - -#include -#include - -#include "Fw/Types/Assert.hpp" - -#include "AArrayAc.hpp" - - - - // ---------------------------------------------------------------------- - // Constructors - // ---------------------------------------------------------------------- - - A :: - A(void) : - Serializable() - { - *this = A( - T(), - T(), - T()); - } - - A :: - A(const ElementType (&a)[SIZE]) : - Serializable() - { - for(U32 index = 0; index < SIZE; index++) - { - this->elements[index] = a[index]; - } - } - - A :: - A(const ElementType& e) : - Serializable() - { - for(U32 index = 0; index < SIZE; index++) - { - this->elements[index] = e; - } - } - - A :: - A( - const ElementType (&e1), //!< Element 1 - const ElementType (&e2), //!< Element 2 - const ElementType (&e3) - ) : - Serializable() - { - this->elements[0] = e1; - this->elements[1] = e2; - this->elements[2] = e3; - } - - A :: - A(const A& other) : - Serializable() - { - for(U32 index = 0; index < SIZE; index++) - { - this->elements[index] = other.elements[index]; - } - } - - // ---------------------------------------------------------------------- - // Public functions - // ---------------------------------------------------------------------- - - - A::ElementType& A :: - operator[](const U32 i) - { - FW_ASSERT(i < SIZE, static_cast(i), static_cast(SIZE)); - return this->elements[i]; - } - - const A::ElementType& A :: - operator[](const U32 i) const - { - FW_ASSERT(i < SIZE, static_cast(i), static_cast(SIZE)); - return this->elements[i]; - } - - - const A& A :: - operator=(const A& other) - { - for(U32 index = 0; index < SIZE; index++) { - this->elements[index] = other.elements[index]; - } - return *this; - } - - const A& A :: - operator=(const ElementType (&a)[SIZE]) - { - for(U32 index = 0; index < SIZE; index++) { - this->elements[index] = a[index]; - } - return *this; - } - - const A& A :: - operator=(const ElementType& e) - { - for(U32 index = 0; index < SIZE; index++) { - this->elements[index] = e; - } - return *this; - } - - bool A :: - operator==(const A& other) const - { - for (U32 i = 0; i < SIZE; ++i) { - if (!((*this)[i] == other[i])) { - return false; - } - } - return true; - } - - bool A :: - operator!=(const A& other) const - { - return !(*this == other); - } - -#if 0 - -void A::toString(Fw::StringBase& text) const { - - static const char * formatString = "[ " - "%s, " - "%s, " - "%s ]"; - - // Need to instantiate toString for arrays and serializable types - Fw::EightyCharString str0; - this->elements[0].toString(str0); - Fw::EightyCharString str1; - this->elements[1].toString(str1); - Fw::EightyCharString str2; - this->elements[2].toString(str2); - - // declare strings to hold any serializable toString() arguments - - char outputString[FW_ARRAY_TO_STRING_BUFFER_SIZE]; - (void)snprintf(outputString,FW_ARRAY_TO_STRING_BUFFER_SIZE,formatString - ,str0.toChar() - ,str1.toChar() - ,str2.toChar() - ); - outputString[FW_ARRAY_TO_STRING_BUFFER_SIZE-1] = 0; // NULL terminate - - text = outputString; -} - -#endif - -#if 0 - std::ostream& operator<<(std::ostream& os, const A& obj) { - Fw::EightyCharString temp; - obj.toString(temp); - - os << temp; - return os; - } -#endif - - Fw::SerializeStatus A :: - serialize(Fw::SerializeBufferBase& buffer) const - { - Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - for (U32 i = 0; i < SIZE; ++i) { - status = buffer.serialize((*this)[i]); - if (status != Fw::FW_SERIALIZE_OK) { - return status; - } - } - return status; - } - - Fw::SerializeStatus A :: - deserialize(Fw::SerializeBufferBase& buffer) - { - Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; - for (U32 i = 0; i < SIZE; ++i) { - status = buffer.deserialize((*this)[i]); - if (status != Fw::FW_SERIALIZE_OK) { - return status; - } - } - return status; - } - diff --git a/docs/users-guide/examples/impl-abs-type/AArrayAc.hpp b/docs/users-guide/examples/impl-abs-type/AArrayAc.hpp deleted file mode 100644 index afe22f775..000000000 --- a/docs/users-guide/examples/impl-abs-type/AArrayAc.hpp +++ /dev/null @@ -1,162 +0,0 @@ -// ====================================================================== -// \title A.hpp -// \author Auto-generated -// \brief hpp file for A -// -// \copyright -// Copyright (C) 2020 California Institute of Technology. -// ALL RIGHTS RESERVED. United States Government Sponsorship -// acknowledged. Any commercial use must be negotiated with the Office -// of Technology Transfer at the California Institute of Technology. -// -// This software may be subject to U.S. export control laws and -// regulations. By accepting this document, the user agrees to comply -// with all U.S. export laws and regulations. User has the -// responsibility to obtain export licenses, or other export authority -// as may be required before exporting such information to foreign -// countries or providing access to foreign persons. -// ====================================================================== - -#ifndef _A_HPP -#define _A_HPP - -#include "Fw/Types/EightyCharString.hpp" -#include "Fw/Types/BasicTypes.hpp" -#include "Fw/Types/Serializable.hpp" -#include - - class A : public Fw::Serializable - { - public: - - // ---------------------------------------------------------------------- - // Helper Types - // ---------------------------------------------------------------------- - - typedef T ElementType; - - enum { - SIZE=3, - SERIALIZED_SIZE = SIZE * - T::SERIALIZED_SIZE - }; //!< serializable size of A - - public: - - // ---------------------------------------------------------------------- - // Constructors - // ---------------------------------------------------------------------- - - //! Construct a A with default initialization - A(void); - - //! Construct a A and initialize its elements from an array - A( - const ElementType (&a)[SIZE] //!< The array - ); - - //! Construct a A and initialize its elements from a single element - A( - const ElementType& e //!< The element - ); - - //! Construct a A and initialize its elements from elements - A( - const ElementType (&e1), //!< Element 1 - const ElementType (&e2), //!< Element 2 - const ElementType (&e3) - ); - - //! Copy constructor - A( - const A& other //!< The other object - ); - - public: - - // ---------------------------------------------------------------------- - // Public operators - // ---------------------------------------------------------------------- - - //! Subscript operator - ElementType& operator[]( - const U32 i //!< The subscript index - ); - - //! Const subscript operator - const ElementType& operator[]( - const U32 i //!< The subscript index - ) const; - - //! Assignment operator - const A& operator=( - const A& other //!< The other object - ); - - //! Assignment operator from array - const A& operator=( - const ElementType (&a)[SIZE] //!< The array - ); - - //! Assignment operator from element - const A& operator=( - const ElementType& e //!< The element - ); - - //! Equality operator - bool operator==( - const A& other //!< The other object - ) const; - - //! Inequality operator - bool operator!=( - const A& other //!< The other object - ) const; - -#if 0 - //! Ostream operator - friend std::ostream& operator<<( - std::ostream& os, //!< The ostream - const A& obj //!< The object - ); -#endif - - public: - - // ---------------------------------------------------------------------- - // Public methods - // ---------------------------------------------------------------------- - - //! Serialization - Fw::SerializeStatus serialize( - Fw::SerializeBufferBase& buffer //!< The serial buffer - ) const; - - //! Deserialization - Fw::SerializeStatus deserialize( - Fw::SerializeBufferBase& buffer //!< The serial buffer - ); - -#if 0 - void toString(Fw::StringBase& text) const; //!< generate text from serializable -#endif - - protected: - - enum { - TYPE_ID = 0x6CB4E96B //!< type id - }; - - private: - - // ---------------------------------------------------------------------- - // Private member variables - // ---------------------------------------------------------------------- - - //! The array elements - ElementType elements[SIZE]; - - }; - - -#endif diff --git a/docs/users-guide/examples/impl-abs-type/Assert.cpp b/docs/users-guide/examples/impl-abs-type/Assert.cpp deleted file mode 100644 index cd587142b..000000000 --- a/docs/users-guide/examples/impl-abs-type/Assert.cpp +++ /dev/null @@ -1,341 +0,0 @@ -#include -#include -#include -#include - -#ifdef TGT_OS_TYPE_VXWORKS -#include -#endif - -#if FW_ASSERT_LEVEL == FW_NO_ASSERT - -#else - -#if FW_ASSERT_LEVEL == FW_FILEID_ASSERT -#define fileIdFs "Assert file ID 0x%08X: Line: %d " -#else -#define fileIdFs "Assert file \"%s\": Line: %d " -#endif - -namespace Fw { - - void defaultPrintAssert(const I8* msg) { - (void)fprintf(stderr,"%s\n",reinterpret_cast(msg)); - } - - void defaultReportAssert - ( - FILE_NAME_ARG file, - NATIVE_UINT_TYPE lineNo, - NATIVE_UINT_TYPE numArgs, - AssertArg arg1, - AssertArg arg2, - AssertArg arg3, - AssertArg arg4, - AssertArg arg5, - AssertArg arg6, - I8* destBuffer, - NATIVE_INT_TYPE buffSize - ) { - - switch (numArgs) { - case 0: - (void)snprintf((char*)destBuffer,buffSize,fileIdFs,file,lineNo); - break; - case 1: - (void)snprintf((char*)destBuffer,buffSize,fileIdFs "%d",file,lineNo, - arg1); - break; - case 2: - (void)snprintf((char*)destBuffer,buffSize,fileIdFs "%d %d",file,lineNo, - arg1,arg2); - break; - case 3: - (void)snprintf((char*)destBuffer,buffSize,fileIdFs "%d %d %d",file,lineNo, - arg1,arg2,arg3); - break; - case 4: - (void)snprintf((char*)destBuffer,buffSize,fileIdFs "%d %d %d %d",file,lineNo, - arg1,arg2,arg3,arg4); - break; - case 5: - (void)snprintf((char*)destBuffer,buffSize,fileIdFs "%d %d %d %d %d",file,lineNo, - arg1,arg2,arg3,arg4,arg5); - break; - case 6: - (void)snprintf((char*)destBuffer,buffSize,fileIdFs "%d %d %d %d %d %d",file,lineNo, - arg1,arg2,arg3,arg4,arg5,arg6); - break; - default: // in an assert already, what can we do? - break; - } - - // null terminate - destBuffer[buffSize-1] = 0; - - } - - void AssertHook::printAssert(const I8* msg) { - defaultPrintAssert(msg); - } - - void AssertHook::reportAssert - ( - FILE_NAME_ARG file, - NATIVE_UINT_TYPE lineNo, - NATIVE_UINT_TYPE numArgs, - AssertArg arg1, - AssertArg arg2, - AssertArg arg3, - AssertArg arg4, - AssertArg arg5, - AssertArg arg6 - ) - { - I8 destBuffer[256]; - defaultReportAssert - ( - file, - lineNo, - numArgs, - arg1, - arg2, - arg3, - arg4, - arg5, - arg6, - destBuffer, - sizeof(destBuffer) - ); - // print message - this->printAssert(destBuffer); - } - - void AssertHook::doAssert(void) { - assert(0); - } - - STATIC AssertHook* s_assertHook = NULL; - - void AssertHook::registerHook(void) { - this->previousHook = s_assertHook; - s_assertHook = this; - } - - void AssertHook::deregisterHook() { - s_assertHook = this->previousHook; - } - - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo) { - if (NULL == s_assertHook) { - I8 assertMsg[256]; - defaultReportAssert( - file, - lineNo, - 0, - 0,0,0,0,0,0, - assertMsg,sizeof(assertMsg)); - // print message - defaultPrintAssert(assertMsg); - assert(0); - } - else { - s_assertHook->reportAssert( - file, - lineNo, - 0, - 0,0,0,0,0,0); - s_assertHook->doAssert(); - } - return 0; - } - - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo, - AssertArg arg1) { - if (NULL == s_assertHook) { - I8 assertMsg[256]; - defaultReportAssert( - file, - lineNo, - 1, - arg1,0,0,0,0,0, - assertMsg,sizeof(assertMsg)); - // print message - defaultPrintAssert(assertMsg); - assert(0); - } - else { - s_assertHook->reportAssert( - file, - lineNo, - 1, - arg1,0,0,0,0,0); - s_assertHook->doAssert(); - } - return 0; - } - - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo, - AssertArg arg1, - AssertArg arg2) { - if (NULL == s_assertHook) { - I8 assertMsg[256]; - defaultReportAssert( - file, - lineNo, - 2, - arg1,arg2,0,0,0,0, - assertMsg,sizeof(assertMsg)); - defaultPrintAssert(assertMsg); - assert(0); - } - else { - s_assertHook->reportAssert( - file, - lineNo, - 2, - arg1,arg2,0,0,0,0); - s_assertHook->doAssert(); - } - return 0; - } - - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo, - AssertArg arg1, - AssertArg arg2, - AssertArg arg3) { - if (NULL == s_assertHook) { - I8 assertMsg[256]; - defaultReportAssert( - file, - lineNo, - 3, - arg1,arg2,arg3,0,0,0, - assertMsg,sizeof(assertMsg)); - defaultPrintAssert(assertMsg); - assert(0); - } - else { - s_assertHook->reportAssert( - file, - lineNo, - 3, - arg1,arg2,arg3,0,0,0); - s_assertHook->doAssert(); - } - return 0; - } - - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo, - AssertArg arg1, - AssertArg arg2, - AssertArg arg3, - AssertArg arg4) { - if (NULL == s_assertHook) { - I8 assertMsg[256]; - defaultReportAssert( - file, - lineNo, - 4, - arg1,arg2,arg3,arg4,0,0, - assertMsg,sizeof(assertMsg)); - defaultPrintAssert(assertMsg); - assert(0); - } - else { - s_assertHook->reportAssert( - file, - lineNo, - 4, - arg1,arg2,arg3,arg4,0,0); - s_assertHook->doAssert(); - } - return 0; - } - - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo, - AssertArg arg1, - AssertArg arg2, - AssertArg arg3, - AssertArg arg4, - AssertArg arg5) { - if (NULL == s_assertHook) { - I8 assertMsg[256]; - defaultReportAssert( - file, - lineNo, - 5, - arg1,arg2,arg3,arg4,arg5,0, - assertMsg,sizeof(assertMsg)); - defaultPrintAssert(assertMsg); - assert(0); - } - else { - s_assertHook->reportAssert( - file, - lineNo, - 5, - arg1,arg2,arg3,arg4,arg5,0); - s_assertHook->doAssert(); - } - return 0; - } - - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo, - AssertArg arg1, - AssertArg arg2, - AssertArg arg3, - AssertArg arg4, - AssertArg arg5, - AssertArg arg6) { - if (NULL == s_assertHook) { - I8 assertMsg[256]; - defaultReportAssert( - file, - lineNo, - 6, - arg1,arg2,arg3,arg4,arg5,arg6, - assertMsg,sizeof(assertMsg)); - defaultPrintAssert(assertMsg); - assert(0); - } - else { - s_assertHook->reportAssert( - file, - lineNo, - 6, - arg1,arg2,arg3,arg4,arg5,arg6); - s_assertHook->doAssert(); - } - return 0; - } -} - -// define C asserts. -extern "C" { - NATIVE_INT_TYPE CAssert0(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo); -} - -NATIVE_INT_TYPE CAssert0(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo) { - if (NULL == Fw::s_assertHook) { - I8 assertMsg[256]; - Fw::defaultReportAssert( - file, - lineNo, - 0, - 0,0,0,0,0,0, - assertMsg,sizeof(assertMsg)); - } - else { - Fw::s_assertHook->reportAssert( - file, - lineNo, - 0, - 0,0,0,0,0,0); - Fw::s_assertHook->doAssert(); - } - return 0; -} - -#endif // FW_NO_ASSERT - diff --git a/docs/users-guide/examples/impl-abs-type/FpConfig.hpp b/docs/users-guide/examples/impl-abs-type/FpConfig.hpp deleted file mode 100644 index b65d295dc..000000000 --- a/docs/users-guide/examples/impl-abs-type/FpConfig.hpp +++ /dev/null @@ -1,346 +0,0 @@ -/** - * \file - * \author T. Canham - * \brief ISF configuration file - * - * \copyright - * Copyright 2009-2015, by the California Institute of Technology. - * ALL RIGHTS RESERVED. United States Government Sponsorship - * acknowledged. - *

- */ -#ifndef _FW_CONFIG_HPP_ -#define _FW_CONFIG_HPP_ - -// A helper macro to declare errors in definitions of the constants -#define FW_CONFIG_ERROR( condition, name )\ - typedef char assert_failed_ ## name [ (condition) ? 1 : -1 ]; - -// To enable various facilities, set the below to 0 or 1. If it is set in compiler flags, -// these defaults will be overridden - -// Available types - -#ifndef FW_HAS_64_BIT -#define FW_HAS_64_BIT 1 //!< Architecture supports 64 bit integers -#endif - -#ifndef FW_HAS_32_BIT -#define FW_HAS_32_BIT 1 //!< Architecture supports 32 bit integers -#endif - -#ifndef FW_HAS_16_BIT -#define FW_HAS_16_BIT 1 //!< Architecture supports 16 bit integers -#endif - -#ifndef FW_HAS_F64 -#define FW_HAS_F64 1 //!< Architecture supports 64 bit floating point numbers -#endif - -// Boolean values for serialization - -#ifndef FW_SERIALIZE_TRUE_VALUE -#define FW_SERIALIZE_TRUE_VALUE (0xFF) //!< Value encoded during serialization for boolean true -#endif - -#ifndef FW_SERIALIZE_FALSE_VALUE -#define FW_SERIALIZE_FALSE_VALUE (0x00) //!< Value encoded during serialization for boolean false -#endif - -#ifndef AssertArg -#define AssertArg U32 -#endif - -// typedefs for various serialization items -// *** NOTE *** Changes here MUST match GSE in order to decode the values correctly - -#ifndef FwPacketDescriptorType -#define FwPacketDescriptorType U32 //!< Type representation for a packet descriptor -#endif - -#ifndef FwOpcodeType -#define FwOpcodeType U32 //!< Type representation for a command opcode -#endif - -#ifndef FwChanIdType -#define FwChanIdType U32 //!< Type representation for a channel id -#endif - -#ifndef FwEventIdType -#define FwEventIdType U32 //!< Type representation for a event id -#endif - -#ifndef FwPrmIdType -#define FwPrmIdType U32 //!< Type representation for a parameter id -#endif - -// How big the size of a buffer (or string) representation is -#ifndef FwBuffSizeType -#define FwBuffSizeType U16 //!< Type representation for storing a buffer or string size -#endif - -// How many bits are used to store an enumeration defined in XML during serialization. -#ifndef FwEnumStoreType -#define FwEnumStoreType I32 //!< Type representation for an enumeration value -#endif - -// Object facilities - -// Allow objects to have names. Allocates storage for each instance -#ifndef FW_OBJECT_NAMES -#define FW_OBJECT_NAMES 1 //!< Indicates whether or not object names are stored (more memory, can be used for tracking objects) -#endif - -// Add methods to query an object about its name. Can be overridden by derived classes -// For FW_OBJECT_TO_STRING to work, FW_OBJECT_NAMES must be enabled -#if FW_OBJECT_NAMES == 1 - #ifndef FW_OBJECT_TO_STRING - #define FW_OBJECT_TO_STRING 1 //!< Indicates whether or not generated objects have toString() methods to dump internals (more code) - #endif -#else - #define FW_OBJECT_TO_STRING 0 -#endif - -// Adds the ability for all component related objects to register -// centrally. -#ifndef FW_OBJECT_REGISTRATION -#define FW_OBJECT_REGISTRATION 1 //!< Indicates whether or not objects can register themselves (more code, more object tracking) -#endif - -#ifndef FW_QUEUE_REGISTRATION -#define FW_QUEUE_REGISTRATION 1 //!< Indicates whether or not queue registration is used -#endif - -#ifndef FW_BAREMETAL_SCHEDULER -#define FW_BAREMETAL_SCHEDULER 0 //!< Indicates whether or not a baremetal scheduler should be used. Alternatively the Os scheduler is used. -#endif - -// Port Facilities - -// This allows tracing calls through ports for debugging -#ifndef FW_PORT_TRACING -#define FW_PORT_TRACING 1 //!< Indicates whether port calls are traced (more code, more visibility into execution) -#endif - -// This generates code to connect to serialized ports -#ifndef FW_PORT_SERIALIZATION -#define FW_PORT_SERIALIZATION 1 //!< Indicates whether there is code in ports to serialize the call (more code, but ability to serialize calls for multi-note systems) -#endif - -// Component Facilities - -// Serialization - -// Add a type id when serialization is done. More storage, -// but better detection of errors -// TODO: Not working yet - -#ifndef FW_SERIALIZATION_TYPE_ID -#define FW_SERIALIZATION_TYPE_ID 0 //!< Indicates if type id is stored when type is serialized. (More storage, but more type safety) -#endif - -// Number of bytes to use for serialization IDs. More -// bytes is more storage, but greater number of IDs -#if FW_SERIALIZATION_TYPE_ID - #ifndef FW_SERIALIZATION_TYPE_ID_BYTES - #define FW_SERIALIZATION_TYPE_ID_BYTES 4 //!< Number of bytes used to represent type id - more bytes, more ids - #endif -#endif - -// Turn asserts on or off - -#define FW_NO_ASSERT 1 //!< Asserts turned off -#define FW_FILEID_ASSERT 2 //!< File ID used - requires -DASSERT_FILE_ID= to be set on the compile command line -#define FW_FILENAME_ASSERT 3 //!< Uses the file name in the assert - image stores filenames - -#ifndef FW_ASSERT_LEVEL -#define FW_ASSERT_LEVEL FW_FILENAME_ASSERT //!< Defines the type of assert used -#endif - -// Define max length of assert string -#ifndef FW_ASSERT_TEXT_SIZE -#define FW_ASSERT_TEXT_SIZE 120 //!< Size of string used to store assert description -#endif - -// Adjust various configuration parameters in the architecture. Some of the above enables may disable some of the values - -// The size of the object name stored in the object base class. Larger names will be truncated. -#if FW_OBJECT_NAMES - #ifndef FW_OBJ_NAME_MAX_SIZE - #define FW_OBJ_NAME_MAX_SIZE 80 //!< Size of object name (if object names enabled). AC Limits to 80, truncation occurs above 80. - #endif -#endif - -// When querying an object as to an object-specific description, this specifies the size of the buffer to store the description. -#if FW_OBJECT_TO_STRING - #ifndef FW_OBJ_TO_STRING_BUFFER_SIZE - #define FW_OBJ_TO_STRING_BUFFER_SIZE 255 //!< Size of string storing toString() text - #endif -#endif - -#if FW_OBJECT_REGISTRATION -// For the simple object registry provided with the framework, this specifies how many objects the registry will store. - #ifndef FW_OBJ_SIMPLE_REG_ENTRIES - #define FW_OBJ_SIMPLE_REG_ENTRIES 500 //!< Number of objects stored in simple object registry - #endif -// When dumping the contents of the registry, this specifies the size of the buffer used to store object names. Should be >= FW_OBJ_NAME_MAX_SIZE. - #ifndef FW_OBJ_SIMPLE_REG_BUFF_SIZE - #define FW_OBJ_SIMPLE_REG_BUFF_SIZE 255 //!< Size of ojbect registry dump string - #endif -#endif - -#if FW_QUEUE_REGISTRATION -// For the simple queue registry provided with the framework, this specifies how many queues the registry will store. - #ifndef FW_QUEUE_SIMPLE_QUEUE_ENTRIES - #define FW_QUEUE_SIMPLE_QUEUE_ENTRIES 100 //!< Number of queues stored in simple queue registry - #endif -#endif - - -// Specifies the size of the string holding the queue name for queues -#ifndef FW_QUEUE_NAME_MAX_SIZE -#define FW_QUEUE_NAME_MAX_SIZE 80 //!< Max size of message queue name -#endif - -// Specifies the size of the string holding the task name for active components and tasks -#ifndef FW_TASK_NAME_MAX_SIZE -#define FW_TASK_NAME_MAX_SIZE 80 //!< Max size of task name -#endif - -// Specifies the size of the buffer that contains a communications packet. -#ifndef FW_COM_BUFFER_MAX_SIZE -#define FW_COM_BUFFER_MAX_SIZE 128 //!< Max size of Fw::Com buffer -#endif - -// Specifies the size of the buffer that contains the serialized command arguments. - -#ifndef FW_CMD_ARG_BUFFER_MAX_SIZE -#define FW_CMD_ARG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwOpcodeType) - sizeof(FwPacketDescriptorType)) -#endif - -// Specifies the maximum size of a string in a command argument -#ifndef FW_CMD_STRING_MAX_SIZE -#define FW_CMD_STRING_MAX_SIZE 40 //!< Max character size of command string arguments -#endif - -// Normally when a command is deserialized, the handler checks to see if there any any leftover -// bytes in the buffer. If there are, it assumes that the command was corrupted somehow since -// the serialized size should match the serialized size of the argument list. In some cases, -// command buffers are padded so the data can be larger than the serialized size of the command. -// Setting the below to zero will disable the check at the cost of not detecting commands that -// are too large. -#ifndef FW_CMD_CHECK_RESIDUAL -#define FW_CMD_CHECK_RESIDUAL 1 //!< Check for leftover command bytes -#endif - -// Specifies the size of the buffer that contains the serialized log arguments. -#ifndef FW_LOG_BUFFER_MAX_SIZE -#define FW_LOG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwEventIdType) - sizeof(FwPacketDescriptorType)) -#endif - -// Specifies the maximum size of a string in a log event -#ifndef FW_LOG_STRING_MAX_SIZE -#define FW_LOG_STRING_MAX_SIZE 100 //!< Max size of log string parameter type -#endif - -// Specifies the size of the buffer that contains the serialized telemetry value. -#ifndef FW_TLM_BUFFER_MAX_SIZE -#define FW_TLM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwChanIdType) - sizeof(FwPacketDescriptorType)) -#endif - -// Specifies the maximum size of a string in a telemetry channel -#ifndef FW_TLM_STRING_MAX_SIZE -#define FW_TLM_STRING_MAX_SIZE 40 //!< Max size of channelized telemetry string type -#endif - -// Specifies the size of the buffer that contains the serialized parameter value. -#ifndef FW_PARAM_BUFFER_MAX_SIZE -#define FW_PARAM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwPrmIdType) - sizeof(FwPacketDescriptorType)) -#endif - -// Specifies the maximum size of a string in a parameter -#ifndef FW_PARAM_STRING_MAX_SIZE -#define FW_PARAM_STRING_MAX_SIZE 40 //!< Max size of parameter string type -#endif - -// Specifies the maximum size of a file upload chunk -#ifndef FW_FILE_BUFFER_MAX_SIZE -#define FW_FILE_BUFFER_MAX_SIZE 255 //!< Max size of file buffer (i.e. chunk of file) -#endif - -// Specifies the maximum size of a string in an interface call -#ifndef FW_INTERNAL_INTERFACE_STRING_MAX_SIZE -#define FW_INTERNAL_INTERFACE_STRING_MAX_SIZE 256 //!< Max size of interface string parameter type -#endif - -// enables text logging of events as well as data logging. Adds a second logging port for text output. -#ifndef FW_ENABLE_TEXT_LOGGING -#define FW_ENABLE_TEXT_LOGGING 1 //!< Indicates whether text logging is turned on -#endif - - // Define the size of the text log string buffer. Should be large enough for format string and arguments -#ifndef FW_LOG_TEXT_BUFFER_SIZE -#define FW_LOG_TEXT_BUFFER_SIZE 256 //!< Max size of string for text log message -#endif - -// Define if serializables have toString() method. Turning off will save code space and -// string constants. Must be enabled if text logging enabled -#ifndef FW_SERIALIZABLE_TO_STRING -#define FW_SERIALIZABLE_TO_STRING 1 //!< Indicates if autocoded serializables have toString() methods -#endif - -#if FW_SERIALIZABLE_TO_STRING -#ifndef FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE -#define FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE 255 //!< Size of string to store toString() string output -#endif -#endif - -// Define if arrays have toString() method. -#ifndef FW_ARRAY_TO_STRING -#define FW_ARRAY_TO_STRING 1 //!< Indicates if autocoded arrays have toString() methods -#endif - -#if FW_ARRAY_TO_STRING -#ifndef FW_ARRAY_TO_STRING_BUFFER_SIZE -#define FW_ARRAY_TO_STRING_BUFFER_SIZE 256 //!< Size of string to store toString() string output -#endif -#endif - -// Some settings to enable AMPCS compatibility. This breaks regular ISF GUI compatibility -#ifndef FW_AMPCS_COMPATIBLE -#define FW_AMPCS_COMPATIBLE 0 //!< Whether or not JPL AMPCS ground system support is enabled. -#endif - -// Define enumeration for Time base types -enum TimeBase { - TB_NONE, //!< No time base has been established - TB_PROC_TIME, //!< Indicates time is processor cycle time. Not tied to external time - TB_WORKSTATION_TIME, //!< Time as reported on workstation where software is running. For testing. - TB_DONT_CARE = 0xFFFF //!< Don't care value for sequences. If FwTimeBaseStoreType is changed, value should be changed -}; - -// How many bits are used to store the time base -#ifndef FwTimeBaseStoreType -#define FwTimeBaseStoreType U16 //!< Storage conversion for time base in scripts/ground interface -#endif - -#ifndef FwTimeContextStoreType -#define FwTimeContextStoreType U8 //!< Storage conversion for time context in scripts/ground interface -#define FW_CONTEXT_DONT_CARE 0xFF //!< Don't care value for time contexts in sequences -#endif - -// These setting configure whether or not the timebase and context values for the Fw::Time -// class are used. Some systems may not use or need those fields - -#ifndef FW_USE_TIME_BASE -#define FW_USE_TIME_BASE 1 //!< Whether or not to use the time base -#endif - -#ifndef FW_USE_TIME_CONTEXT -#define FW_USE_TIME_CONTEXT 1 //!< Whether or not to serialize the time context -#endif - -// *** NOTE configuration checks are in Fw/Cfg/ConfigCheck.cpp in order to have -// the type definitions in Fw/Types/BasicTypes available. - -#endif diff --git a/docs/users-guide/examples/impl-abs-type/Fw/Cfg/SerIds.hpp b/docs/users-guide/examples/impl-abs-type/Fw/Cfg/SerIds.hpp deleted file mode 100644 index 824707994..000000000 --- a/docs/users-guide/examples/impl-abs-type/Fw/Cfg/SerIds.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/** - * \file - * \author T. Canham - * \brief Definitions for ISF type serial IDs - * - * NOTE: Not currently being used - * - * \copyright - * Copyright 2009-2015, by the California Institute of Technology. - * ALL RIGHTS RESERVED. United States Government Sponsorship - * acknowledged. - *

- */ -#ifndef _FW_SER_IDS_HPP_ -#define _FW_SER_IDS_HPP_ - -// Definitions of provided types serialized IDs -// Should fit in 16 bits - -namespace Fw { - enum { - - // Built-in types - - FW_TYPEID_U8 = 10, //!< U8 serialized type id - FW_TYPEID_18 = 11, //!< I8 serialized type id - FW_TYPEID_U16 = 12, //!< U16 serialized type id - FW_TYPEID_I16 = 13, //!< I16 serialized type id - FW_TYPEID_U32 = 14, //!< U32 serialized type id - FW_TYPEID_I32 = 15, //!< I32 serialized type id - FW_TYPEID_U64 = 16, //!< U64 serialized type id - FW_TYPEID_I64 = 17, //!< I64 serialized type id - FW_TYPEID_F32 = 18, //!< F32 serialized type id - FW_TYPEID_F64 = 19, //!< F64 serialized type id - FW_TYPEID_BOOL = 20, //!< boolean serialized type id - FW_TYPEID_PTR = 21, //!< pointer serialized type id - FW_TYPEID_BUFF = 22, //!< buffer serialized type id - - // PolyType - - FW_TYPEID_POLY = 30, //!< PolyType serialized type id - - // Command/Telemetry types - - FW_TYPEID_CMD_BUFF = 40, //!< Command Buffer type id - FW_TYPEID_CMD_STR = 41, //!< Command string type id - FW_TYPEID_TLM_BUFF = 42, //!< Telemetry Buffer type id - FW_TYPEID_TLM_STR = 43, //!< Telemetry string type id - FW_TYPEID_LOG_BUFF = 44, //!< Log Buffer type id - FW_TYPEID_LOG_STR = 45, //!< Log string type id - FW_TYPEID_PRM_BUFF = 46, //!< Parameter Buffer type id - FW_TYPEID_PRM_STR = 47, //!< Parameter string type id - FW_TYPEID_FILE_BUFF = 48, //!< File piece Buffer type id - - // Other types - - FW_TYPEID_EIGHTY_CHAR_STRING = 50, //!< 80 char string Buffer type id - FW_TYPEID_INTERNAL_INTERFACE_STRING = 51, //!< interface string Buffer type id - }; -} - -#endif diff --git a/docs/users-guide/examples/impl-abs-type/Fw/Types/Assert.hpp b/docs/users-guide/examples/impl-abs-type/Fw/Types/Assert.hpp deleted file mode 100644 index 988b5ada4..000000000 --- a/docs/users-guide/examples/impl-abs-type/Fw/Types/Assert.hpp +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef FW_ASSERT_HPP -#define FW_ASSERT_HPP - -#include -#include - -#if FW_ASSERT_LEVEL == FW_NO_ASSERT - -#define FW_ASSERT(...) -#define FW_STATIC_ASSERT(...) - -#else // ASSERT is defined - -#define FW_STATIC_CAT_(a, b) a ## b -#define FW_STATIC_CAT(a, b) FW_STATIC_CAT_(a, b) -#define FW_STATIC_ASSERT(cond) typedef int FW_STATIC_CAT(FW_STATIC_ASSERT,__LINE__)[(cond) ? 1 : -1] - -#if FW_ASSERT_LEVEL == FW_FILEID_ASSERT -#define FILE_NAME_ARG NATIVE_UINT_TYPE -#define FW_ASSERT(cond, ...) \ - ((void) ((cond) ? (0) : \ - (Fw::SwAssert(ASSERT_FILE_ID, __LINE__, ##__VA_ARGS__)))) -#else -#define FILE_NAME_ARG U8* -#define FW_ASSERT(cond, ...) \ - ((void) ((cond) ? (0) : \ - (Fw::SwAssert((U8*)__FILE__, __LINE__, ##__VA_ARGS__)))) -#endif - - -namespace Fw { - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo); //!< Assert with no arguments - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo, AssertArg arg1); //!< Assert with one argument - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo, AssertArg arg1, AssertArg arg2); //!< Assert with two arguments - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo, AssertArg arg1, AssertArg arg2, AssertArg arg3); //!< Assert with three arguments - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo, AssertArg arg1, AssertArg arg2, AssertArg arg3, AssertArg arg4); //!< Assert with four arguments - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo, AssertArg arg1, AssertArg arg2, AssertArg arg3, AssertArg arg4, AssertArg arg5); //!< Assert with five arguments - NATIVE_INT_TYPE SwAssert(FILE_NAME_ARG file, NATIVE_UINT_TYPE lineNo, AssertArg arg1, AssertArg arg2, AssertArg arg3, AssertArg arg4, AssertArg arg5, AssertArg arg6); //!< Assert with six arguments - -} - -// Base class for declaring an assert hook -// Each of the base class functions can be overriden -// or used by derived classes. - -namespace Fw { - // Base class for declaring an assert hook - class AssertHook { - public: - AssertHook() : previousHook(NULL) {}; //!< constructor - virtual ~AssertHook() {}; //!< destructor - // override this function to intercept asserts - virtual void reportAssert( - FILE_NAME_ARG file, - NATIVE_UINT_TYPE lineNo, - NATIVE_UINT_TYPE numArgs, - AssertArg arg1, - AssertArg arg2, - AssertArg arg3, - AssertArg arg4, - AssertArg arg5, - AssertArg arg6 - ); - // default reportAssert() will call this when the message is built - // override it to do another kind of print. printf by default - virtual void printAssert(const I8* msg); - // do assert action. By default, calls assert. - // Called after reportAssert() - virtual void doAssert(void); - // register the hook - void registerHook(void); - // deregister the hook - void deregisterHook(void); - - protected: - private: - // the previous assert hook - AssertHook *previousHook; - }; - - -} -#endif // if ASSERT is defined - - -#endif diff --git a/docs/users-guide/examples/impl-abs-type/Fw/Types/BasicTypes.hpp b/docs/users-guide/examples/impl-abs-type/Fw/Types/BasicTypes.hpp deleted file mode 100644 index c716c20b0..000000000 --- a/docs/users-guide/examples/impl-abs-type/Fw/Types/BasicTypes.hpp +++ /dev/null @@ -1,128 +0,0 @@ -/** - * \file - * \author T. Canham - * \brief Declares ISF basic types - * - * \copyright - * Copyright 2009-2016, by the California Institute of Technology. - * ALL RIGHTS RESERVED. United States Government Sponsorship - * acknowledged. - * - */ - -#ifndef FW_BASIC_TYPES_HPP -#define FW_BASIC_TYPES_HPP - -#include -#include // This header will be found be include paths by target. This hides different header files for each target. -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// Define native integer/unsigned integer types -#ifdef _WRS_KERNEL -typedef int32_t NATIVE_INT_TYPE; -typedef uint32_t NATIVE_UINT_TYPE; -#else -typedef int NATIVE_INT_TYPE; //!< native integer type declaration -typedef unsigned int NATIVE_UINT_TYPE; //!< native unsigned integer type declaration -#endif - -#if defined __GNUC__ || __llvm__ - -// This is used to cast pointers to integers -// when a pointer needs to be stored generically. -// In order to avoid chopping off bits, -// the integer bit size needs to match -// the pointer bit size. - -#ifdef __SIZEOF_POINTER__ - #if __SIZEOF_POINTER__ == 8 - #define POINTER_CAST U64 - #elif __SIZEOF_POINTER__ == 4 - #define POINTER_CAST U32 - #elif __SIZEOF_POINTER__ == 2 - #define POINTER_CAST U16 - #else - #define POINTER_CAST U8 - #endif -#elif __i386 == 1 // GCC 4.1.2 - #define POINTER_CAST U32 -#elif __x86_64 == 1 // GCC 4.1.2 - #define POINTER_CAST U64 -#elif CPU == PPC604 // VxWorks 6.7 RAD750 - #define POINTER_CAST U32 -#elif CPU == SPARC - #define POINTER_CAST U32 -#else - #error Cannot get size of pointer cast! -#endif - -#else - #error Unsupported compiler! -#endif - -// compile-time assert -#define COMPILE_TIME_ASSERT( condition, name )\ - do { \ - enum { assert_failed_ ## name = 1/(condition) }; \ - } while(0) - -/*----------------------------------------------------------------------------*/ -typedef int8_t I8; //!< 8-bit signed integer -typedef uint8_t U8; //!< 8-bit unsigned integer -typedef U8 BYTE; //!< byte type - -#if FW_HAS_16_BIT - typedef int16_t I16; //!< 16-bit signed integer - typedef uint16_t U16; //!< 16-bit unsigned integer -#endif - -#if FW_HAS_32_BIT - typedef uint32_t U32; //!< 32-bit signed integer - typedef int32_t I32; //!< 32-bit unsigned integer -#endif - -#if FW_HAS_64_BIT - typedef int64_t I64; //!< 64-bit signed integer - typedef uint64_t U64; //!< 64-bit unsigned integer -#endif - -typedef float F32; //!< 32-bit floating point -#if FW_HAS_F64 - typedef double F64; //!< 64-bit floating point -#endif - -#ifndef NULL -#define NULL (0) //!< NULL -#endif - -#define FW_NUM_ARRAY_ELEMENTS(a) (sizeof(a)/sizeof((a)[0])) //!< number of elements in an array - -#define FW_MAX(a,b) (((a) > (b))?(a):(b)) //!< MAX macro -#define FW_MIN(a,b) (((a) < (b))?(a):(b)) //!< MIN macro - -// STATIC for C builds -#ifndef STATIC -#define STATIC static //!< static for non unit-test code -#endif - -#ifndef PROTECTED -#define PROTECTED protected //!< overridable protected for unit testing -#endif - -#ifndef PRIVATE -#define PRIVATE private //!< overridable private for unit testing -#endif - -// Not ideal, but VxWorks doesn't have strnlen -#ifdef __VXWORKS__ -NATIVE_INT_TYPE strnlen(const char *s, NATIVE_INT_TYPE maxlen); -#endif - -#ifdef __cplusplus -} // extern "C" - -#endif // __cplusplus - -#endif diff --git a/docs/users-guide/examples/impl-abs-type/Fw/Types/EightyCharString.hpp b/docs/users-guide/examples/impl-abs-type/Fw/Types/EightyCharString.hpp deleted file mode 100644 index 6793f675e..000000000 --- a/docs/users-guide/examples/impl-abs-type/Fw/Types/EightyCharString.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef FW_EIGHTY_CHAR_STRING_TYPE_HPP -#define FW_EIGHTY_CHAR_STRING_TYPE_HPP - -#include -#include -#include - -namespace Fw { - - class EightyCharString : public Fw::StringBase { - public: - - enum { - SERIALIZED_TYPE_ID = FW_TYPEID_EIGHTY_CHAR_STRING, //!< typeid for string type - STRING_SIZE = 80, //!< Storage for string - SERIALIZED_SIZE = STRING_SIZE + sizeof(FwBuffSizeType) //!< Serialized size is size of buffer + size field - }; - - EightyCharString(const char* src); //!< char* source constructor - EightyCharString(const StringBase& src); //!< other string constructor - EightyCharString(const EightyCharString& src); //!< EightyCharString string constructor - EightyCharString(void); //!< default constructor - ~EightyCharString(void); //!< destructor - const char* toChar(void) const; //!< gets char buffer - NATIVE_UINT_TYPE length(void) const; //!< returns length of stored string - - const EightyCharString& operator=(const EightyCharString& other); //!< equal operator - - SerializeStatus serialize(SerializeBufferBase& buffer) const; //!< serialization function - SerializeStatus deserialize(SerializeBufferBase& buffer); //!< deserialization function - - PRIVATE: - void copyBuff(const char* buff, NATIVE_UINT_TYPE size); //!< copy source buffer, overwriting - NATIVE_UINT_TYPE getCapacity(void) const ; //!< return buffer size - void terminate(NATIVE_UINT_TYPE size); //!< terminate the string - - char m_buf[STRING_SIZE]; //!< storage for string data - }; -} - -#endif diff --git a/docs/users-guide/examples/impl-abs-type/Fw/Types/Serializable.hpp b/docs/users-guide/examples/impl-abs-type/Fw/Types/Serializable.hpp deleted file mode 100644 index 1a9ef988a..000000000 --- a/docs/users-guide/examples/impl-abs-type/Fw/Types/Serializable.hpp +++ /dev/null @@ -1,177 +0,0 @@ -#ifndef SERIALIZABLE_HPP -#define SERIALIZABLE_HPP - -#ifdef BUILD_UT -#include -#endif - -#include - -namespace Fw { - - class StringBase; //!< forward declaration for string - - typedef enum { - FW_SERIALIZE_OK, //!< Serialization/Deserialization operation was successful - FW_SERIALIZE_FORMAT_ERROR, //!< Data was the wrong format (e.g. wrong packet type) - FW_SERIALIZE_NO_ROOM_LEFT, //!< No room left in the buffer to serialize data - FW_DESERIALIZE_BUFFER_EMPTY, //!< Deserialization buffer was empty when trying to read more data - FW_DESERIALIZE_FORMAT_ERROR, //!< Deserialization data had incorrect values (unexpected data types) - FW_DESERIALIZE_SIZE_MISMATCH, //!< Data was left in in the buffer, but not enough to deserialize - FW_DESERIALIZE_TYPE_MISMATCH //!< Deserialized type ID didn't match - } SerializeStatus; - - class SerializeBufferBase; //!< forward declaration - - class Serializable { - public: - virtual SerializeStatus serialize(SerializeBufferBase& buffer) const = 0; //!< serialize contents - virtual SerializeStatus deserialize(SerializeBufferBase& buffer) = 0; //!< deserialize to contents -#if FW_SERIALIZABLE_TO_STRING || BUILD_UT - virtual void toString(StringBase& text) const; //!< generate text from serializable -#endif - -#ifdef BUILD_UT - friend std::ostream& operator<<(std::ostream& os, const Serializable& val); -#endif - - protected: - Serializable(); //!< Default constructor - virtual ~Serializable(); //!< destructor - }; - - class SerializeBufferBase { - public: - - const SerializeBufferBase& operator=(const SerializeBufferBase &src); //!< equal operator - - virtual ~SerializeBufferBase(); //!< destructor - - // Serialization for built-in types - - SerializeStatus serialize(U8 val); //!< serialize 8-bit unsigned int - SerializeStatus serialize(I8 val); //!< serialize 8-bit signed int - -#if FW_HAS_16_BIT==1 - SerializeStatus serialize(U16 val); //!< serialize 16-bit unsigned int - SerializeStatus serialize(I16 val); //!< serialize 16-bit signed int -#endif -#if FW_HAS_32_BIT==1 - SerializeStatus serialize(U32 val); //!< serialize 32-bit unsigned int - SerializeStatus serialize(I32 val); //!< serialize 32-bit signed int -#endif -#if FW_HAS_64_BIT==1 - SerializeStatus serialize(U64 val); //!< serialize 64-bit unsigned int - SerializeStatus serialize(I64 val); //!< serialize 64-bit signed int -#endif - SerializeStatus serialize(F32 val); //!< serialize 32-bit floating point -#if FW_HAS_F64 - SerializeStatus serialize(F64 val); //!< serialize 64-bit floating point -#endif - SerializeStatus serialize(bool val); //!< serialize boolean - - SerializeStatus serialize(const void* val); //!< serialize pointer (careful, only pointer value, not contents are serialized) - - SerializeStatus serialize(const U8* buff, NATIVE_UINT_TYPE length, bool noLength = false); //!< serialize data buffer - - SerializeStatus serialize(const SerializeBufferBase& val); //!< serialize a serialized buffer - - SerializeStatus serialize(const Serializable &val); //!< serialize an object derived from serializable base class - - // Deserialization for built-in types - - SerializeStatus deserialize(U8 &val); //!< deserialize 8-bit unsigned int - SerializeStatus deserialize(I8 &val); //!< deserialize 8-bit signed int - -#if FW_HAS_16_BIT==1 - SerializeStatus deserialize(U16 &val); //!< deserialize 16-bit unsigned int - SerializeStatus deserialize(I16 &val); //!< deserialize 16-bit signed int -#endif - -#if FW_HAS_32_BIT==1 - SerializeStatus deserialize(U32 &val); //!< deserialize 32-bit unsigned int - SerializeStatus deserialize(I32 &val); //!< deserialize 32-bit signed int -#endif -#if FW_HAS_64_BIT==1 - SerializeStatus deserialize(U64 &val); //!< deserialize 64-bit unsigned int - SerializeStatus deserialize(I64 &val); //!< deserialize 64-bit signed int -#endif - SerializeStatus deserialize(F32 &val); //!< deserialize 32-bit floating point -#if FW_HAS_F64 - SerializeStatus deserialize(F64 &val); //!< deserialize 64-bit floating point -#endif - SerializeStatus deserialize(bool &val); //!< deserialize boolean - - SerializeStatus deserialize(void*& val); //!< deserialize point value (careful, pointer value only, not contents) - - // length should be set to max, returned value is actual size stored. If noLength - // is true, use the length variable as the actual number of bytes to deserialize - SerializeStatus deserialize(U8* buff, NATIVE_UINT_TYPE& length, bool noLength = false); //!< deserialize data buffer - // serialize/deserialize Serializable - - - SerializeStatus deserialize(Serializable &val); //!< deserialize an object derived from serializable base class - - SerializeStatus deserialize(SerializeBufferBase& val); //!< serialize a serialized buffer - - void resetSer(void); //!< reset to beginning of buffer to reuse for serialization - void resetDeser(void); //!< reset deserialization to beginning - - SerializeStatus deserializeSkip(NATIVE_UINT_TYPE numBytesToSkip); //!< Skips the number of specified bytes for deserialization - virtual NATIVE_UINT_TYPE getBuffCapacity(void) const = 0; //!< returns capacity, not current size, of buffer - NATIVE_UINT_TYPE getBuffLength() const; //!< returns current buffer size - NATIVE_UINT_TYPE getBuffLeft() const; //!< returns how much deserialization buffer is left - virtual U8* getBuffAddr(void) = 0; //!< gets buffer address for data filling - virtual const U8* getBuffAddr(void) const = 0; //!< gets buffer address for data reading, const version - const U8* getBuffAddrLeft(void) const; //!< gets address of remaining non-deserialized data. - U8* getBuffAddrSer(void); //!< gets address of end of serialization. DANGEROUS! Need to know max buffer size and adjust when done - SerializeStatus setBuff(const U8* src, NATIVE_UINT_TYPE length); //!< sets buffer contents and size - SerializeStatus setBuffLen(NATIVE_UINT_TYPE length); //!< sets buffer length manually after filling with data - SerializeStatus copyRaw(SerializeBufferBase& dest, NATIVE_UINT_TYPE size); //!< directly copies buffer without looking for a size in the stream. - // Will increment deserialization pointer - SerializeStatus copyRawOffset(SerializeBufferBase& dest, NATIVE_UINT_TYPE size); //!< directly copies buffer without looking for a size in the stream. - // Will increment deserialization pointer - - -#ifdef BUILD_UT - bool operator==(const SerializeBufferBase& other) const; - friend std::ostream& operator<<(std::ostream& os, const SerializeBufferBase& buff); -#endif - PROTECTED: - - SerializeBufferBase(); //!< default constructor - SerializeBufferBase(const SerializeBufferBase &src); //!< constructor with buffer as source - - PRIVATE: - void copyFrom(const SerializeBufferBase& src); //!< copy data from source buffer - NATIVE_UINT_TYPE m_serLoc; //!< current offset in buffer of serialized data - NATIVE_UINT_TYPE m_deserLoc; //!< current offset for deserialization - }; - - // Helper class for building buffers with external storage - - class ExternalSerializeBuffer : public SerializeBufferBase { - public: - ExternalSerializeBuffer(U8* buffPtr, NATIVE_UINT_TYPE size); //!< construct with external buffer - ExternalSerializeBuffer(); //!< default constructor - void setExtBuffer(U8* buffPtr, NATIVE_UINT_TYPE size); //!< Set the external buffer - void clear(void); //!< clear external buffer - - // pure virtual functions - NATIVE_UINT_TYPE getBuffCapacity(void) const; - U8* getBuffAddr(void); - const U8* getBuffAddr(void) const ; - - PRIVATE: - - // no copying - ExternalSerializeBuffer(ExternalSerializeBuffer& other); - ExternalSerializeBuffer(ExternalSerializeBuffer* other); - - // private data - U8* m_buff; //!< pointer to external buffer - NATIVE_UINT_TYPE m_buffSize; //!< size of external buffer - }; - -} -#endif diff --git a/docs/users-guide/examples/impl-abs-type/Fw/Types/StringType.hpp b/docs/users-guide/examples/impl-abs-type/Fw/Types/StringType.hpp deleted file mode 100644 index 34830f2eb..000000000 --- a/docs/users-guide/examples/impl-abs-type/Fw/Types/StringType.hpp +++ /dev/null @@ -1,57 +0,0 @@ -/** - * \file - * \author T. Canham - * \brief Declares ISF string base class - * - * \copyright - * Copyright 2009-2016, by the California Institute of Technology. - * ALL RIGHTS RESERVED. United States Government Sponsorship - * acknowledged. - * - */ - -#ifndef FW_STRING_TYPE_HPP -#define FW_STRING_TYPE_HPP - -#include -#include -#ifdef BUILD_UT -#include -#endif - -namespace Fw { - class StringBase : public Serializable { - public: - virtual const char* toChar(void) const = 0; // -#include // memcpy -#include -#include -#include - -#ifdef BUILD_UT -#include -#include -#endif - -// Some macros/functions to optimize for architectures - -namespace Fw { - - Serializable::Serializable() { - } - - Serializable::~Serializable() { - } - -#if FW_SERIALIZABLE_TO_STRING || BUILD_UT - - void Serializable::toString(StringBase& text) const { - text = "NOSPEC"; // set to not specified. - } - -#endif - -#ifdef BUILD_UT - std::ostream& operator<<(std::ostream& os, const Serializable& val) { - Fw::EightyCharString out; - val.toString(out); - - os << out; - - return os; - } -#endif - - SerializeBufferBase::SerializeBufferBase() : - m_serLoc(0), m_deserLoc(0) { - } - - SerializeBufferBase::~SerializeBufferBase() { - } - - void SerializeBufferBase::copyFrom(const SerializeBufferBase& src) { - this->m_serLoc = src.m_serLoc; - this->m_deserLoc = src.m_deserLoc; - FW_ASSERT(src.getBuffAddr()); - FW_ASSERT(this->getBuffAddr()); - // destination has to be same or bigger - FW_ASSERT(src.getBuffLength() <= this->getBuffCapacity(),src.getBuffLength(),this->getBuffLength()); - (void) memcpy(this->getBuffAddr(),src.getBuffAddr(),this->m_serLoc+1); - } - - SerializeBufferBase::SerializeBufferBase(const SerializeBufferBase &src) { - this->copyFrom(src); - } - - const SerializeBufferBase& SerializeBufferBase::operator=(const SerializeBufferBase &src) { - this->copyFrom(src); - return *this; - } - - // serialization routines - - SerializeStatus SerializeBufferBase::serialize(U8 val) { - if (this->m_serLoc + (NATIVE_UINT_TYPE) sizeof(val) - 1 >= this->getBuffCapacity()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - FW_ASSERT(this->getBuffAddr()); - this->getBuffAddr()[this->m_serLoc] = val; - this->m_serLoc += sizeof(val); - this->m_deserLoc = 0; - - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::serialize(I8 val) { - if (this->m_serLoc + (NATIVE_UINT_TYPE) sizeof(val) - 1 >= this->getBuffCapacity()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - FW_ASSERT(this->getBuffAddr()); - this->getBuffAddr()[this->m_serLoc + 0] = static_cast(val); - this->m_serLoc += sizeof(val); - this->m_deserLoc = 0; - return FW_SERIALIZE_OK; - } - -#if FW_HAS_16_BIT==1 - SerializeStatus SerializeBufferBase::serialize(U16 val) { - if (this->m_serLoc + (NATIVE_UINT_TYPE) sizeof(val) - 1 >= this->getBuffCapacity()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - FW_ASSERT(this->getBuffAddr()); - // MSB first - this->getBuffAddr()[this->m_serLoc + 0] = static_cast(val >> 8); - this->getBuffAddr()[this->m_serLoc + 1] = static_cast(val); - this->m_serLoc += sizeof(val); - this->m_deserLoc = 0; - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::serialize(I16 val) { - if (this->m_serLoc + (NATIVE_UINT_TYPE) sizeof(val) - 1 >= this->getBuffCapacity()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - FW_ASSERT(this->getBuffAddr()); - // MSB first - this->getBuffAddr()[this->m_serLoc + 0] = static_cast(val >> 8); - this->getBuffAddr()[this->m_serLoc + 1] = static_cast(val); - this->m_serLoc += sizeof(val); - this->m_deserLoc = 0; - return FW_SERIALIZE_OK; - } -#endif -#if FW_HAS_32_BIT==1 - SerializeStatus SerializeBufferBase::serialize(U32 val) { - if (this->m_serLoc + (NATIVE_UINT_TYPE) sizeof(val) - 1 >= this->getBuffCapacity()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - FW_ASSERT(this->getBuffAddr()); - // MSB first - this->getBuffAddr()[this->m_serLoc + 0] = static_cast(val >> 24); - this->getBuffAddr()[this->m_serLoc + 1] = static_cast(val >> 16); - this->getBuffAddr()[this->m_serLoc + 2] = static_cast(val >> 8); - this->getBuffAddr()[this->m_serLoc + 3] = static_cast(val); - this->m_serLoc += sizeof(val); - this->m_deserLoc = 0; - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::serialize(I32 val) { - if (this->m_serLoc + (NATIVE_UINT_TYPE) sizeof(val) - 1 >= this->getBuffCapacity()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - FW_ASSERT(this->getBuffAddr()); - // MSB first - this->getBuffAddr()[this->m_serLoc + 0] = static_cast(val >> 24); - this->getBuffAddr()[this->m_serLoc + 1] = static_cast(val >> 16); - this->getBuffAddr()[this->m_serLoc + 2] = static_cast(val >> 8); - this->getBuffAddr()[this->m_serLoc + 3] = static_cast(val); - this->m_serLoc += sizeof(val); - this->m_deserLoc = 0; - return FW_SERIALIZE_OK; - } -#endif - -#if FW_HAS_64_BIT==1 - SerializeStatus SerializeBufferBase::serialize(U64 val) { - if (this->m_serLoc + (NATIVE_UINT_TYPE) sizeof(val) - 1 >= this->getBuffCapacity()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - FW_ASSERT(this->getBuffAddr()); - // MSB first - this->getBuffAddr()[this->m_serLoc + 0] = static_cast(val >> 56); - this->getBuffAddr()[this->m_serLoc + 1] = static_cast(val >> 48); - this->getBuffAddr()[this->m_serLoc + 2] = static_cast(val >> 40); - this->getBuffAddr()[this->m_serLoc + 3] = static_cast(val >> 32); - this->getBuffAddr()[this->m_serLoc + 4] = static_cast(val >> 24); - this->getBuffAddr()[this->m_serLoc + 5] = static_cast(val >> 16); - this->getBuffAddr()[this->m_serLoc + 6] = static_cast(val >> 8); - this->getBuffAddr()[this->m_serLoc + 7] = static_cast(val); - this->m_serLoc += sizeof(val); - this->m_deserLoc = 0; - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::serialize(I64 val) { - if (this->m_serLoc + (NATIVE_UINT_TYPE) sizeof(val) - 1 >= this->getBuffCapacity()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - FW_ASSERT(this->getBuffAddr()); - // MSB first - this->getBuffAddr()[this->m_serLoc + 0] = static_cast(val >> 56); - this->getBuffAddr()[this->m_serLoc + 1] = static_cast(val >> 48); - this->getBuffAddr()[this->m_serLoc + 2] = static_cast(val >> 40); - this->getBuffAddr()[this->m_serLoc + 3] = static_cast(val >> 32); - this->getBuffAddr()[this->m_serLoc + 4] = static_cast(val >> 24); - this->getBuffAddr()[this->m_serLoc + 5] = static_cast(val >> 16); - this->getBuffAddr()[this->m_serLoc + 6] = static_cast(val >> 8); - this->getBuffAddr()[this->m_serLoc + 7] = static_cast(val); - this->m_serLoc += sizeof(val); - this->m_deserLoc = 0; - return FW_SERIALIZE_OK; - } -#endif - -#if FW_HAS_F64 - - SerializeStatus SerializeBufferBase::serialize(F64 val) { - // floating point values need to be byte-swapped as well, so copy to U64 and use that routine - U64 u64Val; - - *reinterpret_cast(&u64Val) = val; - return this->serialize(u64Val); - - } - -#endif - - SerializeStatus SerializeBufferBase::serialize(F32 val) { - - // floating point values need to be byte-swapped as well, so copy to U32 and use that routine - U32 u32Val; - - *reinterpret_cast(&u32Val) = val; - return this->serialize(u32Val); - - } - - SerializeStatus SerializeBufferBase::serialize(bool val) { - if (this->m_serLoc + (NATIVE_UINT_TYPE) sizeof(U8) - 1 >= this->getBuffCapacity()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - - FW_ASSERT(this->getBuffAddr()); - if (val) { - this->getBuffAddr()[this->m_serLoc + 0] = FW_SERIALIZE_TRUE_VALUE; - } else { - this->getBuffAddr()[this->m_serLoc + 0] = FW_SERIALIZE_FALSE_VALUE; - } - - this->m_serLoc += sizeof(U8); - this->m_deserLoc = 0; - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::serialize(const void* val) { - if (this->m_serLoc + (NATIVE_UINT_TYPE) sizeof(void*) - 1 - >= this->getBuffCapacity()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - - return this->serialize((POINTER_CAST) val); - - } - - SerializeStatus SerializeBufferBase::serialize(const U8* buff, NATIVE_UINT_TYPE length, bool noLength) { - // First serialize length - SerializeStatus stat; - if (not noLength) { - stat = this->serialize(static_cast(length)); - if (stat != FW_SERIALIZE_OK) { - return stat; - } - } - - // make sure we have enough space - if (this->m_serLoc + length > this->getBuffCapacity()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - - // copy buffer to our buffer - (void) memcpy(&this->getBuffAddr()[this->m_serLoc], buff, length); - this->m_serLoc += length; - this->m_deserLoc = 0; - - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::serialize(const Serializable &val) { - return val.serialize(*this); - } - - SerializeStatus SerializeBufferBase::serialize( - const SerializeBufferBase& val) { - NATIVE_UINT_TYPE size = val.getBuffLength(); - if (this->m_serLoc + size + (NATIVE_UINT_TYPE) sizeof(FwBuffSizeType) - > this->getBuffCapacity()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - - // First, serialize size - SerializeStatus stat = this->serialize((FwBuffSizeType)size); - if (stat != FW_SERIALIZE_OK) { - return stat; - } - - FW_ASSERT(this->getBuffAddr()); - FW_ASSERT(val.getBuffAddr()); - // serialize buffer - (void) memcpy(&this->getBuffAddr()[this->m_serLoc], val.getBuffAddr(), size); - this->m_serLoc += size; - this->m_deserLoc = 0; - - return FW_SERIALIZE_OK; - } - - // deserialization routines - - SerializeStatus SerializeBufferBase::deserialize(U8 &val) { - // check for room - if (this->getBuffLength() == this->m_deserLoc) { - return FW_DESERIALIZE_BUFFER_EMPTY; - } else if (this->getBuffLength() - this->m_deserLoc < (NATIVE_UINT_TYPE)sizeof(val)) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - // read from current location - FW_ASSERT(this->getBuffAddr()); - val = this->getBuffAddr()[this->m_deserLoc + 0]; - this->m_deserLoc += sizeof(val); - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::deserialize(I8 &val) { - // check for room - if (this->getBuffLength() == this->m_deserLoc) { - return FW_DESERIALIZE_BUFFER_EMPTY; - } else if (this->getBuffLength() - this->m_deserLoc < (NATIVE_UINT_TYPE)sizeof(val)) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - // read from current location - FW_ASSERT(this->getBuffAddr()); - val = (I8) this->getBuffAddr()[this->m_deserLoc + 0]; - this->m_deserLoc += sizeof(val); - return FW_SERIALIZE_OK; - } - -#if FW_HAS_16_BIT==1 - SerializeStatus SerializeBufferBase::deserialize(U16 &val) { - // check for room - if (this->getBuffLength() == this->m_deserLoc) { - return FW_DESERIALIZE_BUFFER_EMPTY; - } else if (this->getBuffLength() - this->m_deserLoc < (NATIVE_UINT_TYPE)sizeof(val)) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - // read from current location - FW_ASSERT(this->getBuffAddr()); - // MSB first - val = (U16) (this->getBuffAddr()[this->m_deserLoc + 1] << 0) - | (U16) (this->getBuffAddr()[this->m_deserLoc + 0] << 8); - this->m_deserLoc += sizeof(val); - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::deserialize(I16 &val) { - // check for room - if (this->getBuffLength() == this->m_deserLoc) { - return FW_DESERIALIZE_BUFFER_EMPTY; - } else if (this->getBuffLength() - this->m_deserLoc < (NATIVE_UINT_TYPE)sizeof(val)) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - // read from current location - FW_ASSERT(this->getBuffAddr()); - // MSB first - val = (I16) (this->getBuffAddr()[this->m_deserLoc + 1] << 0) - | (I16) (this->getBuffAddr()[this->m_deserLoc + 0] << 8); - this->m_deserLoc += sizeof(val); - return FW_SERIALIZE_OK; - } -#endif -#if FW_HAS_32_BIT==1 - SerializeStatus SerializeBufferBase::deserialize(U32 &val) { - // check for room - if (this->getBuffLength() == this->m_deserLoc) { - return FW_DESERIALIZE_BUFFER_EMPTY; - } else if (this->getBuffLength() - this->m_deserLoc < (NATIVE_UINT_TYPE)sizeof(val)) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - // read from current location - FW_ASSERT(this->getBuffAddr()); - // MSB first - val = ((U32) this->getBuffAddr()[this->m_deserLoc + 3] << 0) - | ((U32) this->getBuffAddr()[this->m_deserLoc + 2] << 8) - | ((U32) this->getBuffAddr()[this->m_deserLoc + 1] << 16) - | ((U32) this->getBuffAddr()[this->m_deserLoc + 0] << 24); - this->m_deserLoc += sizeof(val); - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::deserialize(I32 &val) { - // check for room - if (this->getBuffLength() == this->m_deserLoc) { - return FW_DESERIALIZE_BUFFER_EMPTY; - } else if (this->getBuffLength() - this->m_deserLoc < (NATIVE_UINT_TYPE)sizeof(val)) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - // read from current location - FW_ASSERT(this->getBuffAddr()); - // MSB first - val = ((U32) this->getBuffAddr()[this->m_deserLoc + 3] << 0) - | ((U32) this->getBuffAddr()[this->m_deserLoc + 2] << 8) - | ((U32) this->getBuffAddr()[this->m_deserLoc + 1] << 16) - | ((U32) this->getBuffAddr()[this->m_deserLoc + 0] << 24); - this->m_deserLoc += sizeof(val); - return FW_SERIALIZE_OK; - } -#endif - -#if FW_HAS_64_BIT==1 - - SerializeStatus SerializeBufferBase::deserialize(U64 &val) { - // check for room - if (this->getBuffLength() == this->m_deserLoc) { - return FW_DESERIALIZE_BUFFER_EMPTY; - } else if (this->getBuffLength() - this->m_deserLoc < (NATIVE_UINT_TYPE)sizeof(val)) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - // read from current location - FW_ASSERT(this->getBuffAddr()); - // MSB first - val = ((U64) this->getBuffAddr()[this->m_deserLoc + 7] << 0) - | ((U64) this->getBuffAddr()[this->m_deserLoc + 6] << 8) - | ((U64) this->getBuffAddr()[this->m_deserLoc + 5] << 16) - | ((U64) this->getBuffAddr()[this->m_deserLoc + 4] << 24) - | ((U64) this->getBuffAddr()[this->m_deserLoc + 3] << 32) - | ((U64) this->getBuffAddr()[this->m_deserLoc + 2] << 40) - | ((U64) this->getBuffAddr()[this->m_deserLoc + 1] << 48) - | ((U64) this->getBuffAddr()[this->m_deserLoc + 0] << 56); - - this->m_deserLoc += sizeof(val); - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::deserialize(I64 &val) { - // check for room - if (this->getBuffLength() == this->m_deserLoc) { - return FW_DESERIALIZE_BUFFER_EMPTY; - } else if (this->getBuffLength() - this->m_deserLoc < (NATIVE_UINT_TYPE)sizeof(val)) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - // read from current location - FW_ASSERT(this->getBuffAddr()); - // MSB first - val = ((I64) this->getBuffAddr()[this->m_deserLoc + 7] << 0) - | ((I64) this->getBuffAddr()[this->m_deserLoc + 6] << 8) - | ((I64) this->getBuffAddr()[this->m_deserLoc + 5] << 16) - | ((I64) this->getBuffAddr()[this->m_deserLoc + 4] << 24) - | ((I64) this->getBuffAddr()[this->m_deserLoc + 3] << 32) - | ((I64) this->getBuffAddr()[this->m_deserLoc + 2] << 40) - | ((I64) this->getBuffAddr()[this->m_deserLoc + 1] << 48) - | ((I64) this->getBuffAddr()[this->m_deserLoc + 0] << 56); - this->m_deserLoc += sizeof(val); - return FW_SERIALIZE_OK; - } -#endif - -#if FW_HAS_F64 - - SerializeStatus SerializeBufferBase::deserialize(F64 &val) { - - // deserialize as 64-bit int to handle endianness - U64 tempVal; - SerializeStatus stat = this->deserialize(tempVal); - if (stat != FW_SERIALIZE_OK) { - return stat; - } - - // copy to argument - val = *reinterpret_cast(&tempVal); - - return FW_SERIALIZE_OK; - } - -#endif - - SerializeStatus SerializeBufferBase::deserialize(bool &val) { - // check for room - if (this->getBuffLength() == this->m_deserLoc) { - return FW_DESERIALIZE_BUFFER_EMPTY; - } else if (this->getBuffLength() - this->m_deserLoc < (NATIVE_UINT_TYPE)sizeof(U8)) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - // read from current location - FW_ASSERT(this->getBuffAddr()); - if (FW_SERIALIZE_TRUE_VALUE == this->getBuffAddr()[this->m_deserLoc + 0]) { - val = true; - } else if (FW_SERIALIZE_FALSE_VALUE == this->getBuffAddr()[this->m_deserLoc + 0]) { - val = false; - } else { - return FW_DESERIALIZE_FORMAT_ERROR; - } - - this->m_deserLoc += sizeof(U8); - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::deserialize(void*& val) { - return this->deserialize((POINTER_CAST&) val); - } - - SerializeStatus SerializeBufferBase::deserialize(F32 &val) { - // deserialize as 64-bit int to handle endianness - U32 tempVal; - SerializeStatus stat = this->deserialize(tempVal); - if (stat != FW_SERIALIZE_OK) { - return stat; - } - - // copy to argument - val = *reinterpret_cast(&tempVal); - - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::deserialize(U8* buff, NATIVE_UINT_TYPE& length, bool noLength) { - - FW_ASSERT(this->getBuffAddr()); - - if (not noLength) { - FwBuffSizeType storedLength; - - SerializeStatus stat = this->deserialize(storedLength); - - if (stat != FW_SERIALIZE_OK) { - return stat; - } - - // make sure it fits - if ((storedLength > this->getBuffLeft()) or (storedLength > length)) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - - (void) memcpy(buff, &this->getBuffAddr()[this->m_deserLoc], storedLength); - - length = static_cast(storedLength); - - } else { - // make sure enough is left - if (length > this->getBuffLeft()) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - - (void) memcpy(buff, &this->getBuffAddr()[this->m_deserLoc], length); - } - - this->m_deserLoc += length; - return FW_SERIALIZE_OK; - } - - SerializeStatus SerializeBufferBase::deserialize(Serializable &val) { - return val.deserialize(*this); - } - - SerializeStatus SerializeBufferBase::deserialize(SerializeBufferBase& val) { - - FW_ASSERT(val.getBuffAddr()); - SerializeStatus stat = FW_SERIALIZE_OK; - - FwBuffSizeType storedLength; - - stat = this->deserialize(storedLength); - - if (stat != FW_SERIALIZE_OK) { - return stat; - } - - // make sure destination has enough room - - if ((storedLength > val.getBuffCapacity()) or (storedLength > this->getBuffLeft()) ) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - - FW_ASSERT(this->getBuffAddr()); - (void) memcpy(val.getBuffAddr(), &this->getBuffAddr()[this->m_deserLoc], - storedLength); - - stat = val.setBuffLen(storedLength); - - if (stat != FW_SERIALIZE_OK) { - return stat; - } - - this->m_deserLoc += storedLength; - - return FW_SERIALIZE_OK; - } - - void SerializeBufferBase::resetSer(void) { - this->m_deserLoc = 0; - this->m_serLoc = 0; - } - - void SerializeBufferBase::resetDeser(void) { - this->m_deserLoc = 0; - } - - SerializeStatus SerializeBufferBase::deserializeSkip(NATIVE_UINT_TYPE numBytesToSkip) - { - // check for room - if (this->getBuffLength() == this->m_deserLoc) { - return FW_DESERIALIZE_BUFFER_EMPTY; - } else if (this->getBuffLength() - this->m_deserLoc < numBytesToSkip) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - // update location in buffer to skip the value - this->m_deserLoc += numBytesToSkip; - return FW_SERIALIZE_OK; - } - - NATIVE_UINT_TYPE SerializeBufferBase::getBuffLength(void) const { - return this->m_serLoc; - } - - SerializeStatus SerializeBufferBase::setBuff(const U8* src, NATIVE_UINT_TYPE length) { - if (this->getBuffCapacity() < length) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } else { - FW_ASSERT(src); - FW_ASSERT(this->getBuffAddr()); - memcpy(this->getBuffAddr(), src, length); - this->m_serLoc = length; - this->m_deserLoc = 0; - return FW_SERIALIZE_OK; - } - } - - SerializeStatus SerializeBufferBase::setBuffLen(NATIVE_UINT_TYPE length) { - if (this->getBuffCapacity() < length) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } else { - this->m_serLoc = length; - this->m_deserLoc = 0; - return FW_SERIALIZE_OK; - } - } - - NATIVE_UINT_TYPE SerializeBufferBase::getBuffLeft(void) const { - return this->m_serLoc - this->m_deserLoc; - } - - SerializeStatus SerializeBufferBase::copyRaw(SerializeBufferBase& dest, NATIVE_UINT_TYPE size) { - // make sure there is sufficient size in destination - if (dest.getBuffCapacity() < size) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - // otherwise, set destination buffer to data from deserialization pointer plus size - SerializeStatus stat = dest.setBuff(&this->getBuffAddr()[this->m_deserLoc],size); - if (FW_SERIALIZE_OK) { - this->m_deserLoc += size; - } - return stat; - - } - - SerializeStatus SerializeBufferBase::copyRawOffset(SerializeBufferBase& dest, NATIVE_UINT_TYPE size) { - // make sure there is sufficient size in destination - if (dest.getBuffCapacity() < size + dest.getBuffLength()) { - return FW_SERIALIZE_NO_ROOM_LEFT; - } - // make sure there is sufficient buffer in source - if (this->getBuffLeft() < size) { - return FW_DESERIALIZE_SIZE_MISMATCH; - } - - // otherwise, serialize bytes to destination without writing length - SerializeStatus stat = dest.serialize(&this->getBuffAddr()[this->m_deserLoc], size, true); - if (stat == FW_SERIALIZE_OK) { - this->m_deserLoc += size; - } - return stat; - - } - - // return address of buffer not yet deserialized. This is used - // to copy the remainder of a buffer. - const U8* SerializeBufferBase::getBuffAddrLeft(void) const { - return &this->getBuffAddr()[this->m_deserLoc]; - } - - //!< gets address of end of serialization. Used to manually place data at the end - U8* SerializeBufferBase::getBuffAddrSer(void) { - return &this->getBuffAddr()[this->m_serLoc]; - } - -#ifdef BUILD_UT - bool SerializeBufferBase::operator==(const SerializeBufferBase& other) const { - if (this->getBuffLength() != other.getBuffLength()) { - return false; - } - - const U8* us = this->getBuffAddr(); - const U8* them = other.getBuffAddr(); - - FW_ASSERT(us); - FW_ASSERT(them); - - for (NATIVE_UINT_TYPE byte = 0; byte < this->getBuffLength(); byte++) { - if (us[byte] != them[byte]) { - return false; - } - } - - return true; - } - - std::ostream& operator<<(std::ostream& os, const SerializeBufferBase& buff) { - - const U8* us = buff.getBuffAddr(); - - FW_ASSERT(us); - - for (NATIVE_UINT_TYPE byte = 0; byte < buff.getBuffLength(); byte++) { - os << "[" << std::setw(2) << std::hex << std::setfill('0') << (NATIVE_UINT_TYPE)us[byte] << "]" << std::dec; - } - - return os; - } -#endif - - ExternalSerializeBuffer::ExternalSerializeBuffer(U8* buffPtr, NATIVE_UINT_TYPE size) { - this->setExtBuffer(buffPtr,size); - } - - ExternalSerializeBuffer::ExternalSerializeBuffer() { - this->clear(); - } - - void ExternalSerializeBuffer::setExtBuffer(U8* buffPtr, NATIVE_UINT_TYPE size) { - FW_ASSERT(buffPtr); - this->m_buff = buffPtr; - this->m_buffSize = size; - } - - void ExternalSerializeBuffer::clear(void) { - this->m_buff = 0; - this->m_buffSize = 0; - } - - NATIVE_UINT_TYPE ExternalSerializeBuffer::getBuffCapacity(void) const { - return this->m_buffSize; - } - - U8* ExternalSerializeBuffer::getBuffAddr(void) { - return this->m_buff; - } - - const U8* ExternalSerializeBuffer::getBuffAddr(void) const { - return this->m_buff; - } - -} - diff --git a/docs/users-guide/examples/impl-abs-type/StandardTypes.hpp b/docs/users-guide/examples/impl-abs-type/StandardTypes.hpp deleted file mode 100644 index 9a6118bd8..000000000 --- a/docs/users-guide/examples/impl-abs-type/StandardTypes.hpp +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/docs/users-guide/examples/impl-abs-type/StringType.cpp b/docs/users-guide/examples/impl-abs-type/StringType.cpp deleted file mode 100644 index 224579555..000000000 --- a/docs/users-guide/examples/impl-abs-type/StringType.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/** - * \file - * \author T. Canham - * \brief Implements ISF string base class - * - * \copyright - * Copyright 2009-2016, by the California Institute of Technology. - * ALL RIGHTS RESERVED. United States Government Sponsorship - * acknowledged. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -namespace Fw { - - StringBase::StringBase(void) { - } - - StringBase::~StringBase(void) { - } - - const char* StringBase::operator+=(const char* src) { - this->appendBuff(src, strnlen(src, this->getCapacity())); - return this->toChar(); - } - - const StringBase& StringBase::operator+=(const StringBase& src) { - this->appendBuff(src.toChar(), src.length()); - return *this; - } - - bool StringBase::operator==(const StringBase& other) const { - NATIVE_UINT_TYPE len = this->length(); - if (len != other.length()) { - return false; - } else { - return this->operator==(other.toChar()); - } - } - - bool StringBase::operator==(const char* other) const { - - const char *const us = this->toChar(); - if ((us == NULL) or (other == NULL)) { - return false; - } - - const NATIVE_UINT_TYPE capacity = this->getCapacity(); - const size_t result = strncmp(us, other, capacity); - return (result == 0); - - } - - void StringBase::format(const char* formatString, ...) { - char* us = (char*) this->toChar(); - NATIVE_UINT_TYPE cap = this->getCapacity(); - FW_ASSERT(us); - va_list args; - va_start(args, formatString); - (void) vsnprintf(us, cap, formatString, args); - va_end(args); - // null terminate - us[cap - 1] = 0; - } - - bool StringBase::operator!=(const StringBase& other) const { - return !operator==(other); - } - - bool StringBase::operator!=(const char* other) const { - return !operator==(other); - } - -#if FW_SERIALIZABLE_TO_STRING - void StringBase::toString(StringBase& text) const { - text = this->toChar(); - } -#endif - -#ifdef BUILD_UT - std::ostream& operator<<(std::ostream& os, const StringBase& str) - { - os << str.toChar(); - return os; - } -#endif - - const StringBase& StringBase::operator=(const StringBase& other) { - this->copyBuff(other.toChar(), this->getCapacity()); - return *this; - } - - const char* StringBase::operator=(const char* other) { - this->copyBuff(other, this->getCapacity()); - return this->toChar(); - } - - void StringBase::appendBuff(const char* buff, NATIVE_UINT_TYPE size) { - const U32 capacity = this->getCapacity(); - const U32 length = this->length(); - FW_ASSERT(capacity > length, capacity, length); - // Subtract 1 to leave space for null terminator - const U32 remaining = capacity - length - 1; - FW_ASSERT(remaining < capacity, remaining, capacity); - (void) strncat((char*) this->toChar(), buff, remaining); - } - -} diff --git a/docs/users-guide/examples/impl-abs-type/T.hpp b/docs/users-guide/examples/impl-abs-type/T.hpp deleted file mode 100644 index b30cd5b27..000000000 --- a/docs/users-guide/examples/impl-abs-type/T.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// A minimal implementation of abstract type T - -#ifndef T_HPP -#define T_HPP - -// Include Fw/Types/Serializable.fpp from the F Prime framework -#include "Fw/Types/Serializable.hpp" - -struct T : public Fw::Serializable { // Extend Fw::Serializable - - // Define some shorthand for F Prime types - typedef Fw::SerializeStatus SS; - typedef Fw::SerializeBufferBase B; - - // Define the constant SERIALIZED_SIZE - enum Constants { SERIALIZED_SIZE = sizeof(U32) }; - - // Provide a zero-argument constructor - T() : x(0) { } - - // Define a comparison operator - bool operator==(const T& that) const { return this->x == that.x; } - - // Define the virtual serialize method - SS serialize(B& b) const { return b.serialize(x); } - - // Define the virtual deserialize method - SS deserialize(B& b) { return b.deserialize(x); } - - // Provide some data - U32 x; - -}; - -#endif diff --git a/docs/users-guide/examples/impl-abs-type/T.hpp.do b/docs/users-guide/examples/impl-abs-type/T.hpp.do new file mode 100644 index 000000000..bd157196e --- /dev/null +++ b/docs/users-guide/examples/impl-abs-type/T.hpp.do @@ -0,0 +1,11 @@ +#!/bin/sh -e + +cd `dirname $0` + +redo-ifchange ../../Writing-C-Plus-Plus-Implementations.adoc + +awk ' +/\/\/ A minimal implementation/ { output = 1 } +output == 1 { print } +/#endif/ { output = 0 } +' ../../Writing-C-Plus-Plus-Implementations.adoc > $3 diff --git a/docs/users-guide/examples/impl-abs-type/a.out.do b/docs/users-guide/examples/impl-abs-type/a.out.do deleted file mode 100644 index 95b404315..000000000 --- a/docs/users-guide/examples/impl-abs-type/a.out.do +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -redo-ifchange `find . -name '*.hpp'` *.cpp -g++ -I . *.cpp -o $3 diff --git a/docs/users-guide/examples/impl-abs-type/all.do b/docs/users-guide/examples/impl-abs-type/all.do index 980a76b3b..a4911c430 100644 --- a/docs/users-guide/examples/impl-abs-type/all.do +++ b/docs/users-guide/examples/impl-abs-type/all.do @@ -1 +1 @@ -redo-ifchange a.out +redo check diff --git a/docs/users-guide/examples/impl-abs-type/check.do b/docs/users-guide/examples/impl-abs-type/check.do new file mode 100644 index 000000000..1b93a28df --- /dev/null +++ b/docs/users-guide/examples/impl-abs-type/check.do @@ -0,0 +1,7 @@ +#!/bin/sh +cd `dirname $0` + +exec 1>&2 +redo-always +redo-ifchange T.hpp +../../../../compiler/scripts/fprime-gcc T.hpp diff --git a/docs/users-guide/examples/impl-abs-type/clean.do b/docs/users-guide/examples/impl-abs-type/clean.do index 389846f2a..fb8dcc07a 100644 --- a/docs/users-guide/examples/impl-abs-type/clean.do +++ b/docs/users-guide/examples/impl-abs-type/clean.do @@ -1 +1 @@ -rm -f a.out +rm -f T.hpp T.hpp.gch diff --git a/docs/users-guide/examples/impl-abs-type/main.cpp b/docs/users-guide/examples/impl-abs-type/main.cpp deleted file mode 100644 index 037cdd4dd..000000000 --- a/docs/users-guide/examples/impl-abs-type/main.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "AArrayAc.hpp" - -int main() { - A a; - return 0; -}