Raw data interface to a PvBuffer. More...
Public Member Functions | |
uint64_t | GetChunkDataPayloadLength () const |
Get the chunk data payload length specified in the trailer information of this block. More... | |
PvResult | Alloc (uint32_t aMaximumChunkLength) |
Allocates memory for this PvChunkData. More... | |
void | Free () |
Frees (de-allocates) the buffer's internal memory. | |
PvResult | Attach (void *aRawBuffer, uint32_t aMaximumChunkLength) |
Attach this PvChunkData to an external memory buffer. More... | |
uint8_t * | Detach () |
Releases an attached memory buffer. More... | |
PvResult | AddChunk (uint32_t aID, const uint8_t *aData, uint32_t aLength) |
See PvBuffer::AddChunk. More... | |
uint32_t | GetChunkCount () |
See PvBuffer::GetChunkCount. More... | |
PvResult | GetChunkIDByIndex (uint32_t aIndex, uint32_t &aID) |
See PvBuffer::GetChunkIDByIndex. More... | |
uint32_t | GetChunkSizeByIndex (uint32_t aIndex) |
See PvBuffer::GetChunkSizeByIndex. More... | |
uint32_t | GetChunkSizeByID (uint32_t aID) |
See PvBuffer::GetChunkSizeByID. More... | |
const uint8_t * | GetChunkRawDataByIndex (uint32_t aIndex) |
See PvBuffer::GetChunkRawDataByIndex. More... | |
const uint8_t * | GetChunkRawDataByID (uint32_t aID) |
See PvBuffer::GetChunkRawDataByID. More... | |
PvChunkData (PvBufferLib::ChunkData *aChunkData) | |
Constructor. More... | |
virtual | ~PvChunkData () |
Destructor. More... | |
Raw data interface to a PvBuffer.
A PvBuffer represents a generic buffer with no specific payload type. If the payload type is chunk data, the user can obtain a pointer to a PvChunkData buffer interface through PvBuffer::GetChunkData.
This PvChunkData pointer is owned by the PvBuffer and does not need to be released after use. It is valid as long as the PvBuffer exists.
To use in a receiver context, retrieve PvBuffer from PvStream or PvPipeline and when PvBuffer::GetPayloadType is PvPayloadChunkData use PvBuffer::GetChunkData to retrieve a pointer to this interface. Use the various chunk methods in this class to access the chunk data by ID or index or alternatively attach the PvBuffer to the GenApi interface of the transmitter with PvGenParameterArray::AttachDataChunks to access the chunk data using GenApi.
To use in a transmitter context, create a PvBuffer, set its payload type to PvPayloadChunkData with SetPayloadType, use PvBuffer::GetChunkData to retrieve a point to this interface, use PvChunkData::Alloc to allocate enough memory for all chunks and their headers (64 bytes per chunk for the headers) and then add chunks to the buffer using PvChunkData::AddChunk. Use PvTransmitterGEV to transmit the buffer.
PvChunkData::PvChunkData | ( | PvBufferLib::ChunkData * | aChunkData | ) |
Constructor.
Declared as protected as PvChunkData cannot be instantiated by the user.
A pointer to the PvChunkData interface can be obtained from a PvBuffer using PvChunkData::GetImage.
[in] | aChunkData | Pointer to internal eBUS SDK class. |
|
virtual |
Destructor.
Declared as protected as the user does no need (or can) delete a PvChunkData directly.
PvResult PvChunkData::AddChunk | ( | uint32_t | aID, |
const uint8_t * | aData, | ||
uint32_t | aLength | ||
) |
See PvBuffer::AddChunk.
Same as PvBuffer equivalent. Provided with this interface for convenience.
[in] | aID | Chunk data ID for aIndex. |
[in] | aData | Payload data of the chunk data. |
[in] | aLength | Length of the payload data of the chunk, in bytes. Must be a multiple of 4 bytes. |
PvResult PvChunkData::Alloc | ( | uint32_t | aMaximumChunkLength | ) |
Allocates memory for this PvChunkData.
Allocs a PvChunkData of specific payload length. No extra data can or need to be priovisioned for chunks as the whole payload is made of chunks.
[in] | aMaximumChunkLength | Maximum size in bytes to store chunk data (must include extra 64 bits for each chunk header). |
PvResult PvChunkData::Attach | ( | void * | aRawBuffer, |
uint32_t | aMaximumChunkLength | ||
) |
Attach this PvChunkData to an external memory buffer.
[in] | aRawBuffer | A pointer to the buffer. |
[in] | aMaximumChunkLength | Attached buffer size: chunk length sum + 64 bits for each chunk header. |
uint8_t * PvChunkData::Detach | ( | ) |
Releases an attached memory buffer.
Does nothing other then resetting the memory buffer pointer to NULL.
uint32_t PvChunkData::GetChunkCount | ( | ) |
Same as PvBuffer equivalent. Provided with this interface for convenience.
uint64_t PvChunkData::GetChunkDataPayloadLength | ( | ) | const |
Get the chunk data payload length specified in the trailer information of this block.
PvResult PvChunkData::GetChunkIDByIndex | ( | uint32_t | aIndex, |
uint32_t & | aID | ||
) |
See PvBuffer::GetChunkIDByIndex.
Same as PvBuffer equivalent. Provided with this interface for convenience.
[in] | aIndex | Data chunk index. |
[out] | aID | Data chunk ID for aIndex. |
const uint8_t * PvChunkData::GetChunkRawDataByID | ( | uint32_t | aID | ) |
See PvBuffer::GetChunkRawDataByID.
Same as PvBuffer equivalent. Provided with this interface for convenience.
If the aID chunk is not found or the PvBuffer does not have any chunks NULL is returned.
[in] | aID | Data chunk ID. |
const uint8_t * PvChunkData::GetChunkRawDataByIndex | ( | uint32_t | aIndex | ) |
See PvBuffer::GetChunkRawDataByIndex.
Same as PvBuffer equivalent. Provided with this interface for convenience.
[in] | aIndex | Data chunk index. |
uint32_t PvChunkData::GetChunkSizeByID | ( | uint32_t | aID | ) |
See PvBuffer::GetChunkSizeByID.
Same as PvBuffer equivalent. Provided with this interface for convenience.
[in] | aID | Data chunk ID. |
uint32_t PvChunkData::GetChunkSizeByIndex | ( | uint32_t | aIndex | ) |
See PvBuffer::GetChunkSizeByIndex.
Same as PvBuffer equivalent. Provided with this interface for convenience.
[in] | aIndex | Data chunk index. |
Copyright (c) 2002-2018 Pleora Technologies Inc.
www.pleora.com