Class CMemBufferAccessorTx#
Defined in File mem_buffer_accessor.h
Inheritance Relationships#
Base Type#
public CMemBufferAccessorBase
(Class CMemBufferAccessorBase)
Class Documentation#
-
class CMemBufferAccessorTx : public CMemBufferAccessorBase#
Accessor TX implementation.
Public Functions
-
~CMemBufferAccessorTx()#
Destructor.
-
std::optional<CAccessorTxPacket> Reserve(uint32_t uiSize, uint32_t uiTimeoutMs = 1000)#
Reserve memory for writing to the buffer without an extra copy.
- Attention
The reader will only be able to continue reading after a commit. If, for some reason, there is no commit, the reader won’t be able to retrieve any more data.
- Attention
Performance is poor if the size is close to the buffer size. As a rule, uiSize should be at the most 1/4th of the buffer size.
- Parameters:
uiSize – [in] Size of the memory block to reserve. Must be smaller than the buffer size.
uiTimeoutMs – [in] The amount of time (in ms) to wait for a free buffer. Default 1000 ms (needed when allocating large chunks of data that need to be allocated on the receiving side).
- Returns:
Returns a packet object if successful or an empty option when a timeout occurred.
-
bool TryWrite(const void *pData, uint32_t uiSize)#
Write data to the buffer.
- Parameters:
pData – [in] Pointer to the data to write.
uiSize – [in] Length of the data in bytes.
- Returns:
Returns ‘true’ if writing was successful or ‘false’ if the packet was invalid or (currently) doesn’t fit into the buffer.
Public Static Functions
-
static inline EAccessType GetAccessType()#
Get the accessor access type.
- Returns:
The access type of this accessor.
-
~CMemBufferAccessorTx()#