CVB++ 15.0
chunk_image_buffer_description.hpp
1#pragma once
2
3#include "../global.hpp"
4#include "image_buffer_description.hpp"
5
6namespace Cvb
7{
8 CVB_BEGIN_INLINE_NS
9
18 namespace GevServer
19 {
29 class ChunkImageBufferDescription : public ImageBufferDescription
30 {
31 friend class Stream;
32
33 public:
46 ChunkImageBufferDescription(Size2D<int> size, ColorModel colorModel, DataType dataType, int totalPayloadSize)
47 : ChunkImageBufferDescription(size, PfncFormatValue::From(colorModel, dataType), totalPayloadSize)
48 {
49 }
50
58 ChunkImageBufferDescription(Size2D<int> size, PfncFormat pixelFormat, int totalPayloadSize)
59 : ImageBufferDescription(size, pixelFormat)
60 {
61 if (totalPayloadSize < 4)
63 "Total payload size must at least be "
64 "large enough to hold a chunk");
65
66 totalPayloadSize_ = totalPayloadSize;
67 }
68
72 int TotalPayloadSize() const noexcept
73 {
74 return totalPayloadSize_;
75 }
76
80 void SetTotalPayloadSize(int totalPayloadSize)
81 {
82 if (totalPayloadSize < 4)
83 throw std::runtime_error("Total payload size must at least be large enough to hold a chunk");
84
85 totalPayloadSize_ = totalPayloadSize;
86 }
87
100 std::int64_t LayoutId() const noexcept
101 {
102 return layoutId_;
103 }
104
121 void SetLayoutId(const std::int64_t &layoutId)
122 {
123 if (layoutId < 0)
124 throw std::runtime_error("Layout identifier must be larger or equal to 0");
125
126 layoutId_ = static_cast<CExports::cvbuint32_t>(layoutId);
127 }
128
129 private:
131 CExports::GSExtendedChunkDataBlock ChunkImageDataBlock() const noexcept
132 {
133 auto dataBlock = CExports::GSExtendedChunkDataBlock{
134 ImageDataBlock(), static_cast<CExports::cvbuint32_t>(totalPayloadSize_), layoutId_};
135 dataBlock.ImageData.Header.PayloadType = CExports::TGSPayloadType::GSPT_ChunkImage;
136 return dataBlock;
137 }
138
139 int totalPayloadSize_ = 0;
140 std::uint32_t layoutId_ = 0;
141 };
142 } // namespace GevServer
143 CVB_END_INLINE_NS
144} // namespace Cvb
Data type description for an image plane.
Definition data_type.hpp:23
void SetTotalPayloadSize(int totalPayloadSize)
Sets a valid payload size over all chunks including the image chunk.
Definition chunk_image_buffer_description.hpp:80
ChunkImageBufferDescription(Size2D< int > size, PfncFormat pixelFormat, int totalPayloadSize)
Creates a default chunk image buffer description.
Definition chunk_image_buffer_description.hpp:58
int TotalPayloadSize() const noexcept
Gets a valid payload size over all chunks including the image chunk.
Definition chunk_image_buffer_description.hpp:72
void SetLayoutId(const std::int64_t &layoutId)
Sets the layout identifier for the chunks.
Definition chunk_image_buffer_description.hpp:121
ChunkImageBufferDescription(Size2D< int > size, ColorModel colorModel, DataType dataType, int totalPayloadSize)
Creates a default chunk image buffer description.
Definition chunk_image_buffer_description.hpp:46
std::int64_t LayoutId() const noexcept
Gets the layout identifier for the chunks.
Definition chunk_image_buffer_description.hpp:100
Helper methods for PfncFormat values. ///.
Definition pfnc_format.hpp:1005
Stores a pair of numbers that represents the width and the height of a subject, typically a rectangle...
Definition size_2d.hpp:20
Describes a GenICam Pixel Format Naming Convention (PFNC) compatible image memory buffer with possibl...
Definition decl_int_swiss_knife_node.hpp:11
PfncFormat
GenICam Pixel Format Naming Convention (PFNC) format values.
Definition pfnc_format.hpp:21
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
ColorModel
Color model that this image is using.
Definition global.hpp:176