CVB++ 15.0
Loading...
Searching...
No Matches
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
10 namespace GevServer
11 {
21 class ChunkImageBufferDescription : public ImageBufferDescription
22 {
23 friend class Stream;
24
25 public:
38 ChunkImageBufferDescription(Size2D<int> size, ColorModel colorModel, DataType dataType, int totalPayloadSize)
39 : ChunkImageBufferDescription(size, PfncFormatValue::From(colorModel, dataType), totalPayloadSize)
40 {
41 }
42
50 ChunkImageBufferDescription(Size2D<int> size, PfncFormat pixelFormat, int totalPayloadSize)
51 : ImageBufferDescription(size, pixelFormat)
52 {
53 if (totalPayloadSize < 4)
55 "Total payload size must at least be "
56 "large enough to hold a chunk");
57
58 totalPayloadSize_ = totalPayloadSize;
59 }
60
64 int TotalPayloadSize() const noexcept
65 {
66 return totalPayloadSize_;
67 }
68
72 void SetTotalPayloadSize(int totalPayloadSize)
73 {
74 if (totalPayloadSize < 4)
75 throw std::runtime_error("Total payload size must at least be large enough to hold a chunk");
76
77 totalPayloadSize_ = totalPayloadSize;
78 }
79
92 std::int64_t LayoutId() const noexcept
93 {
94 return layoutId_;
95 }
96
113 void SetLayoutId(const std::int64_t &layoutId)
114 {
115 if (layoutId < 0)
116 throw std::runtime_error("Layout identifier must be larger or equal to 0");
117
118 layoutId_ = static_cast<CExports::cvbuint32_t>(layoutId);
119 }
120
121 private:
123 CExports::GSExtendedChunkDataBlock ChunkImageDataBlock() const noexcept
124 {
125 auto dataBlock = CExports::GSExtendedChunkDataBlock{
126 ImageDataBlock(), static_cast<CExports::cvbuint32_t>(totalPayloadSize_), layoutId_};
127 dataBlock.ImageData.Header.PayloadType = CExports::TGSPayloadType::GSPT_ChunkImage;
128 return dataBlock;
129 }
130
131 int totalPayloadSize_ = 0;
132 std::uint32_t layoutId_ = 0;
133 };
134 } // namespace GevServer
135 CVB_END_INLINE_NS
136} // 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:72
ChunkImageBufferDescription(Size2D< int > size, PfncFormat pixelFormat, int totalPayloadSize)
Creates a default chunk image buffer description.
Definition chunk_image_buffer_description.hpp:50
int TotalPayloadSize() const noexcept
Gets a valid payload size over all chunks including the image chunk.
Definition chunk_image_buffer_description.hpp:64
void SetLayoutId(const std::int64_t &layoutId)
Sets the layout identifier for the chunks.
Definition chunk_image_buffer_description.hpp:113
ChunkImageBufferDescription(Size2D< int > size, ColorModel colorModel, DataType dataType, int totalPayloadSize)
Creates a default chunk image buffer description.
Definition chunk_image_buffer_description.hpp:38
std::int64_t LayoutId() const noexcept
Gets the layout identifier for the chunks.
Definition chunk_image_buffer_description.hpp:92
Helper methods for PfncFormat values. ///.
Definition pfnc_format.hpp:1058
Stores a pair of numbers that represents the width and the height of a subject, typically a rectangle...
Definition size_2d.hpp:20
Namespace for GevServer based device configuration.
Definition decl_int_swiss_knife_node.hpp:11
PfncFormat
GenICam Pixel Format Naming Convention (PFNC) format values.
Definition pfnc_format.hpp:34
Root namespace for the Image Manager interface.
Definition version.hpp:11
ColorModel
Color model that this image is using.
Definition global.hpp:176