19 #include <peak/dll_interface/peak_dll_interface_util.hpp> 80 ,
public std::enable_shared_from_this<Buffer>
84 ~
Buffer()
override =
default;
99 std::string
TLType()
const;
109 void* BasePtr()
const;
133 void* UserPtr()
const;
156 uint64_t PixelFormat()
const;
186 size_t ExpectedDataSize()
const;
196 size_t DeliveredDataSize()
const;
206 uint64_t FrameID()
const;
216 size_t ImageOffset()
const;
226 size_t DeliveredImageHeight()
const;
236 size_t DeliveredChunkPayloadSize()
const;
246 uint64_t ChunkLayoutID()
const;
256 std::string FileName()
const;
266 size_t Width()
const;
276 size_t Height()
const;
287 size_t XOffset()
const;
298 size_t YOffset()
const;
308 size_t XPadding()
const;
318 size_t YPadding()
const;
328 uint64_t Timestamp_ticks()
const;
338 uint64_t Timestamp_ns()
const;
349 bool IsQueued()
const;
361 bool IsAcquiring()
const;
374 bool IsIncomplete()
const;
385 bool HasNewData()
const;
398 bool HasImage()
const;
411 bool HasChunks()
const;
425 std::vector<std::shared_ptr<BufferChunk>> Chunks();
435 std::vector<std::shared_ptr<BufferPart>> Parts();
445 std::shared_ptr<DataStream> ParentDataStream()
const;
454 friend ClassCreator<Buffer>;
458 std::weak_ptr<DataStream> m_parentDataStream;
474 std::string entryString;
478 entryString =
"Unknown";
482 entryString =
"Image";
486 entryString =
"RawData";
490 entryString =
"File";
494 entryString =
"Chunk";
498 entryString =
"JPEG";
502 entryString =
"JPEG2000";
506 entryString =
"H264";
510 entryString =
"ChunkOnly";
514 entryString =
"DeviceSpecific";
518 entryString =
"MultiPart";
522 entryString =
"Custom";
530 std::string entryString;
538 entryString =
"IIDC";
542 entryString =
"PFNC16Bit";
546 entryString =
"PFNC32Bit";
550 entryString =
"Custom";
557 : m_backendHandle(bufferHandle)
558 , m_parentDataStream(parentDataStream)
563 return QueryRawInformationFromCInterfaceFunction([&](int32_t* dataType, uint8_t* buffer,
size_t* bufferSize) {
570 return QueryStringFromCInterfaceFunction([&](
char* tlType,
size_t* tlTypeSize) {
577 return QueryNumericFromCInterfaceFunction<void*>(
583 return QueryNumericFromCInterfaceFunction<size_t>(
589 return QueryNumericFromCInterfaceFunction<void*>(
603 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* pixelFormat) {
611 QueryNumericFromCInterfaceFunction<PEAK_PIXEL_FORMAT_NAMESPACE>(
614 m_backendHandle, pixelFormatNamespace);
621 QueryNumericFromCInterfaceFunction<PEAK_ENDIANNESS>([&](
PEAK_ENDIANNESS* pixelEndianness) {
628 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* expectedDataSize) {
635 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* deliveredDataSize) {
642 return QueryNumericFromCInterfaceFunction<uint64_t>(
648 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* imageOffset) {
655 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* deliveredImageHeight) {
662 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* deliveredChunkPayloadSize) {
664 m_backendHandle, deliveredChunkPayloadSize);
670 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* chunkLayoutId) {
677 return QueryStringFromCInterfaceFunction([&](
char* fileName,
size_t* fileNameSize) {
684 return QueryNumericFromCInterfaceFunction<size_t>(
690 return QueryNumericFromCInterfaceFunction<size_t>(
696 return QueryNumericFromCInterfaceFunction<size_t>(
702 return QueryNumericFromCInterfaceFunction<size_t>(
708 return QueryNumericFromCInterfaceFunction<size_t>(
714 return QueryNumericFromCInterfaceFunction<size_t>(
720 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* timestamp_ticks) {
727 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* timestamp_ns) {
734 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* isQueued) {
741 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* isAcquiring) {
748 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* isIncomplete) {
755 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasNewData) {
762 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasImage) {
769 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasChunks) {
778 auto numChunks = QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* _numChunks) {
782 std::vector<std::shared_ptr<BufferChunk>> chunks;
783 for (
size_t x = 0; x < numChunks; ++x)
785 auto bufferChunkHandle = QueryNumericFromCInterfaceFunction<PEAK_BUFFER_CHUNK_HANDLE>(
790 chunks.emplace_back(std::make_shared<ClassCreator<BufferChunk>>(bufferChunkHandle, shared_from_this()));
800 auto numParts = QueryNumericFromCInterfaceFunction<size_t>(
803 std::vector<std::shared_ptr<BufferPart>> parts;
804 for (
size_t x = 0; x < numParts; ++x)
806 auto bufferPartHandle = QueryNumericFromCInterfaceFunction<PEAK_BUFFER_PART_HANDLE>(
811 parts.emplace_back(std::make_shared<ClassCreator<BufferPart>>(bufferPartHandle, shared_from_this()));
819 return LockOrThrow(m_parentDataStream);
824 auto moduleHandle = QueryNumericFromCInterfaceFunction<PEAK_MODULE_HANDLE>(
834 auto eventSupportingModuleHandle = QueryNumericFromCInterfaceFunction<PEAK_EVENT_SUPPORTING_MODULE_HANDLE>(
837 m_backendHandle, _eventSupportingModuleHandle);
840 return eventSupportingModuleHandle;
843 inline void Buffer::Revoke()
845 m_parentDataStream.reset();
850 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasSupportedChunks) {
852 m_backendHandle, buffer->m_backendHandle, hasSupportedChunks);
858 CallAndCheckCInterfaceFunction([&] {
Represents a GenAPI node map.
Definition: peak_node_map.hpp:59
PEAK_C_API PEAK_Buffer_GetDeliveredImageHeight(PEAK_BUFFER_HANDLE bufferHandle, size_t *deliveredImageHeight)
Asks the given buffer for its delivered image height.
BufferPayloadType
Payload type of buffer.
Definition: peak_buffer.hpp:38
PEAK_C_API PEAK_Buffer_GetPayloadType(PEAK_BUFFER_HANDLE bufferHandle, PEAK_BUFFER_PAYLOAD_TYPE *payloadType)
Asks the given buffer for its payload type.
PEAK_C_API PEAK_Buffer_GetUserPtr(PEAK_BUFFER_HANDLE bufferHandle, void **userPtr)
Asks the given buffer for its user pointer.
std::string FileName() const
Returns the file name.
Definition: peak_buffer.hpp:675
uint64_t FrameID() const
Returns the frame ID.
Definition: peak_buffer.hpp:640
std::vector< std::shared_ptr< BufferChunk > > Chunks()
Returns the buffer's chunks if it contains chunks.
Definition: peak_buffer.hpp:774
PEAK_C_API PEAK_Buffer_GetHasChunks(PEAK_BUFFER_HANDLE bufferHandle, PEAK_BOOL8 *hasChunks)
Asks the given buffer whether it has chunks.
size_t XOffset() const
Returns the x offset of the data in the buffer in number of pixels from the image origin to handle ar...
Definition: peak_buffer.hpp:694
PEAK_C_API PEAK_Buffer_GetInfo(PEAK_BUFFER_HANDLE bufferHandle, int32_t infoCommand, int32_t *infoDataType, uint8_t *info, size_t *infoSize)
Asks the given buffer for an information based on a specific command.
void UpdateChunkNodes(const std::shared_ptr< Buffer > &buffer)
Updates chunk information in the NodeMap.
Definition: peak_buffer.hpp:856
RawInformation Info(int32_t infoCommand) const
Delivers information based on the given GenTL info command.
Definition: peak_buffer.hpp:561
PEAK_C_API PEAK_Buffer_GetHeight(PEAK_BUFFER_HANDLE bufferHandle, size_t *height)
Asks the given buffer for its height.
bool IsAcquiring() const
Checks whether the buffer is currently being filled.
Definition: peak_buffer.hpp:739
PEAK_C_API PEAK_Buffer_ToModule(PEAK_BUFFER_HANDLE bufferHandle, PEAK_MODULE_HANDLE *moduleHandle)
Casts the given buffer to a module.
bool IsQueued() const
Checks whether the buffer is queued or not.
Definition: peak_buffer.hpp:732
int8_t PEAK_BOOL8
Definition: peak_backend.h:26
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition: peak_dynamic_loader.h:32
size_t DeliveredChunkPayloadSize() const
Returns the delivered chunk payload size.
Definition: peak_buffer.hpp:660
struct PEAK_EVENT_SUPPORTING_MODULE * PEAK_EVENT_SUPPORTING_MODULE_HANDLE
Definition: peak_backend.h:457
PEAK_C_API PEAK_Buffer_GetTimestamp_ns(PEAK_BUFFER_HANDLE bufferHandle, uint64_t *timestamp_ns)
Asks the given buffer for its timestamp in nanoseconds.
PEAK_C_API PEAK_Buffer_GetChunkLayoutID(PEAK_BUFFER_HANDLE bufferHandle, uint64_t *chunkLayoutId)
Asks the given buffer for its chunk layout ID.
size_t Size() const
Returns the size of the buffer in bytes.
Definition: peak_buffer.hpp:581
size_t YOffset() const
Returns the y offset of the data in the buffer in number of lines from the image origin to handle are...
Definition: peak_buffer.hpp:700
std::string ToString(BufferPayloadType entry)
Definition: peak_buffer.hpp:472
uint64_t Timestamp_ticks() const
Returns the timestamp.
Definition: peak_buffer.hpp:718
PEAK_C_API PEAK_Buffer_GetPixelFormatNamespace(PEAK_BUFFER_HANDLE bufferHandle, PEAK_PIXEL_FORMAT_NAMESPACE *pixelFormatNamespace)
Asks the given buffer for its pixel format namespace.
PEAK_C_API PEAK_Buffer_GetExpectedDataSize(PEAK_BUFFER_HANDLE bufferHandle, size_t *expectedDataSize)
Asks the given buffer for its expected data size.
bool IsIncomplete() const
Checks whether the buffer is incomplete or not.
Definition: peak_buffer.hpp:746
Endianness
Endianness of pixel data in a Buffer or the data in a Port.
Definition: peak_common_enums.hpp:27
PEAK_C_API PEAK_Buffer_GetDeliveredChunkPayloadSize(PEAK_BUFFER_HANDLE bufferHandle, size_t *deliveredChunkPayloadSize)
Asks the given buffer for its delivered chunk payload size.
PEAK_C_API PEAK_Buffer_GetPart(PEAK_BUFFER_HANDLE bufferHandle, size_t index, PEAK_BUFFER_PART_HANDLE *bufferPartHandle)
Asks the given buffer for the part with the given index.
size_t Width() const
Returns the width.
Definition: peak_buffer.hpp:682
PEAK_C_API PEAK_Buffer_GetTimestamp_ticks(PEAK_BUFFER_HANDLE bufferHandle, uint64_t *timestamp_ticks)
Asks the given buffer for its timestamp in ticks.
uint64_t PixelFormat() const
Returns the pixel format of the data.
Definition: peak_buffer.hpp:601
BufferPayloadType PayloadType() const
Returns the payload type.
Definition: peak_buffer.hpp:593
int32_t PEAK_ENDIANNESS
Definition: peak_backend.h:155
size_t DeliveredImageHeight() const
Returns the delivered image height.
Definition: peak_buffer.hpp:653
PEAK_C_API PEAK_NodeMap_GetHasBufferSupportedChunks(PEAK_NODE_MAP_HANDLE nodeMapHandle, PEAK_BUFFER_HANDLE bufferHandle, PEAK_BOOL8 *hasSupportedChunks)
Checks if the buffer contains chunks corresponding to the node map.
PEAK_C_API PEAK_Buffer_GetYOffset(PEAK_BUFFER_HANDLE bufferHandle, size_t *yOffset)
Asks the given buffer for its Y offset.
PEAK_C_API PEAK_Buffer_GetXPadding(PEAK_BUFFER_HANDLE bufferHandle, size_t *xPadding)
Asks the given buffer for its X padding.
PEAK_C_API PEAK_Buffer_GetFileName(PEAK_BUFFER_HANDLE bufferHandle, char *fileName, size_t *fileNameSize)
Asks the given buffer for its file name.
PEAK_C_API PEAK_Buffer_GetHasNewData(PEAK_BUFFER_HANDLE bufferHandle, PEAK_BOOL8 *hasNewData)
Asks the given buffer whether it has new data since the last delivery.
PEAK_C_API PEAK_Buffer_GetNumParts(PEAK_BUFFER_HANDLE bufferHandle, size_t *numParts)
Asks the given buffer for its number of parts.
PEAK_C_API PEAK_Buffer_GetIsQueued(PEAK_BUFFER_HANDLE bufferHandle, PEAK_BOOL8 *isQueued)
Asks the given buffer whether it is queued.
Endianness PixelEndianness() const
Returns the pixel endianness.
Definition: peak_buffer.hpp:618
PEAK_C_API PEAK_Buffer_GetDeliveredDataSize(PEAK_BUFFER_HANDLE bufferHandle, size_t *deliveredDataSize)
Asks the given buffer for its delivered data size.
PEAK_C_API PEAK_Buffer_GetImageOffset(PEAK_BUFFER_HANDLE bufferHandle, size_t *imageOffset)
Asks the given buffer for its image offset.
struct PEAK_BUFFER * PEAK_BUFFER_HANDLE
Definition: peak_backend.h:385
PEAK_C_API PEAK_Buffer_ToEventSupportingModule(PEAK_BUFFER_HANDLE bufferHandle, PEAK_EVENT_SUPPORTING_MODULE_HANDLE *eventSupportingModuleHandle)
Casts the given buffer to an event-supporting module.
void * BasePtr() const
Returns the base pointer.
Definition: peak_buffer.hpp:575
size_t Height() const
Returns the height.
Definition: peak_buffer.hpp:688
void * UserPtr() const
Returns the pointer to custom user data attached to the buffer.
Definition: peak_buffer.hpp:587
PEAK_C_API PEAK_Buffer_UpdateParts(PEAK_BUFFER_HANDLE bufferHandle)
Tells the given buffer to update its parts.
std::string TLType() const
Returns the TL (transport layer) type.
Definition: peak_buffer.hpp:568
Represents a GenTL buffer module.
Definition: peak_buffer.hpp:78
PEAK_C_API PEAK_Buffer_GetBasePtr(PEAK_BUFFER_HANDLE bufferHandle, void **basePtr)
Asks the given buffer for its base pointer.
Represents a GenTL DataStream module.
Definition: peak_data_stream.hpp:181
bool HasImage() const
Checks whether the buffer contains image data.
Definition: peak_buffer.hpp:760
bool HasNewData() const
Checks whether the buffer has new data since the last delivery.
Definition: peak_buffer.hpp:753
size_t ExpectedDataSize() const
Returns the expected data size.
Definition: peak_buffer.hpp:626
PEAK_C_API PEAK_NodeMap_UpdateChunkNodes(PEAK_NODE_MAP_HANDLE nodeMapHandle, PEAK_BUFFER_HANDLE bufferHandle)
Updates chunk information in the node map.
PEAK_C_API PEAK_Buffer_GetIsAcquiring(PEAK_BUFFER_HANDLE bufferHandle, PEAK_BOOL8 *isAcquiring)
Asks the given buffer whether it is acquiring.
PEAK_C_API PEAK_Buffer_GetXOffset(PEAK_BUFFER_HANDLE bufferHandle, size_t *xOffset)
Asks the given buffer for its X offset.
PEAK_C_API PEAK_Buffer_UpdateChunks(PEAK_BUFFER_HANDLE bufferHandle)
Tells the given buffer to update its chunks.
size_t YPadding() const
Returns the y padding of the data in the buffer in number of bytes.
Definition: peak_buffer.hpp:712
size_t XPadding() const
Returns the x padding of the data in the buffer in number of bytes.
Definition: peak_buffer.hpp:706
PEAK_C_API PEAK_Buffer_GetNumChunks(PEAK_BUFFER_HANDLE bufferHandle, size_t *numChunks)
Asks the given buffer for its number of chunks.
PEAK_C_API PEAK_Buffer_GetHasImage(PEAK_BUFFER_HANDLE bufferHandle, PEAK_BOOL8 *hasImage)
Asks the given buffer whether it is has an image.
#define PEAK_C_ABI_PREFIX
Definition: peak_dll_defines.h:16
peak::core::PixelFormatNamespace PixelFormatNamespace() const
Returns the pixel format namespace, to allow interpretation of the PixelFormat(). ...
Definition: peak_buffer.hpp:608
PixelFormatNamespace
The namespace needed to interpret the pixel format value of the buffer.
Definition: peak_buffer.hpp:60
int32_t PEAK_BUFFER_PAYLOAD_TYPE
Definition: peak_backend.h:82
uint64_t ChunkLayoutID() const
Returns the chunk layout ID.
Definition: peak_buffer.hpp:668
std::vector< std::shared_ptr< BufferPart > > Parts()
Returns all buffer parts for multipart buffers.
Definition: peak_buffer.hpp:796
std::shared_ptr< DataStream > ParentDataStream() const
Returns the parent data stream.
Definition: peak_buffer.hpp:817
int32_t PEAK_PIXEL_FORMAT_NAMESPACE
Definition: peak_backend.h:301
PEAK_C_API PEAK_Buffer_GetTLType(PEAK_BUFFER_HANDLE bufferHandle, char *tlType, size_t *tlTypeSize)
Asks the given buffer for its TL type.
struct PEAK_BUFFER_CHUNK * PEAK_BUFFER_CHUNK_HANDLE
Definition: peak_backend.h:389
PEAK_C_API PEAK_Buffer_GetPixelFormat(PEAK_BUFFER_HANDLE bufferHandle, uint64_t *pixelFormat)
Asks the given buffer for its pixel format.
PEAK_C_API PEAK_Buffer_GetIsIncomplete(PEAK_BUFFER_HANDLE bufferHandle, PEAK_BOOL8 *isIncomplete)
Asks the given buffer whether it is incomplete.
struct PEAK_MODULE * PEAK_MODULE_HANDLE
Definition: peak_backend.h:401
PEAK_C_API PEAK_Buffer_GetSize(PEAK_BUFFER_HANDLE bufferHandle, size_t *size)
Asks the given buffer for its size.
bool HasBufferSupportedChunks(const std::shared_ptr< Buffer > &buffer) const
Checks if the Buffer contains chunks corresponding to the NodeMap.
Definition: peak_buffer.hpp:848
PEAK_C_API PEAK_Buffer_GetWidth(PEAK_BUFFER_HANDLE bufferHandle, size_t *width)
Asks the given buffer for its width.
size_t DeliveredDataSize() const
Returns the delivered data size.
Definition: peak_buffer.hpp:633
bool HasChunks() const
Checks whether the buffer contains chunks.
Definition: peak_buffer.hpp:767
PEAK_C_API PEAK_Buffer_GetFrameID(PEAK_BUFFER_HANDLE bufferHandle, uint64_t *frameId)
Asks the given buffer for its frame ID.
The base class for all modules being able to raise events.
Definition: peak_event_supporting_module.hpp:33
PEAK_C_API PEAK_Buffer_GetYPadding(PEAK_BUFFER_HANDLE bufferHandle, size_t *yPadding)
Asks the given buffer for its Y padding.
PEAK_C_API PEAK_Buffer_GetChunk(PEAK_BUFFER_HANDLE bufferHandle, size_t index, PEAK_BUFFER_CHUNK_HANDLE *bufferChunkHandle)
Asks the given buffer for the chunk with the given index.
struct PEAK_BUFFER_PART * PEAK_BUFFER_PART_HANDLE
Definition: peak_backend.h:393
size_t ImageOffset() const
Returns the offset of the image data from the beginning of the delivered buffer in bytes...
Definition: peak_buffer.hpp:646
uint64_t Timestamp_ns() const
Returns the timestamp.
Definition: peak_buffer.hpp:725
PEAK_C_API PEAK_Buffer_GetPixelEndianness(PEAK_BUFFER_HANDLE bufferHandle, PEAK_ENDIANNESS *pixelEndianness)
Asks the given buffer for its pixel endianness.