class eCAL::CPayloadWriter
Base payload writer class to allow zero copy memory operations.
This class serves as the base class for payload writers, allowing zero-copy memory operations. The WriteFull
and WriteModified
calls may operate on the target memory file directly in zero-copy mode.
A partial writing / modification of the memory file is only possible when zero-copy mode is activated. If zero-copy is not enabled, the WriteModified
method is ignored and the WriteFull
method is always executed (see CPublisher::ShmEnableZeroCopy)
Members
public
CPayloadWriter
() = default
Default constructor for CPayloadWriter.
public virtual
~CPayloadWriter
() = default
Virtual destructor for CPayloadWriter.
public
CPayloadWriter
(const
CPayloadWriter
&) = default
Copy constructor (deleted).
public
CPayloadWriter
(
CPayloadWriter
&&) = default
Move constructor (deleted).
public
CPayloadWriter
&
operator=
(const
CPayloadWriter
&) = default
Copy assignment operator (deleted).
public
CPayloadWriter
&
operator=
(
CPayloadWriter
&&) = default
Move assignment operator (deleted).
public bool
WriteFull
(void * buffer_,size_t size_)
Perform a full write operation on uninitialized memory.
This virtual function allows derived classes to perform a full write operation when the provisioned memory is uninitialized. Typically, this is the case when a memory file had to be recreated or its size had to be changed.
Parameters
-
buffer_
Pointer to the buffer containing the data to be written. -
size_
Size of the data to be written.
Returns
True if the write operation is successful, false otherwise.
public inline virtual bool
WriteModified
(void * buffer_,size_t size_)
Perform a partial write operation to modify existing data.
This virtual function allows derived classes to modify existing data when the provisioned memory is already initialized by a WriteFull call (i.e. contains the data from that full write operation).
The memory can be partially modified and does not have to be completely rewritten, which leads to significantly higher performance (lower latency).
If not implemented (by default), this operation will just call the WriteFull
function.
Parameters
-
buffer_
Pointer to the buffer containing the data to be modified. -
size_
Size of the data to be modified.
Returns
True if the write/update operation is successful, false otherwise.
public size_t
GetSize
()
Get the size of the required memory.
This virtual function allows derived classes to provide the size of the memory that eCAL needs to allocate.
Returns
The size of the required memory.