IDS peak genericC++ v1.17.0
Loading...
Searching...
No Matches
peak_buffer.hpp
Go to the documentation of this file.
1
7
8#pragma once
9
12
18#include <peak/dll_interface/peak_dll_interface_util.hpp>
20
21#include <cstddef>
22#include <cstdint>
23#include <memory>
24#include <string>
25#include <vector>
26
27
28namespace peak
29{
30
31namespace core
32{
33
56
72
73class DataStream;
74class NodeMap;
75
82class Buffer
84 , public std::enable_shared_from_this<Buffer>
85{
86public:
87 Buffer() = delete;
88 ~Buffer() override = default;
89 Buffer(const Buffer& other) = delete;
90 Buffer& operator=(const Buffer& other) = delete;
91 Buffer(Buffer&& other) = delete;
92 Buffer& operator=(Buffer&& other) = delete;
93
106
107
120
127
128 PEAK_COMMON_NO_DISCARD RawInformation Info(int32_t infoCommand) const;
129
131 PEAK_COMMON_NO_DISCARD std::string TLType() const;
132
142 PEAK_COMMON_NO_DISCARD void* BasePtr() const;
143
153 PEAK_COMMON_NO_DISCARD size_t Size() const;
154
168 PEAK_COMMON_NO_DISCARD void* UserPtr() const;
169
180
193 PEAK_COMMON_NO_DISCARD uint64_t PixelFormat() const;
194
208
219
230
241
252
269 PEAK_COMMON_NO_DISCARD uint64_t FrameID() const;
270
280 PEAK_COMMON_NO_DISCARD size_t ImageOffset() const;
281
292
303
313 PEAK_COMMON_NO_DISCARD uint64_t ChunkLayoutID() const;
314
332 PEAK_COMMON_NO_DISCARD std::string FileName() const;
333
343 PEAK_COMMON_NO_DISCARD size_t Width() const;
344
354 PEAK_COMMON_NO_DISCARD size_t Height() const;
355
366
377 PEAK_COMMON_NO_DISCARD size_t XOffset() const;
378
389 PEAK_COMMON_NO_DISCARD size_t YOffset() const;
390
400 PEAK_COMMON_NO_DISCARD size_t XPadding() const;
401
411 PEAK_COMMON_NO_DISCARD size_t YPadding() const;
412
423
443 PEAK_COMMON_NO_DISCARD uint64_t Timestamp_ns() const;
444
455 PEAK_COMMON_NO_DISCARD bool IsQueued() const;
456
469
483
495
508 PEAK_COMMON_NO_DISCARD bool HasImage() const;
509
523
536 PEAK_COMMON_NO_DISCARD bool HasParts() const;
537
538
572
574
586 PEAK_COMMON_NO_DISCARD std::vector<std::shared_ptr<BufferChunk>> Chunks();
587
597 PEAK_COMMON_NO_DISCARD std::vector<std::shared_ptr<BufferPart>> Parts();
598
608 PEAK_COMMON_NO_DISCARD std::shared_ptr<DataStream> ParentDataStream() const;
609
610private:
613
614 void Revoke();
615
616 friend NodeMap;
617 friend ClassCreator<Buffer>;
618 Buffer(PEAK_BUFFER_HANDLE bufferHandle, const std::weak_ptr<DataStream>& parentDataStream);
619 PEAK_BUFFER_HANDLE m_backendHandle;
620
621 std::weak_ptr<DataStream> m_parentDataStream;
622
623 friend class DataStream;
624};
625
626} /* namespace core */
627} /* namespace peak */
628
629/* Implementation */
630namespace peak
631{
632namespace core
633{
634
635inline std::string ToString(BufferPayloadType entry)
636{
637 std::string entryString;
638
639 if (entry == BufferPayloadType::Unknown)
640 {
641 entryString = "Unknown";
642 }
643 else if (entry == BufferPayloadType::Image)
644 {
645 entryString = "Image";
646 }
647 else if (entry == BufferPayloadType::RawData)
648 {
649 entryString = "RawData";
650 }
651 else if (entry == BufferPayloadType::File)
652 {
653 entryString = "File";
654 }
655 else if (entry == BufferPayloadType::Chunk)
656 {
657 entryString = "Chunk";
658 }
659 else if (entry == BufferPayloadType::JPEG)
660 {
661 entryString = "JPEG";
662 }
663 else if (entry == BufferPayloadType::JPEG2000)
664 {
665 entryString = "JPEG2000";
666 }
667 else if (entry == BufferPayloadType::H264)
668 {
669 entryString = "H264";
670 }
671 else if (entry == BufferPayloadType::ChunkOnly)
672 {
673 entryString = "ChunkOnly";
674 }
675 else if (entry == BufferPayloadType::DeviceSpecific)
676 {
677 entryString = "DeviceSpecific";
678 }
679 else if (entry == BufferPayloadType::MultiPart)
680 {
681 entryString = "MultiPart";
682 }
683 else if (entry >= BufferPayloadType::Custom)
684 {
685 entryString = "Custom";
686 }
687
688 return entryString;
689}
690
691inline std::string ToString(PixelFormatNamespace entry)
692{
693 std::string entryString;
694
695 if (entry == PixelFormatNamespace::GEV)
696 {
697 entryString = "GEV";
698 }
699 else if (entry == PixelFormatNamespace::IIDC)
700 {
701 entryString = "IIDC";
702 }
703 else if (entry == PixelFormatNamespace::PFNC16Bit)
704 {
705 entryString = "PFNC16Bit";
706 }
707 else if (entry == PixelFormatNamespace::PFNC32Bit)
708 {
709 entryString = "PFNC32Bit";
710 }
711 else if (entry >= PixelFormatNamespace::Custom)
712 {
713 entryString = "Custom";
714 }
715
716 return entryString;
717}
718
719inline Buffer::Buffer(PEAK_BUFFER_HANDLE bufferHandle, const std::weak_ptr<DataStream>& parentDataStream)
720 : m_backendHandle(bufferHandle)
721 , m_parentDataStream(parentDataStream)
722{}
723
725{
726 return ImageView(shared_from_this());
727}
728
730{
731 return ImageView(shared_from_this(), mode);
732}
733
734
735inline RawInformation Buffer::Info(int32_t infoCommand) const
736{
737 return QueryRawInformationFromCInterfaceFunction([&](int32_t* dataType, uint8_t* buffer, size_t* bufferSize) {
738 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetInfo(m_backendHandle, infoCommand, dataType, buffer, bufferSize);
739 });
740}
741
742inline std::string Buffer::TLType() const
743{
744 return QueryStringFromCInterfaceFunction([&](char* tlType, size_t* tlTypeSize) {
745 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetTLType(m_backendHandle, tlType, tlTypeSize);
746 });
747}
748
749inline void* Buffer::BasePtr() const
750{
751 return QueryNumericFromCInterfaceFunction<void*>(
752 [&](void** basePtr) { return PEAK_C_ABI_PREFIX PEAK_Buffer_GetBasePtr(m_backendHandle, basePtr); });
753}
754
755inline size_t Buffer::Size() const
756{
757 return QueryNumericFromCInterfaceFunction<size_t>(
758 [&](size_t* size) { return PEAK_C_ABI_PREFIX PEAK_Buffer_GetSize(m_backendHandle, size); });
759}
760
761inline void* Buffer::UserPtr() const
762{
763 return QueryNumericFromCInterfaceFunction<void*>(
764 [&](void** userPtr) { return PEAK_C_ABI_PREFIX PEAK_Buffer_GetUserPtr(m_backendHandle, userPtr); });
765}
766
768{
769 return static_cast<BufferPayloadType>(
770 QueryNumericFromCInterfaceFunction<PEAK_BUFFER_PAYLOAD_TYPE>([&](PEAK_BUFFER_PAYLOAD_TYPE* payloadType) {
771 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetPayloadType(m_backendHandle, payloadType);
772 }));
773}
774
775inline uint64_t Buffer::PixelFormat() const
776{
777 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* pixelFormat) {
778 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetPixelFormat(m_backendHandle, pixelFormat);
779 });
780}
781
786
788{
789 return static_cast<peak::core::PixelFormatNamespace>(
790 QueryNumericFromCInterfaceFunction<PEAK_PIXEL_FORMAT_NAMESPACE>(
791 [&](PEAK_PIXEL_FORMAT_NAMESPACE* pixelFormatNamespace) {
793 m_backendHandle, pixelFormatNamespace);
794 }));
795}
796
798{
799 return static_cast<Endianness>(
800 QueryNumericFromCInterfaceFunction<PEAK_ENDIANNESS>([&](PEAK_ENDIANNESS* pixelEndianness) {
801 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetPixelEndianness(m_backendHandle, pixelEndianness);
802 }));
803}
804
805inline size_t Buffer::ExpectedDataSize() const
806{
807 return QueryNumericFromCInterfaceFunction<size_t>([&](size_t* expectedDataSize) {
808 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetExpectedDataSize(m_backendHandle, expectedDataSize);
809 });
810}
811
812inline size_t Buffer::DeliveredDataSize() const
813{
814 return QueryNumericFromCInterfaceFunction<size_t>([&](size_t* deliveredDataSize) {
815 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetDeliveredDataSize(m_backendHandle, deliveredDataSize);
816 });
817}
818
819inline uint64_t Buffer::FrameID() const
820{
821 return QueryNumericFromCInterfaceFunction<uint64_t>(
822 [&](uint64_t* frameId) { return PEAK_C_ABI_PREFIX PEAK_Buffer_GetFrameID(m_backendHandle, frameId); });
823}
824
825inline size_t Buffer::ImageOffset() const
826{
827 return QueryNumericFromCInterfaceFunction<size_t>([&](size_t* imageOffset) {
828 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetImageOffset(m_backendHandle, imageOffset);
829 });
830}
831
832inline size_t Buffer::DeliveredImageHeight() const
833{
834 return QueryNumericFromCInterfaceFunction<size_t>([&](size_t* deliveredImageHeight) {
835 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetDeliveredImageHeight(m_backendHandle, deliveredImageHeight);
836 });
837}
838
840{
841 return QueryNumericFromCInterfaceFunction<size_t>([&](size_t* deliveredChunkPayloadSize) {
843 m_backendHandle, deliveredChunkPayloadSize);
844 });
845}
846
847inline uint64_t Buffer::ChunkLayoutID() const
848{
849 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* chunkLayoutId) {
850 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetChunkLayoutID(m_backendHandle, chunkLayoutId);
851 });
852}
853
854inline std::string Buffer::FileName() const
855{
856 return QueryStringFromCInterfaceFunction([&](char* fileName, size_t* fileNameSize) {
857 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetFileName(m_backendHandle, fileName, fileNameSize);
858 });
859}
860
861inline size_t Buffer::Width() const
862{
863 return QueryNumericFromCInterfaceFunction<size_t>(
864 [&](size_t* width) { return PEAK_C_ABI_PREFIX PEAK_Buffer_GetWidth(m_backendHandle, width); });
865}
866
867inline size_t Buffer::Height() const
868{
869 return QueryNumericFromCInterfaceFunction<size_t>(
870 [&](size_t* height) { return PEAK_C_ABI_PREFIX PEAK_Buffer_GetHeight(m_backendHandle, height); });
871}
872
874{
875 return { static_cast<uint32_t>(Width()), static_cast<uint32_t>(Height()) };
876}
877
878inline size_t Buffer::XOffset() const
879{
880 return QueryNumericFromCInterfaceFunction<size_t>(
881 [&](size_t* xOffset) { return PEAK_C_ABI_PREFIX PEAK_Buffer_GetXOffset(m_backendHandle, xOffset); });
882}
883
884inline size_t Buffer::YOffset() const
885{
886 return QueryNumericFromCInterfaceFunction<size_t>(
887 [&](size_t* yOffset) { return PEAK_C_ABI_PREFIX PEAK_Buffer_GetYOffset(m_backendHandle, yOffset); });
888}
889
890inline size_t Buffer::XPadding() const
891{
892 return QueryNumericFromCInterfaceFunction<size_t>(
893 [&](size_t* xPadding) { return PEAK_C_ABI_PREFIX PEAK_Buffer_GetXPadding(m_backendHandle, xPadding); });
894}
895
896inline size_t Buffer::YPadding() const
897{
898 return QueryNumericFromCInterfaceFunction<size_t>(
899 [&](size_t* yPadding) { return PEAK_C_ABI_PREFIX PEAK_Buffer_GetYPadding(m_backendHandle, yPadding); });
900}
901
902inline uint64_t Buffer::Timestamp_ticks() const
903{
904 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* timestamp_ticks) {
905 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetTimestamp_ticks(m_backendHandle, timestamp_ticks);
906 });
907}
908
909inline uint64_t Buffer::Timestamp_ns() const
910{
911 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* timestamp_ns) {
912 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetTimestamp_ns(m_backendHandle, timestamp_ns);
913 });
914}
915
916inline bool Buffer::IsQueued() const
917{
918 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isQueued) {
919 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetIsQueued(m_backendHandle, isQueued);
920 }) > 0;
921}
922
923inline bool Buffer::IsAcquiring() const
924{
925 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isAcquiring) {
926 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetIsAcquiring(m_backendHandle, isAcquiring);
927 }) > 0;
928}
929
930inline bool Buffer::IsIncomplete() const
931{
932 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isIncomplete) {
933 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetIsIncomplete(m_backendHandle, isIncomplete);
934 }) > 0;
935}
936
937inline bool Buffer::HasNewData() const
938{
939 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* hasNewData) {
940 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetHasNewData(m_backendHandle, hasNewData);
941 }) > 0;
942}
943
944inline bool Buffer::HasImage() const
945{
946 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* hasImage) {
947 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetHasImage(m_backendHandle, hasImage);
948 }) > 0;
949}
950
951inline bool Buffer::HasChunks() const
952{
953 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* hasChunks) {
954 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetHasChunks(m_backendHandle, hasChunks);
955 }) > 0;
956}
957
958inline bool Buffer::HasParts() const
959{
960 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* hasParts) {
961 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetHasParts(m_backendHandle, hasParts);
962 }) > 0;
963}
964
965inline uint64_t Buffer::SystemTimestamp_ns() const
966{
967 return QueryNumericFromCInterfaceFunction<uint64_t>([&](uint64_t* systemTimestamp_ns) {
968 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetSystemTimestamp_ns(m_backendHandle, systemTimestamp_ns);
969 });
970}
971
972inline std::vector<std::shared_ptr<BufferChunk>> Buffer::Chunks()
973{
974 CallAndCheckCInterfaceFunction([&] { return PEAK_C_ABI_PREFIX PEAK_Buffer_UpdateChunks(m_backendHandle); });
975
976 auto numChunks = QueryNumericFromCInterfaceFunction<size_t>([&](size_t* _numChunks) {
977 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetNumChunks(m_backendHandle, _numChunks);
978 });
979
980 std::vector<std::shared_ptr<BufferChunk>> chunks;
981 for (size_t x = 0; x < numChunks; ++x)
982 {
983 auto bufferChunkHandle = QueryNumericFromCInterfaceFunction<PEAK_BUFFER_CHUNK_HANDLE>(
984 [&](PEAK_BUFFER_CHUNK_HANDLE* _bufferChunkHandle) {
985 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetChunk(m_backendHandle, x, _bufferChunkHandle);
986 });
987
988 chunks.emplace_back(std::make_shared<ClassCreator<BufferChunk>>(bufferChunkHandle, shared_from_this()));
989 }
990
991 return chunks;
992}
993
994inline std::vector<std::shared_ptr<BufferPart>> Buffer::Parts()
995{
996 CallAndCheckCInterfaceFunction([&] { return PEAK_C_ABI_PREFIX PEAK_Buffer_UpdateParts(m_backendHandle); });
997
998 auto numParts = QueryNumericFromCInterfaceFunction<size_t>(
999 [&](size_t* _numParts) { return PEAK_C_ABI_PREFIX PEAK_Buffer_GetNumParts(m_backendHandle, _numParts); });
1000
1001 std::vector<std::shared_ptr<BufferPart>> parts;
1002 for (size_t x = 0; x < numParts; ++x)
1003 {
1004 auto bufferPartHandle = QueryNumericFromCInterfaceFunction<PEAK_BUFFER_PART_HANDLE>(
1005 [&](PEAK_BUFFER_PART_HANDLE* _bufferPartHandle) {
1006 return PEAK_C_ABI_PREFIX PEAK_Buffer_GetPart(m_backendHandle, x, _bufferPartHandle);
1007 });
1008
1009 parts.emplace_back(std::make_shared<ClassCreator<BufferPart>>(bufferPartHandle, shared_from_this()));
1010 }
1011
1012 return parts;
1013}
1014
1015inline std::shared_ptr<DataStream> Buffer::ParentDataStream() const
1016{
1017 return LockOrThrow(m_parentDataStream);
1018}
1019
1020inline PEAK_MODULE_HANDLE Buffer::ModuleHandle() const
1021{
1022 auto moduleHandle = QueryNumericFromCInterfaceFunction<PEAK_MODULE_HANDLE>(
1023 [&](PEAK_MODULE_HANDLE* _moduleHandle) {
1024 return PEAK_C_ABI_PREFIX PEAK_Buffer_ToModule(m_backendHandle, _moduleHandle);
1025 });
1026
1027 return moduleHandle;
1028}
1029
1030inline PEAK_EVENT_SUPPORTING_MODULE_HANDLE Buffer::EventSupportingModuleHandle() const
1031{
1032 auto eventSupportingModuleHandle = QueryNumericFromCInterfaceFunction<PEAK_EVENT_SUPPORTING_MODULE_HANDLE>(
1033 [&](PEAK_EVENT_SUPPORTING_MODULE_HANDLE* _eventSupportingModuleHandle) {
1035 m_backendHandle, _eventSupportingModuleHandle);
1036 });
1037
1038 return eventSupportingModuleHandle;
1039}
1040
1041inline void Buffer::Revoke()
1042{
1043 m_parentDataStream.reset();
1044}
1045
1046inline bool NodeMap::HasBufferSupportedChunks(const std::shared_ptr<Buffer>& buffer) const
1047{
1048 if (buffer == nullptr)
1049 {
1050 throw InvalidArgumentException("The given buffer is a nullptr!");
1051 }
1052
1053 return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* hasSupportedChunks) {
1055 m_backendHandle, buffer->m_backendHandle, hasSupportedChunks);
1056 }) > 0;
1057}
1058
1059inline void NodeMap::UpdateChunkNodes(const std::shared_ptr<Buffer>& buffer)
1060{
1061 if (buffer == nullptr)
1062 {
1063 throw InvalidArgumentException("The given buffer is a nullptr!");
1064 }
1065
1066 CallAndCheckCInterfaceFunction([&] {
1067 return PEAK_C_ABI_PREFIX PEAK_NodeMap_UpdateChunkNodes(m_backendHandle, buffer->m_backendHandle);
1068 });
1069}
1070
1071} /* namespace core */
1072} /* namespace peak */
Provides information and utility functions for pixel formats.
Definition peak_common_pixel_format.hpp:234
PEAK_COMMON_NO_DISCARD bool IsQueued() const
Checks whether the buffer is queued or not.
Definition peak_buffer.hpp:916
PEAK_COMMON_NO_DISCARD size_t DeliveredImageHeight() const
Returns the delivered image height.
Definition peak_buffer.hpp:832
PEAK_COMMON_NO_DISCARD bool IsIncomplete() const
Checks whether the buffer is incomplete or not.
Definition peak_buffer.hpp:930
Buffer & operator=(Buffer &&other)=delete
PEAK_COMMON_NO_DISCARD void * BasePtr() const
Returns the base pointer.
Definition peak_buffer.hpp:749
PEAK_COMMON_NO_DISCARD uint64_t Timestamp_ticks() const
Returns the timestamp.
Definition peak_buffer.hpp:902
PEAK_COMMON_NO_DISCARD bool HasParts() const
Checks whether the buffer contains parts.
Definition peak_buffer.hpp:958
Buffer(Buffer &&other)=delete
PEAK_COMMON_NO_DISCARD uint64_t FrameID() const
Returns the identifier of the current frame.
Definition peak_buffer.hpp:819
PEAK_COMMON_NO_DISCARD bool IsAcquiring() const
Checks whether the buffer is currently being filled.
Definition peak_buffer.hpp:923
PEAK_COMMON_NO_DISCARD peak::core::PixelFormatNamespace PixelFormatNamespace() const
Returns the pixel format namespace, to allow interpretation of the PixelFormat().
Definition peak_buffer.hpp:787
PEAK_COMMON_NO_DISCARD bool HasNewData() const
Checks whether the buffer has new data since the last delivery.
Definition peak_buffer.hpp:937
PEAK_COMMON_NO_DISCARD 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:878
PEAK_COMMON_NO_DISCARD void * UserPtr() const
Returns the pointer to custom user data attached to the buffer.
Definition peak_buffer.hpp:761
PEAK_COMMON_NO_DISCARD RawInformation Info(int32_t infoCommand) const
Delivers information based on the given GenTL info command.
Definition peak_buffer.hpp:735
PEAK_COMMON_NO_DISCARD size_t Size() const
Returns the size of the buffer in bytes.
Definition peak_buffer.hpp:755
PEAK_COMMON_NO_DISCARD size_t XPadding() const
Returns the x padding of the data in the buffer in number of bytes.
Definition peak_buffer.hpp:890
PEAK_COMMON_NO_DISCARD peak::common::PixelFormatInfo PixelFormatInfo() const
Returns the pixel format info of the data.
Definition peak_buffer.hpp:782
friend class DataStream
Definition peak_buffer.hpp:623
PEAK_COMMON_NO_DISCARD size_t Height() const
Returns the height.
Definition peak_buffer.hpp:867
PEAK_COMMON_NO_DISCARD std::shared_ptr< DataStream > ParentDataStream() const
Returns the parent data stream.
Definition peak_buffer.hpp:1015
PEAK_COMMON_NO_DISCARD size_t DeliveredDataSize() const
Returns the delivered data size.
Definition peak_buffer.hpp:812
PEAK_COMMON_NO_DISCARD bool HasImage() const
Checks whether the buffer contains image data.
Definition peak_buffer.hpp:944
PEAK_COMMON_NO_DISCARD std::vector< std::shared_ptr< BufferChunk > > Chunks()
Returns the buffer's chunks if it contains chunks.
Definition peak_buffer.hpp:972
PEAK_COMMON_NO_DISCARD ImageView ToImageView()
Create an ImageView from this buffer.
Definition peak_buffer.hpp:724
PEAK_COMMON_NO_DISCARD uint64_t PixelFormat() const
Returns the pixel format of the data.
Definition peak_buffer.hpp:775
PEAK_COMMON_NO_DISCARD BufferPayloadType PayloadType() const
Returns the payload type.
Definition peak_buffer.hpp:767
PEAK_COMMON_NO_DISCARD uint64_t ChunkLayoutID() const
Returns the chunk layout ID.
Definition peak_buffer.hpp:847
PEAK_COMMON_NO_DISCARD 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:884
PEAK_COMMON_NO_DISCARD Endianness PixelEndianness() const
Returns the pixel endianness.
Definition peak_buffer.hpp:797
PEAK_COMMON_NO_DISCARD size_t ImageOffset() const
Returns the offset of the image data from the beginning of the delivered buffer in bytes.
Definition peak_buffer.hpp:825
PEAK_COMMON_NO_DISCARD std::string TLType() const
Returns the TL (transport layer) type.
Definition peak_buffer.hpp:742
PEAK_COMMON_NO_DISCARD uint64_t SystemTimestamp_ns() const
Returns the system timestamp corresponding to this buffer.
Definition peak_buffer.hpp:965
PEAK_COMMON_NO_DISCARD size_t YPadding() const
Returns the y padding of the data in the buffer in number of bytes.
Definition peak_buffer.hpp:896
PEAK_COMMON_NO_DISCARD size_t DeliveredChunkPayloadSize() const
Returns the delivered chunk payload size.
Definition peak_buffer.hpp:839
PEAK_COMMON_NO_DISCARD peak::common::Size ImageSize() const
Returns the size of the image.
Definition peak_buffer.hpp:873
PEAK_COMMON_NO_DISCARD size_t ExpectedDataSize() const
Returns the expected data size.
Definition peak_buffer.hpp:805
PEAK_COMMON_NO_DISCARD std::vector< std::shared_ptr< BufferPart > > Parts()
Returns all buffer parts for multipart buffers.
Definition peak_buffer.hpp:994
~Buffer() override=default
PEAK_COMMON_NO_DISCARD size_t Width() const
Returns the width.
Definition peak_buffer.hpp:861
Buffer(const Buffer &other)=delete
Buffer & operator=(const Buffer &other)=delete
PEAK_COMMON_NO_DISCARD uint64_t Timestamp_ns() const
Returns the timestamp associated with when the image was recorded.
Definition peak_buffer.hpp:909
PEAK_COMMON_NO_DISCARD std::string FileName() const
Retrieves the file name.
Definition peak_buffer.hpp:854
PEAK_COMMON_NO_DISCARD bool HasChunks() const
Checks whether the buffer contains chunks.
Definition peak_buffer.hpp:951
virtual PEAK_EVENT_SUPPORTING_MODULE_HANDLE EventSupportingModuleHandle() const =0
Implementation of the peak::common::IImageView interface for viewing image pixel data from arbitrary ...
Definition peak_image_view.hpp:83
The exception thrown for passing an invalid argument to a function.
Definition peak_exception.hpp:118
virtual PEAK_MODULE_HANDLE ModuleHandle() const =0
void UpdateChunkNodes(const std::shared_ptr< Buffer > &buffer)
Updates chunk information in the NodeMap.
Definition peak_buffer.hpp:1059
PEAK_COMMON_NO_DISCARD bool HasBufferSupportedChunks(const std::shared_ptr< Buffer > &buffer) const
Checks if the Buffer contains chunks corresponding to the NodeMap.
Definition peak_buffer.hpp:1046
BufferPayloadType
Payload type of buffer.
Definition peak_buffer.hpp:41
PixelFormatNamespace
The namespace needed to interpret the pixel format value of the buffer.
Definition peak_buffer.hpp:64
@ File
Definition peak_buffer.hpp:45
@ DeviceSpecific
Definition peak_buffer.hpp:51
@ MultiPart
Definition peak_buffer.hpp:52
@ Unknown
Definition peak_buffer.hpp:42
@ Chunk
Definition peak_buffer.hpp:46
@ H264
Definition peak_buffer.hpp:49
@ Custom
Definition peak_buffer.hpp:54
@ JPEG
Definition peak_buffer.hpp:47
@ JPEG2000
Definition peak_buffer.hpp:48
@ Image
Definition peak_buffer.hpp:43
@ RawData
Definition peak_buffer.hpp:44
@ ChunkOnly
Definition peak_buffer.hpp:50
@ 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
detail::SizeT< uint32_t > Size
Size with unsigned 32-bit integer dimensions.
Definition peak_common_size.hpp:268
PixelFormat
Enum listing all supported pixel formats and their internal IDs.
Definition peak_common_pixel_format.hpp:59
The "core" namespace contains the direct GenAPI and GenTL wrapper.
Definition peak_buffer.hpp:32
std::string ToString(BufferPayloadType entry)
Definition peak_buffer.hpp:635
MetadataExtractionMode
Controls how metadata is extracted when constructing an ImageView.
Definition peak_image_view.hpp:50
Endianness
Endianness of pixel data in a Buffer or the data in a Port.
Definition peak_common_enums.hpp:26
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_buffer.hpp:29
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:419
PEAK_C_API PEAK_Buffer_GetSystemTimestamp_ns(PEAK_BUFFER_HANDLE bufferHandle, uint64_t *systemTimestamp_ns)
Asks the given buffer for its system timestamp in nanoseconds.
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:407
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:403
struct PEAK_EVENT_SUPPORTING_MODULE * PEAK_EVENT_SUPPORTING_MODULE_HANDLE
Definition peak_backend.h:475
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:411
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:41
int32_t PEAK_ENDIANNESS
Definition peak_backend.h:170
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:316
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:97
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_COMMON_NO_DISCARD
Definition peak_common_defines.h:89
#define PEAK_C_ABI_PREFIX
Definition peak_dll_defines.h:13
The struct returned by all raw information functions.
Definition peak_common_structs.hpp:21