20#include <peak/dll_interface/peak_dll_interface_util.hpp>
83 ,
public std::enable_shared_from_this<Buffer>
110 std::string
TLType()
const;
308 size_t Width()
const;
505 std::vector<std::shared_ptr<BufferChunk>>
Chunks();
516 std::vector<std::shared_ptr<BufferPart>>
Parts();
536 friend ClassCreator<Buffer>;
540 std::weak_ptr<DataStream> m_parentDataStream;
556 std::string entryString;
560 entryString =
"Unknown";
564 entryString =
"Image";
568 entryString =
"RawData";
572 entryString =
"File";
576 entryString =
"Chunk";
580 entryString =
"JPEG";
584 entryString =
"JPEG2000";
588 entryString =
"H264";
592 entryString =
"ChunkOnly";
596 entryString =
"DeviceSpecific";
600 entryString =
"MultiPart";
604 entryString =
"Custom";
612 std::string entryString;
620 entryString =
"IIDC";
624 entryString =
"PFNC16Bit";
628 entryString =
"PFNC32Bit";
632 entryString =
"Custom";
639 : m_backendHandle(bufferHandle)
640 , m_parentDataStream(parentDataStream)
650 return QueryRawInformationFromCInterfaceFunction([&](int32_t* dataType, uint8_t* buffer,
size_t* bufferSize) {
657 return QueryStringFromCInterfaceFunction([&](
char* tlType,
size_t* tlTypeSize) {
664 return QueryNumericFromCInterfaceFunction<void*>(
670 return QueryNumericFromCInterfaceFunction<size_t>(
676 return QueryNumericFromCInterfaceFunction<void*>(
690 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* pixelFormat) {
698 QueryNumericFromCInterfaceFunction<PEAK_PIXEL_FORMAT_NAMESPACE>(
701 m_backendHandle, pixelFormatNamespace);
708 QueryNumericFromCInterfaceFunction<PEAK_ENDIANNESS>([&](
PEAK_ENDIANNESS* pixelEndianness) {
715 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* expectedDataSize) {
722 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* deliveredDataSize) {
729 return QueryNumericFromCInterfaceFunction<uint64_t>(
735 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* imageOffset) {
742 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* deliveredImageHeight) {
749 return QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* deliveredChunkPayloadSize) {
751 m_backendHandle, deliveredChunkPayloadSize);
757 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* chunkLayoutId) {
764 return QueryStringFromCInterfaceFunction([&](
char* fileName,
size_t* fileNameSize) {
771 return QueryNumericFromCInterfaceFunction<size_t>(
777 return QueryNumericFromCInterfaceFunction<size_t>(
783 return QueryNumericFromCInterfaceFunction<size_t>(
789 return QueryNumericFromCInterfaceFunction<size_t>(
795 return QueryNumericFromCInterfaceFunction<size_t>(
801 return QueryNumericFromCInterfaceFunction<size_t>(
807 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* timestamp_ticks) {
814 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* timestamp_ns) {
821 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* isQueued) {
828 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* isAcquiring) {
835 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* isIncomplete) {
842 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasNewData) {
849 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasImage) {
856 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasChunks) {
863 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasParts) {
872 auto numChunks = QueryNumericFromCInterfaceFunction<size_t>([&](
size_t* _numChunks) {
876 std::vector<std::shared_ptr<BufferChunk>> chunks;
877 for (
size_t x = 0; x < numChunks; ++x)
879 auto bufferChunkHandle = QueryNumericFromCInterfaceFunction<PEAK_BUFFER_CHUNK_HANDLE>(
884 chunks.emplace_back(std::make_shared<ClassCreator<BufferChunk>>(bufferChunkHandle, shared_from_this()));
894 auto numParts = QueryNumericFromCInterfaceFunction<size_t>(
897 std::vector<std::shared_ptr<BufferPart>> parts;
898 for (
size_t x = 0; x < numParts; ++x)
900 auto bufferPartHandle = QueryNumericFromCInterfaceFunction<PEAK_BUFFER_PART_HANDLE>(
905 parts.emplace_back(std::make_shared<ClassCreator<BufferPart>>(bufferPartHandle, shared_from_this()));
913 return LockOrThrow(m_parentDataStream);
918 auto moduleHandle = QueryNumericFromCInterfaceFunction<PEAK_MODULE_HANDLE>(
928 auto eventSupportingModuleHandle = QueryNumericFromCInterfaceFunction<PEAK_EVENT_SUPPORTING_MODULE_HANDLE>(
931 m_backendHandle, _eventSupportingModuleHandle);
934 return eventSupportingModuleHandle;
937inline void Buffer::Revoke()
939 m_parentDataStream.reset();
944 if (buffer ==
nullptr)
949 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](
PEAK_BOOL8* hasSupportedChunks) {
951 m_backendHandle, buffer->m_backendHandle, hasSupportedChunks);
957 if (buffer ==
nullptr)
962 CallAndCheckCInterfaceFunction([&] {
bool IsQueued() const
Checks whether the buffer is queued or not.
Definition peak_buffer.hpp:819
size_t DeliveredImageHeight() const
Returns the delivered image height.
Definition peak_buffer.hpp:740
bool IsIncomplete() const
Checks whether the buffer is incomplete or not.
Definition peak_buffer.hpp:833
Buffer & operator=(Buffer &&other)=delete
void * BasePtr() const
Returns the base pointer.
Definition peak_buffer.hpp:662
uint64_t Timestamp_ticks() const
Returns the timestamp.
Definition peak_buffer.hpp:805
bool HasParts() const
Checks whether the buffer contains parts.
Definition peak_buffer.hpp:861
Buffer(Buffer &&other)=delete
uint64_t FrameID() const
Returns the identifier of the current frame.
Definition peak_buffer.hpp:727
bool IsAcquiring() const
Checks whether the buffer is currently being filled.
Definition peak_buffer.hpp:826
peak::core::PixelFormatNamespace PixelFormatNamespace() const
Returns the pixel format namespace, to allow interpretation of the PixelFormat().
Definition peak_buffer.hpp:695
bool HasNewData() const
Checks whether the buffer has new data since the last delivery.
Definition peak_buffer.hpp:840
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:781
void * UserPtr() const
Returns the pointer to custom user data attached to the buffer.
Definition peak_buffer.hpp:674
RawInformation Info(int32_t infoCommand) const
Delivers information based on the given GenTL info command.
Definition peak_buffer.hpp:648
size_t Size() const
Returns the size of the buffer in bytes.
Definition peak_buffer.hpp:668
size_t XPadding() const
Returns the x padding of the data in the buffer in number of bytes.
Definition peak_buffer.hpp:793
friend class DataStream
Definition peak_buffer.hpp:542
size_t Height() const
Returns the height.
Definition peak_buffer.hpp:775
std::shared_ptr< DataStream > ParentDataStream() const
Returns the parent data stream.
Definition peak_buffer.hpp:911
size_t DeliveredDataSize() const
Returns the delivered data size.
Definition peak_buffer.hpp:720
bool HasImage() const
Checks whether the buffer contains image data.
Definition peak_buffer.hpp:847
std::vector< std::shared_ptr< BufferChunk > > Chunks()
Returns the buffer's chunks if it contains chunks.
Definition peak_buffer.hpp:868
ImageView ToImageView()
Create an ImageView object from this buffer.
Definition peak_buffer.hpp:643
uint64_t PixelFormat() const
Returns the pixel format of the data.
Definition peak_buffer.hpp:688
BufferPayloadType PayloadType() const
Returns the payload type.
Definition peak_buffer.hpp:680
uint64_t ChunkLayoutID() const
Returns the chunk layout ID.
Definition peak_buffer.hpp:755
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:787
Endianness PixelEndianness() const
Returns the pixel endianness.
Definition peak_buffer.hpp:705
size_t ImageOffset() const
Returns the offset of the image data from the beginning of the delivered buffer in bytes.
Definition peak_buffer.hpp:733
std::string TLType() const
Returns the TL (transport layer) type.
Definition peak_buffer.hpp:655
size_t YPadding() const
Returns the y padding of the data in the buffer in number of bytes.
Definition peak_buffer.hpp:799
size_t DeliveredChunkPayloadSize() const
Returns the delivered chunk payload size.
Definition peak_buffer.hpp:747
size_t ExpectedDataSize() const
Returns the expected data size.
Definition peak_buffer.hpp:713
std::vector< std::shared_ptr< BufferPart > > Parts()
Returns all buffer parts for multipart buffers.
Definition peak_buffer.hpp:890
~Buffer() override=default
size_t Width() const
Returns the width.
Definition peak_buffer.hpp:769
Buffer(const Buffer &other)=delete
Buffer & operator=(const Buffer &other)=delete
uint64_t Timestamp_ns() const
Returns the timestamp associated with when the image was recorded.
Definition peak_buffer.hpp:812
std::string FileName() const
Retrieves the file name.
Definition peak_buffer.hpp:762
bool HasChunks() const
Checks whether the buffer contains chunks.
Definition peak_buffer.hpp:854
EventSupportingModule()=default
Implementation of the peak::common::IImageView interface for viewing image pixel data from arbitrary ...
Definition peak_image_view.hpp:44
The exception thrown for passing an invalid argument to a function.
Definition peak_exception.hpp:109
void UpdateChunkNodes(const std::shared_ptr< Buffer > &buffer)
Updates chunk information in the NodeMap.
Definition peak_buffer.hpp:955
bool HasBufferSupportedChunks(const std::shared_ptr< Buffer > &buffer) const
Checks if the Buffer contains chunks corresponding to the NodeMap.
Definition peak_buffer.hpp:942
The "core" namespace contains the direct GenAPI and GenTL wrapper.
Definition peak_buffer.hpp:34
std::string ToString(BufferPayloadType entry)
Definition peak_buffer.hpp:554
Endianness
Endianness of pixel data in a Buffer or the data in a Port.
Definition peak_common_enums.hpp:28
BufferPayloadType
Payload type of buffer.
Definition peak_buffer.hpp:42
@ File
Definition peak_buffer.hpp:46
@ DeviceSpecific
Definition peak_buffer.hpp:52
@ MultiPart
Definition peak_buffer.hpp:53
@ Unknown
Definition peak_buffer.hpp:43
@ Chunk
Definition peak_buffer.hpp:47
@ H264
Definition peak_buffer.hpp:50
@ Custom
Definition peak_buffer.hpp:55
@ JPEG
Definition peak_buffer.hpp:48
@ JPEG2000
Definition peak_buffer.hpp:49
@ Image
Definition peak_buffer.hpp:44
@ RawData
Definition peak_buffer.hpp:45
@ ChunkOnly
Definition peak_buffer.hpp:51
PixelFormatNamespace
The namespace needed to interpret the pixel format value of the buffer.
Definition peak_buffer.hpp:64
@ GEV
Definition peak_buffer.hpp:65
@ PFNC16Bit
Definition peak_buffer.hpp:67
@ Custom
Definition peak_buffer.hpp:70
@ IIDC
Definition peak_buffer.hpp:66
@ PFNC32Bit
Definition peak_buffer.hpp:68
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_dynamic_loader.h:33
PEAK_C_API PEAK_Buffer_GetHasParts(PEAK_BUFFER_HANDLE bufferHandle, PEAK_BOOL8 *hasParts)
Asks the given buffer whether it has parts.
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.
PEAK_C_API PEAK_Buffer_GetHasChunks(PEAK_BUFFER_HANDLE bufferHandle, PEAK_BOOL8 *hasChunks)
Asks the given buffer whether it has chunks.
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.
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_GetFrameID(PEAK_BUFFER_HANDLE bufferHandle, uint64_t *frameId)
Asks the given buffer for its frame ID.
struct PEAK_MODULE * PEAK_MODULE_HANDLE
Definition peak_backend.h:421
PEAK_C_API PEAK_Buffer_GetIsIncomplete(PEAK_BUFFER_HANDLE bufferHandle, PEAK_BOOL8 *isIncomplete)
Asks the given buffer whether it is incomplete.
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.
PEAK_C_API PEAK_Buffer_GetSize(PEAK_BUFFER_HANDLE bufferHandle, size_t *size)
Asks the given buffer for its size.
PEAK_C_API PEAK_Buffer_GetNumChunks(PEAK_BUFFER_HANDLE bufferHandle, size_t *numChunks)
Asks the given buffer for its number of chunks.
struct PEAK_BUFFER_CHUNK * PEAK_BUFFER_CHUNK_HANDLE
Definition peak_backend.h:409
PEAK_C_API PEAK_Buffer_GetUserPtr(PEAK_BUFFER_HANDLE bufferHandle, void **userPtr)
Asks the given buffer for its user pointer.
PEAK_C_API PEAK_Buffer_UpdateParts(PEAK_BUFFER_HANDLE bufferHandle)
Tells the given buffer to update its parts.
PEAK_C_API PEAK_Buffer_GetTimestamp_ns(PEAK_BUFFER_HANDLE bufferHandle, uint64_t *timestamp_ns)
Asks the given buffer for its timestamp in nanoseconds.
struct PEAK_BUFFER * PEAK_BUFFER_HANDLE
Definition peak_backend.h:405
struct PEAK_EVENT_SUPPORTING_MODULE * PEAK_EVENT_SUPPORTING_MODULE_HANDLE
Definition peak_backend.h:477
PEAK_C_API PEAK_Buffer_GetTimestamp_ticks(PEAK_BUFFER_HANDLE bufferHandle, uint64_t *timestamp_ticks)
Asks the given buffer for its timestamp in ticks.
PEAK_C_API PEAK_Buffer_GetBasePtr(PEAK_BUFFER_HANDLE bufferHandle, void **basePtr)
Asks the given buffer for its base pointer.
PEAK_C_API PEAK_Buffer_GetPixelEndianness(PEAK_BUFFER_HANDLE bufferHandle, PEAK_ENDIANNESS *pixelEndianness)
Asks the given buffer for its pixel endianness.
PEAK_C_API PEAK_Buffer_GetImageOffset(PEAK_BUFFER_HANDLE bufferHandle, size_t *imageOffset)
Asks the given buffer for its image offset.
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_GetWidth(PEAK_BUFFER_HANDLE bufferHandle, size_t *width)
Asks the given buffer for its width.
struct PEAK_BUFFER_PART * PEAK_BUFFER_PART_HANDLE
Definition peak_backend.h:413
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.
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_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.
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_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_GetDeliveredChunkPayloadSize(PEAK_BUFFER_HANDLE bufferHandle, size_t *deliveredChunkPayloadSize)
Asks the given buffer for its delivered chunk payload size.
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.
int8_t PEAK_BOOL8
Definition peak_backend.h:43
int32_t PEAK_ENDIANNESS
Definition peak_backend.h:172
PEAK_C_API PEAK_Buffer_GetHeight(PEAK_BUFFER_HANDLE bufferHandle, size_t *height)
Asks the given buffer for its height.
int32_t PEAK_PIXEL_FORMAT_NAMESPACE
Definition peak_backend.h:318
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_ToModule(PEAK_BUFFER_HANDLE bufferHandle, PEAK_MODULE_HANDLE *moduleHandle)
Casts the given buffer to a module.
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_GetDeliveredImageHeight(PEAK_BUFFER_HANDLE bufferHandle, size_t *deliveredImageHeight)
Asks the given buffer for its delivered image height.
PEAK_C_API PEAK_Buffer_GetExpectedDataSize(PEAK_BUFFER_HANDLE bufferHandle, size_t *expectedDataSize)
Asks the given buffer for its expected data size.
PEAK_C_API PEAK_Buffer_GetIsQueued(PEAK_BUFFER_HANDLE bufferHandle, PEAK_BOOL8 *isQueued)
Asks the given buffer whether it is queued.
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_GetTLType(PEAK_BUFFER_HANDLE bufferHandle, char *tlType, size_t *tlTypeSize)
Asks the given buffer for its TL type.
int32_t PEAK_BUFFER_PAYLOAD_TYPE
Definition peak_backend.h:99
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_GetPixelFormat(PEAK_BUFFER_HANDLE bufferHandle, uint64_t *pixelFormat)
Asks the given buffer for its pixel format.
PEAK_C_API PEAK_Buffer_GetHasImage(PEAK_BUFFER_HANDLE bufferHandle, PEAK_BOOL8 *hasImage)
Asks the given buffer whether it is has an image.
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_GetNumParts(PEAK_BUFFER_HANDLE bufferHandle, size_t *numParts)
Asks the given buffer for its number of parts.
PEAK_C_API PEAK_Buffer_GetChunkLayoutID(PEAK_BUFFER_HANDLE bufferHandle, uint64_t *chunkLayoutId)
Asks the given buffer for its chunk layout ID.
#define PEAK_C_ABI_PREFIX
Definition peak_dll_defines.h:16