19 #include <peak/dll_interface/peak_dll_interface_util.hpp> 80 ,
public std::enable_shared_from_this<Buffer>
84 ~
Buffer()
override =
default;
100 std::string
TLType()
const;
111 void* BasePtr()
const;
137 void* UserPtr()
const;
162 uint64_t PixelFormat()
const;
195 size_t ExpectedDataSize()
const;
206 size_t DeliveredDataSize()
const;
217 uint64_t FrameID()
const;
228 size_t ImageOffset()
const;
239 size_t DeliveredImageHeight()
const;
250 size_t DeliveredChunkPayloadSize()
const;
261 uint64_t ChunkLayoutID()
const;
272 std::string FileName()
const;
283 size_t Width()
const;
294 size_t Height()
const;
306 size_t XOffset()
const;
318 size_t YOffset()
const;
329 size_t XPadding()
const;
340 size_t YPadding()
const;
351 uint64_t Timestamp_ticks()
const;
362 uint64_t Timestamp_ns()
const;
374 bool IsQueued()
const;
387 bool IsAcquiring()
const;
401 bool IsIncomplete()
const;
413 bool HasNewData()
const;
427 bool HasImage()
const;
441 bool HasChunks()
const;
456 std::vector<std::shared_ptr<BufferChunk>> Chunks();
467 std::vector<std::shared_ptr<BufferPart>> Parts();
478 std::shared_ptr<DataStream> ParentDataStream()
const;
487 friend ClassCreator<Buffer>;
491 std::weak_ptr<DataStream> m_parentDataStream;
507 std::string entryString;
511 entryString =
"Unknown";
515 entryString =
"Image";
519 entryString =
"RawData";
523 entryString =
"File";
527 entryString =
"Chunk";
531 entryString =
"JPEG";
535 entryString =
"JPEG2000";
539 entryString =
"H264";
543 entryString =
"ChunkOnly";
547 entryString =
"DeviceSpecific";
551 entryString =
"MultiPart";
555 entryString =
"Custom";
563 std::string entryString;
571 entryString =
"IIDC";
575 entryString =
"PFNC16Bit";
579 entryString =
"PFNC32Bit";
583 entryString =
"Custom";
590 : m_backendHandle(bufferHandle)
591 , m_parentDataStream(parentDataStream)
596 return QueryRawInformationFromCInterfaceFunction([&](int32_t* dataType, uint8_t* buffer,
size_t* bufferSize) {
603 return QueryStringFromCInterfaceFunction([&](
char* tlType,
size_t* tlTypeSize) {
610 return QueryNumericFromCInterfaceFunction<void*>(
616 return QueryNumericFromCInterfaceFunction<size_t>(
622 return QueryNumericFromCInterfaceFunction<void*>(
636 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* pixelFormat) {
644 QueryNumericFromCInterfaceFunction<PEAK_PIXEL_FORMAT_NAMESPACE>(
647 m_backendHandle, pixelFormatNamespace);
654 QueryNumericFromCInterfaceFunction<PEAK_ENDIANNESS>([&](
PEAK_ENDIANNESS* pixelEndianness) {
661 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* expectedDataSize) {
668 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* deliveredDataSize) {
675 return QueryNumericFromCInterfaceFunction<uint64_t>(
681 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* imageOffset) {
688 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* deliveredImageHeight) {
695 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* deliveredChunkPayloadSize) {
697 m_backendHandle, deliveredChunkPayloadSize);
703 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* chunkLayoutId) {
710 return QueryStringFromCInterfaceFunction([&](
char* fileName,
size_t* fileNameSize) {
717 return QueryNumericFromCInterfaceFunction<size_t>(
723 return QueryNumericFromCInterfaceFunction<size_t>(
729 return QueryNumericFromCInterfaceFunction<size_t>(
735 return QueryNumericFromCInterfaceFunction<size_t>(
741 return QueryNumericFromCInterfaceFunction<size_t>(
747 return QueryNumericFromCInterfaceFunction<size_t>(
753 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* timestamp_ticks) {
760 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* timestamp_ns) {
767 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* isQueued) {
774 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* isAcquiring) {
781 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* isIncomplete) {
788 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasNewData) {
795 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasImage) {
802 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasChunks) {
811 auto numChunks = QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* _numChunks) {
815 std::vector<std::shared_ptr<BufferChunk>> chunks;
816 for (
size_t x = 0; x < numChunks; ++x)
818 auto bufferChunkHandle = QueryNumericFromCInterfaceFunction<PEAK_BUFFER_CHUNK_HANDLE>(
823 chunks.emplace_back(std::make_shared<ClassCreator<BufferChunk>>(bufferChunkHandle, shared_from_this()));
833 auto numParts = QueryNumericFromCInterfaceFunction<size_t>(
836 std::vector<std::shared_ptr<BufferPart>> parts;
837 for (
size_t x = 0; x < numParts; ++x)
839 auto bufferPartHandle = QueryNumericFromCInterfaceFunction<PEAK_BUFFER_PART_HANDLE>(
844 parts.emplace_back(std::make_shared<ClassCreator<BufferPart>>(bufferPartHandle, shared_from_this()));
852 return LockOrThrow(m_parentDataStream);
857 auto moduleHandle = QueryNumericFromCInterfaceFunction<PEAK_MODULE_HANDLE>(
867 auto eventSupportingModuleHandle = QueryNumericFromCInterfaceFunction<PEAK_EVENT_SUPPORTING_MODULE_HANDLE>(
870 m_backendHandle, _eventSupportingModuleHandle);
873 return eventSupportingModuleHandle;
876 inline void Buffer::Revoke()
878 m_parentDataStream.reset();
883 if (buffer ==
nullptr)
888 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasSupportedChunks) {
890 m_backendHandle, buffer->m_backendHandle, hasSupportedChunks);
896 if (buffer ==
nullptr)
901 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:708
uint64_t FrameID() const
Returns the frame ID.
Definition: peak_buffer.hpp:673
std::vector< std::shared_ptr< BufferChunk > > Chunks()
Returns the buffer's chunks if it contains chunks.
Definition: peak_buffer.hpp:807
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:727
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:894
RawInformation Info(int32_t infoCommand) const
Delivers information based on the given GenTL info command.
Definition: peak_buffer.hpp:594
PEAK_C_API PEAK_Buffer_GetHeight(PEAK_BUFFER_HANDLE bufferHandle, size_t *height)
Asks the given buffer for its height.
The exception thrown for pass an invalid argument to a function.
Definition: peak_exception.hpp:73
bool IsAcquiring() const
Checks whether the buffer is currently being filled.
Definition: peak_buffer.hpp:772
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:765
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:693
struct PEAK_EVENT_SUPPORTING_MODULE * PEAK_EVENT_SUPPORTING_MODULE_HANDLE
Definition: peak_backend.h:459
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:614
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:733
std::string ToString(BufferPayloadType entry)
Definition: peak_buffer.hpp:505
uint64_t Timestamp_ticks() const
Returns the timestamp.
Definition: peak_buffer.hpp:751
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:779
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:715
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:634
BufferPayloadType PayloadType() const
Returns the payload type.
Definition: peak_buffer.hpp:626
int32_t PEAK_ENDIANNESS
Definition: peak_backend.h:155
size_t DeliveredImageHeight() const
Returns the delivered image height.
Definition: peak_buffer.hpp:686
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:651
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:387
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:608
size_t Height() const
Returns the height.
Definition: peak_buffer.hpp:721
void * UserPtr() const
Returns the pointer to custom user data attached to the buffer.
Definition: peak_buffer.hpp:620
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:601
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:793
bool HasNewData() const
Checks whether the buffer has new data since the last delivery.
Definition: peak_buffer.hpp:786
size_t ExpectedDataSize() const
Returns the expected data size.
Definition: peak_buffer.hpp:659
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:745
size_t XPadding() const
Returns the x padding of the data in the buffer in number of bytes.
Definition: peak_buffer.hpp:739
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:641
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:701
std::vector< std::shared_ptr< BufferPart > > Parts()
Returns all buffer parts for multipart buffers.
Definition: peak_buffer.hpp:829
std::shared_ptr< DataStream > ParentDataStream() const
Returns the parent data stream.
Definition: peak_buffer.hpp:850
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:391
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:403
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:881
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:666
bool HasChunks() const
Checks whether the buffer contains chunks.
Definition: peak_buffer.hpp:800
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:395
size_t ImageOffset() const
Returns the offset of the image data from the beginning of the delivered buffer in bytes...
Definition: peak_buffer.hpp:679
uint64_t Timestamp_ns() const
Returns the timestamp.
Definition: peak_buffer.hpp:758
PEAK_C_API PEAK_Buffer_GetPixelEndianness(PEAK_BUFFER_HANDLE bufferHandle, PEAK_ENDIANNESS *pixelEndianness)
Asks the given buffer for its pixel endianness.