Class CAccessorTxPacket#
Defined in File mem_buffer_accessor.h
Class Documentation#
-
class CAccessorTxPacket#
Tx access can be done randomly. To prevent shutting down while packets are reserved but not committed, the accessor packet take over the management of this.
Public Functions
-
CAccessorTxPacket() = default#
Default constructor.
-
CAccessorTxPacket(CMemBufferAccessorTx &rAccessor, CMemBufferAccessorBase::SPacketHdr *pPacketHdr)#
Constructor.
- Parameters:
rAccessor – [in] Reference to the accessor managing the buffer.
pPacketHdr – [in] Pointer to the packet header.
-
CAccessorTxPacket(const CAccessorTxPacket &rpacket) = delete#
Copy constructor is deleted.
- Parameters:
rpacket – [in] Reference to the packet to copy from.
-
CAccessorTxPacket(CAccessorTxPacket &&rpacket) noexcept#
Move constructor.
- Parameters:
rpacket – [in] Reference to the packet to move from.
-
~CAccessorTxPacket()#
Destructor - will automatically commit the packet if not done so already.
-
CAccessorTxPacket &operator=(const CAccessorTxPacket &rpacket) = delete#
Copy operator is deleted.
- Parameters:
rpacket – [in] Reference to the packet to copy from.
- Returns:
Reference to this packet class.
-
CAccessorTxPacket &operator=(CAccessorTxPacket &&rpacket) noexcept#
Copy operator is deleted.
- Parameters:
rpacket – [in] Reference to the packet to copy from.
- Returns:
Reference to this packet class.
-
operator bool() const#
Cast operator used to check validity.
-
bool IsValid() const#
Does the packet contain valid data (data is not committed yet).
- Returns:
The validity of the packet.
-
void Commit()#
Commit the data. This will invalidate the content.
-
uint32_t GetSize() const#
Get the size of the packet data.
- Returns:
The packet size; could be 0 when no data was allocated.
-
uint8_t *GetDataPtr()#
Get the packet pointer.
- Returns:
Pointer to the buffer holding the packet data or nullptr when there is no data allocated or the packet has been committed.
-
template<typename TData>
inline TData *GetDataPtr(uint32_t uiOffset = 0)# Templated version of GetData.
- Template Parameters:
TData – The type to cast the data pointer to.
- Parameters:
uiOffset – [in] The offset to use in bytes (default no offset).
- Returns:
Pointer to the data or NULL when the data doesn’t fit in the buffer.
-
CAccessorTxPacket() = default#