Fast DDS  Version 3.1.2
Fast DDS
Loading...
Searching...
No Matches
IPayloadPool Class Referenceabstract

An interface for classes responsible of serialized payload management. More...

#include <IPayloadPool.hpp>

Public Member Functions

virtual ~IPayloadPool ()=default
 
virtual bool get_payload (uint32_t size, SerializedPayload_t &payload)=0
 Get a serialized payload for a new sample.
 
virtual bool get_payload (const SerializedPayload_t &data, SerializedPayload_t &payload)=0
 Assign a serialized payload to a new sample.
 
virtual bool release_payload (SerializedPayload_t &payload)=0
 Release a serialized payload from a sample.
 

Detailed Description

An interface for classes responsible of serialized payload management.

Constructor & Destructor Documentation

◆ ~IPayloadPool()

virtual ~IPayloadPool ( )
virtualdefault

Member Function Documentation

◆ get_payload() [1/2]

virtual bool get_payload ( const SerializedPayload_t & data,
SerializedPayload_t & payload )
pure virtual

Assign a serialized payload to a new sample.

This method will usually be called when a reader receives a whole cache change.

Parameters
[in,out]dataSerialized payload received
[in,out]payloadDestination serialized payload
Returns
whether the operation succeeded or not
Note
If data has no owner, it means it is allocated on the stack of a reception thread, and a copy should be performed. If the ownership of data needs to be changed, a consecutive call to this method needs to be performed with the arguments swapped, leveraging the post-condition of this method which ensures that payload.payload_owner points to this.
Postcondition
  • Field payload.payload_owner equals this
  • Field payload.data points to a buffer of at least data.length bytes
  • Field payload.length is equal to data.length
  • Field payload.max_size is greater than or equal to data.length
  • Content of payload.data is the same as data.data

◆ get_payload() [2/2]

virtual bool get_payload ( uint32_t size,
SerializedPayload_t & payload )
pure virtual

Get a serialized payload for a new sample.

This method will usually be called in one of the following situations:

  • When a writer creates a new cache change
  • When a reader receives the first fragment of a cache change

In both cases, the received size will be for the whole serialized payload.

Parameters
[in]sizeNumber of bytes required for the serialized payload.
[in,out]payloadPayload of the cache change used in the operation
Returns
whether the operation succeeded or not
Postcondition
  • Field payload.payload_owner equals this
  • Field payload.data points to a buffer of at least size bytes
  • Field payload.max_size is greater than or equal to size

◆ release_payload()

virtual bool release_payload ( SerializedPayload_t & payload)
pure virtual

Release a serialized payload from a sample.

This method will be called when a cache change is removed from a history.

Parameters
[in,out]payloadPayload to be released
Returns
whether the operation succeeded or not
Precondition
  • Field payload_owner of payload equals this
Postcondition
  • Field payload_owner of payload is nullptr

The documentation for this class was generated from the following file: