Vince Woo 48e4720419
Created new SerialBufferBase as a parent of SerializeBufferBase (now renamed LinearBufferBase). (#4288)
* Created new SerialBufferBase as a parent of SerializeBufferBase. Renaming interface functions to be less confusing.

* Deprecating copyRawOffset. No direct use-cases in F' core.

* Make SerialBufferBase a true pure virtual interface.

* Changing Serializable to work with SerialBufferBase parent interface.

* Changing copyRaw and copyRawOffset to work with SerialBufferBase

* Updating documentation for SerialBufferBase usage

* Adding some documentation. Adding missing ASSERT in copyRaw. Fixing some bugs that new ASSERT uncovered.

* Renaming SerializeBufferBase to LinearBufferBase. Add a using declaration to maintain backwards compatability. Properly mark LinearBufferBase functions as override.

* Filling in the rest of the docstrings for the classes in Serializable

* Removing redundant virtual keyword on override function

* Applying clang formatting

* Incorporating PR comments

* Fix compile issues

* Bump version to alpha

* Format

* v

---------

Co-authored-by: M Starch <LeStarch@googlemail.com>
2025-11-06 16:23:20 -08:00

220 lines
11 KiB
C++

// ======================================================================
// \title ActiveTest.hpp
// \author tiffany
// \brief hpp file for ActiveTest component implementation class
// ======================================================================
#ifndef ActiveTest_HPP
#define ActiveTest_HPP
#include "FppTest/component/active/ActiveTestComponentAc.hpp"
#include "FppTest/component/types/FormalParamTypes.hpp"
class ActiveTest : public ActiveTestComponentBase {
public:
// ----------------------------------------------------------------------
// Component construction and destruction
// ----------------------------------------------------------------------
//! Construct ActiveTest object
ActiveTest(const char* const compName //!< The component name
);
//! Destroy ActiveTest object
~ActiveTest();
private:
#define HAS_ASYNC
#include "FppTest/component/common/typed.hpp"
#include "FppTest/component/common/typed_async.hpp"
private:
// ----------------------------------------------------------------------
// Handler implementations for user-defined serial input ports
// ----------------------------------------------------------------------
//! Handler implementation for serialAsync
void serialAsync_handler(FwIndexType portNum, //!< The port number
Fw::LinearBufferBase& buffer //!< The serialization buffer
) override;
//! Handler implementation for serialAsyncAssert
void serialAsyncAssert_handler(FwIndexType portNum, //!< The port number
Fw::LinearBufferBase& buffer //!< The serialization buffer
) override;
//! Handler implementation for serialAsyncBlockPriority
void serialAsyncBlockPriority_handler(FwIndexType portNum, //!< The port number
Fw::LinearBufferBase& buffer //!< The serialization buffer
) override;
//! Handler implementation for serialAsyncDropPriority
void serialAsyncDropPriority_handler(FwIndexType portNum, //!< The port number
Fw::LinearBufferBase& buffer //!< The serialization buffer
) override;
//! Handler implementation for serialGuarded
void serialGuarded_handler(FwIndexType portNum, //!< The port number
Fw::LinearBufferBase& buffer //!< The serialization buffer
) override;
//! Handler implementation for serialSync
void serialSync_handler(FwIndexType portNum, //!< The port number
Fw::LinearBufferBase& buffer //!< The serialization buffer
) override;
private:
// ----------------------------------------------------------------------
// Handler implementations for commands
// ----------------------------------------------------------------------
//! Handler implementation for command CMD_NO_ARGS
void CMD_NO_ARGS_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq //!< The command sequence number
) override;
//! Handler implementation for command CMD_PRIMITIVE
void CMD_PRIMITIVE_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq, //!< The command sequence number
U32 u32_1, //!< A U32
U32 u32_2, //!< A U32
F32 f32_1, //!< An F32
F32 f32_2, //!< An F32
bool b1, //!< A boolean
bool b2 //!< A boolean
) override;
//! Handler implementation for command CMD_STRINGS
void CMD_STRINGS_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq, //!< The command sequence number
const Fw::CmdStringArg& str1, //!< A string
const Fw::CmdStringArg& str2 //!< Another string
) override;
//! Handler implementation for command CMD_ENUM
void CMD_ENUM_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq, //!< The command sequence number
FormalParamEnum en //!< An enum
) override;
//! Handler implementation for command CMD_ARRAY
void CMD_ARRAY_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq, //!< The command sequence number
FormalParamArray arr //!< An array
) override;
//! Handler implementation for command CMD_STRUCT
void CMD_STRUCT_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq, //!< The command sequence number
FormalParamStruct str //!< A struct
) override;
//! Handler implementation for command CMD_ASYNC_NO_ARGS
void CMD_ASYNC_NO_ARGS_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq //!< The command sequence number
) override;
//! Handler implementation for command CMD_ASYNC_PRIMITIVE
void CMD_ASYNC_PRIMITIVE_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq, //!< The command sequence number
U32 u32_1, //!< A U32
U32 u32_2, //!< A U32
F32 f32_1, //!< An F32
F32 f32_2, //!< An F32
bool b1, //!< A boolean
bool b2 //!< A boolean
) override;
//! Handler implementation for command CMD_ASYNC_STRINGS
void CMD_ASYNC_STRINGS_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq, //!< The command sequence number
const Fw::CmdStringArg& str1, //!< A string
const Fw::CmdStringArg& str2 //!< Another string
) override;
//! Handler implementation for command CMD_ASYNC_ENUM
void CMD_ASYNC_ENUM_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq, //!< The command sequence number
FormalParamEnum en //!< An enum
) override;
//! Handler implementation for command CMD_ASYNC_ARRAY
void CMD_ASYNC_ARRAY_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq, //!< The command sequence number
FormalParamArray arr //!< An array
) override;
//! Handler implementation for command CMD_ASYNC_STRUCT
void CMD_ASYNC_STRUCT_cmdHandler(FwOpcodeType opCode, //!< The opcode
U32 cmdSeq, //!< The command sequence number
FormalParamStruct str //!< A struct
) override;
private:
// ----------------------------------------------------------------------
// Handler implementations for user-defined internal interfaces
// ----------------------------------------------------------------------
//! Handler implementation for internalArray
void internalArray_internalInterfaceHandler(const FormalParamArray& arr //!< An array
) override;
//! Handler implementation for internalEnum
void internalEnum_internalInterfaceHandler(const FormalParamEnum& en //!< An enum
) override;
//! Handler implementation for internalNoArgs
void internalNoArgs_internalInterfaceHandler() override;
//! Handler implementation for internalPrimitive
void internalPrimitive_internalInterfaceHandler(U32 u32_1, //!< A U32
U32 u32_2, //!< A U32
F32 f32_1, //!< An F32
F32 f32_2, //!< An F32
bool b1, //!< A boolean
bool b2 //!< A boolean
) override;
//! Handler implementation for internalString
void internalString_internalInterfaceHandler(const Fw::InternalInterfaceString& str1, //!< A string
const Fw::InternalInterfaceString& str2 //!< Another string
) override;
//! Handler implementation for internalStruct
void internalStruct_internalInterfaceHandler(const FormalParamStruct& str //!< A struct
) override;
private:
// ----------------------------------------------------------------------
// Overflow hook implementations for user-defined async ports interfaces
// ----------------------------------------------------------------------
//! Overflow hook implementation for enumArgsOverflow
void enumArgsHook_overflowHook(FwIndexType portNum, //!< The port number
const FormalParamEnum& en, //!< An enum
FormalParamEnum& enRef, //!< An enum ref
const FormalAliasEnum& enA, //!< An enum alias
FormalAliasEnum& enARef //!< An enum alias ref
) override;
public:
//! Enables checking the serialization status of serial port invocations
Fw::SerializeStatus serializeStatus;
// Command test values
FppTest::Types::PrimitiveParams primitiveCmd;
FppTest::Types::CmdStringParams stringCmd;
FppTest::Types::EnumParam enumCmd;
FppTest::Types::ArrayParam arrayCmd;
FppTest::Types::StructParam structCmd;
// Internal interface test values
FppTest::Types::PrimitiveParams primitiveInterface;
FppTest::Types::InternalInterfaceStringParams stringInterface;
FppTest::Types::EnumParam enumInterface;
FppTest::Types::ArrayParam arrayInterface;
FppTest::Types::StructParam structInterface;
};
#endif