Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Drv/Ports/DataTypes/DataBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DataBuffer : public Fw::SerializeBufferBase {
enum {
DATA_BUFFER_SIZE = 256,
SERIALIZED_TYPE_ID = 1010,
SERIALIZED_SIZE = DATA_BUFFER_SIZE + sizeof(FwBuffSizeType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(DATA_BUFFER_SIZE)
};

DataBuffer(const U8* args, FwSizeType size);
Expand Down
5 changes: 3 additions & 2 deletions Fw/Cmd/CmdArgBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ namespace Fw {
class CmdArgBuffer final : public SerializeBufferBase {
public:
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_CMD_BUFF, //!< type id for CmdArgBuffer
SERIALIZED_SIZE = FW_CMD_ARG_BUFFER_MAX_SIZE + sizeof(I32) //!< size when serialized. Buffer + size of buffer
SERIALIZED_TYPE_ID = FW_TYPEID_CMD_BUFF, //!< type id for CmdArgBuffer
SERIALIZED_SIZE =
STATIC_SERIALIZED_SIZE(FW_CMD_ARG_BUFFER_MAX_SIZE) //!< size when serialized. Buffer + size of buffer
};

CmdArgBuffer(const U8* args, FwSizeType size); //!< buffer source constructor
Expand Down
2 changes: 1 addition & 1 deletion Fw/Com/ComBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ComBuffer final : public SerializeBufferBase {
public:
enum {
SERIALIZED_TYPE_ID = 1010,
SERIALIZED_SIZE = FW_COM_BUFFER_MAX_SIZE + sizeof(FwBuffSizeType) // size of buffer + storage of size word
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(FW_COM_BUFFER_MAX_SIZE) // size of buffer + storage of size word
};

ComBuffer(const U8* args, FwSizeType size);
Expand Down
2 changes: 1 addition & 1 deletion Fw/Fpy/StatementArgBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class StatementArgBuffer : public SerializeBufferBase {
public:
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_TLM_BUFF,
SERIALIZED_SIZE = FW_STATEMENT_ARG_BUFFER_MAX_SIZE + sizeof(FwBuffSizeType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(FW_STATEMENT_ARG_BUFFER_MAX_SIZE)
};

StatementArgBuffer(const U8* args, FwSizeType size);
Expand Down
2 changes: 1 addition & 1 deletion Fw/Log/LogBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Fw {

class LogBuffer final : public SerializeBufferBase {
public:
enum { SERIALIZED_TYPE_ID = FW_TYPEID_LOG_BUFF, SERIALIZED_SIZE = FW_LOG_BUFFER_MAX_SIZE + sizeof(FwBuffSizeType) };
enum { SERIALIZED_TYPE_ID = FW_TYPEID_LOG_BUFF, SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(FW_LOG_BUFFER_MAX_SIZE) };

LogBuffer(const U8* args, FwSizeType size);
LogBuffer();
Expand Down
2 changes: 1 addition & 1 deletion Fw/Prm/PrmBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ParamBuffer final : public SerializeBufferBase {
public:
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_PRM_BUFF,
SERIALIZED_SIZE = FW_PARAM_BUFFER_MAX_SIZE + sizeof(FwBuffSizeType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(FW_PARAM_BUFFER_MAX_SIZE)
};

ParamBuffer(const U8* args, FwSizeType size);
Expand Down
2 changes: 1 addition & 1 deletion Fw/Sm/SmSignalBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SmSignalBuffer final : public SerializeBufferBase {
public:
enum {
SERIALIZED_TYPE_ID = 1010,
SERIALIZED_SIZE = FW_COM_BUFFER_MAX_SIZE + sizeof(FwSizeStoreType) // size of buffer + storage of size word
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(FW_COM_BUFFER_MAX_SIZE) // size of buffer + storage of size word
};

SmSignalBuffer(const U8* args, Serializable::SizeType size);
Expand Down
2 changes: 1 addition & 1 deletion Fw/Tlm/TlmBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Fw {

class TlmBuffer final : public SerializeBufferBase {
public:
enum { SERIALIZED_TYPE_ID = FW_TYPEID_TLM_BUFF, SERIALIZED_SIZE = FW_TLM_BUFFER_MAX_SIZE + sizeof(FwBuffSizeType) };
enum { SERIALIZED_TYPE_ID = FW_TYPEID_TLM_BUFF, SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(FW_TLM_BUFFER_MAX_SIZE) };

TlmBuffer(const U8* args, FwSizeType size);
TlmBuffer();
Expand Down
8 changes: 8 additions & 0 deletions Fw/Types/Serializable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,14 @@ class LinearBufferBase : public SerialBufferBase {
LinearBufferBase& operator=(const LinearBufferBase& src);

public:
//! \brief Get the static serialized size of a buffer
//! This is the max size of the buffer data plus the size of the stored size
static constexpr Serializable::SizeType STATIC_SERIALIZED_SIZE(
Serializable::SizeType maxSize //!< The maximum buffer data size
) {
return static_cast<Serializable::SizeType>(sizeof(FwSizeStoreType)) + maxSize;
}

//! \brief Destructor
//!
//! Destroys a LinearBufferBase instance. This is a virtual destructor
Expand Down
Loading