CVB++ 15.0
Loading...
Searching...
No Matches
decl_gendc_descriptor.hpp
1#pragma once
2
3#include "../../pfnc_format.hpp"
4#include "../../shims/stdvariant.hpp"
5#include "../../version.hpp"
6#include "../driver.hpp"
7
8namespace Cvb
9{
10
11 CVB_BEGIN_INLINE_NS
12
13 template <>
14 inline HandleGuard<Driver::GenDcDescriptor>::HandleGuard(void *handle) noexcept
15 : HandleGuard<Driver::GenDcDescriptor>(handle, [](void *handle) { CVB_CALL_CAPI(ReleaseObject(handle)); })
16 {
17 }
18
19 namespace Driver
20 {
22 struct GenDcDescriptorPartConfig
23 {
24 GenDcDescriptorPartConfig(GenDCPartType partType, PfncFormat pfncFormat, std::uint16_t flowId,
25 std::uint64_t flowOffset, std::uint64_t dataSize);
26
37 };
38
40 struct GenDcDescriptorMetadataPartConfig : public GenDcDescriptorPartConfig
41 {
42 GenDcDescriptorMetadataPartConfig(GenDCPartType partType, std::uint16_t flowId, std::uint64_t flowOffset,
43 std::uint64_t dataSize);
44 };
45
56
58 struct GenDcDescriptorMetadataComponentConfig : public GenDcDescriptorComponentConfig
59 {
60 explicit GenDcDescriptorMetadataComponentConfig(const std::vector<GenDcDescriptorMetadataPartConfig> &parts);
61 };
62
69
71 class GenDcPart
72 {
73 public:
75
79 std::size_t GetOffset() const;
81
85 GenDCPartType GetType() const;
87
93
99
103 PfncFormat GetFormat() const;
105
109 std::uint16_t GetFlowId() const;
111
118
122 std::size_t GetDataSize() const;
124
130
132
138 void SetFlags(GenDcPartFlags flags);
140
147 void SetDataSize(std::size_t size);
149
156 void SetDataOffset(std::size_t offset);
157
158 protected:
159 friend class GenDcComponent;
160 GenDcPart(void *handle, size_t componentIdx, size_t partIdx);
161
162 // NOLINTBEGIN misc-non-private-member-variables-in-classes
163 void *handle_;
164 size_t componentIdx_;
165 size_t partIdx_;
166 // NOLINTEND
167 };
168
170 class GenDcPartMetadata : public GenDcPart
171 {
172 public:
174
178 std::uint64_t GetSize() const;
180
185
187
193 void SetSize(std::uint64_t size);
195
201 void SetPadding(std::uint16_t padding);
202
203 protected:
204 friend class GenDcComponent;
205 GenDcPartMetadata(void *handle, size_t componentIdx, size_t partIdx);
206 };
207
209 class GenDcPartMetadataGenICamChunk : public GenDcPartMetadata
210 {
211 public:
213
218
220
227
228 protected:
229 friend class GenDcComponent;
230 GenDcPartMetadataGenICamChunk(void *handle, size_t componentIdx, size_t partIdx);
231 };
232
234 class GenDcPartMetadataGenICamXML : public GenDcPartMetadata
235 {
236 public:
238
243
245
252
253 protected:
254 friend class GenDcComponent;
255 GenDcPartMetadataGenICamXML(void *handle, size_t componentIdx, size_t partIdx);
256 };
257
259 class GenDcPart1D : public GenDcPart
260 {
261 public:
263
267 std::uint64_t GetSize() const;
269
274
276
282 void SetSize(std::uint64_t size);
284
290 void SetPadding(std::uint16_t padding);
291
292 protected:
293 friend class GenDcComponent;
294 GenDcPart1D(void *handle, size_t componentIdx, size_t partIdx);
295 };
296
298 class GenDcPart2D : public GenDcPart
299 {
300 public:
302
306 virtual std::uint32_t GetSizeX() const;
308
312 virtual std::uint32_t GetSizeY() const;
314
318 virtual std::uint16_t GetPaddingX() const;
320
324 virtual std::uint16_t GetPaddingY() const;
325
327
333 virtual void SetSizeX(std::uint32_t size);
335
341 virtual void SetSizeY(std::uint32_t size);
343
349 virtual void SetPaddingX(std::uint16_t padding);
351
357 virtual void SetPaddingY(std::uint16_t padding);
358
359 protected:
360 friend class GenDcComponent;
361 GenDcPart2D(void *handle, size_t componentIdx, size_t partIdx);
362 };
363
365 class GenDcPartH264 : public GenDcPart2D
366 {
367 public:
369
373 std::uint32_t GetSizeX() const override;
375
379 std::uint32_t GetSizeY() const override;
381
385 std::uint16_t GetPaddingX() const override;
387
391 std::uint16_t GetPaddingY() const ;
393
399
403 H264Flags GetH264Flags() const;
405
411
417
423
429
434
436
442 void SetSizeX(std::uint32_t size) override;
444
450 void SetSizeY(std::uint32_t size) override;
452
458 void SetPaddingX(std::uint16_t padding) override;
460
466 void SetPaddingY(std::uint16_t padding) override;
468
474 void SetProfileIDC(std::uint8_t profile);
476
482 void SetH264Flags(H264Flags flags);
484
490 void SetLevelIDC(std::uint8_t level);
492
500
508
516
523
524 protected:
525 friend class GenDcComponent;
526 GenDcPartH264(void *handle, size_t componentIdx, size_t partIdx);
527 };
528
532
534 class GenDcComponent
535 {
536 public:
538
542 std::size_t GetOffset() const;
544
550
558
564
570
576
582
588
594
598 ComponentId GetTypeId() const;
600
607 PfncFormat GetFormat() const;
608
610
616
623
625
631 void SetFlags(GenDcComponentFlags flags);
633
639 void SetGroupId(std::uint16_t id);
641
647 void SetSourceId(std::uint16_t id);
649
655 void SetRegionId(std::uint16_t id);
657
663 void SetRegionOffsetX(std::uint32_t offset);
665
671 void SetRegionOffsetY(std::uint32_t offset);
673
679 void SetTimestamp(std::uint64_t timestamp);
680
681 private:
682 friend class GenDcDescriptor;
683 GenDcComponent(void *handle, size_t componentIdx);
684
685 void *handle_;
686 size_t componentIdx_;
688 };
689
691 class GenDcDescriptor
692 {
693 public:
694 using GuardType = HandleGuard<GenDcDescriptor>;
695
697
702 static std::unique_ptr<GenDcDescriptor> Create(const GenDcDescriptorConfig &descriptorConfig);
703
705
710 static std::unique_ptr<GenDcDescriptor> FromHandle(HandleGuard<GenDcDescriptor> &&guard);
711
712 virtual ~GenDcDescriptor() = default;
713 GenDcDescriptor(const GenDcDescriptor &) = delete;
714 GenDcDescriptor(GenDcDescriptor &&) = default;
715 GenDcDescriptor &operator=(const GenDcDescriptor &) = delete;
716 GenDcDescriptor &operator=(GenDcDescriptor &&) = default;
717
719
723 Version GetVersion() const;
725
731
739
745
754
762
769
777
779
784
786
793
795
799 size_t CalculateFlowCount() const;
800
802
808 void SetFlags(GenDcDescriptorFlag flags);
809
811
819
821
830
832
839 void SetDataSize(std::uint32_t size);
840
842
847
849
854 void Serialize(std::uint8_t *buffer, std::size_t size) const;
855
857
862
864
867 void *Handle() const noexcept;
868
869 protected:
870 explicit GenDcDescriptor(HandleGuard<GenDcDescriptor> &&guard);
871
872 private:
873 HandleGuard<GenDcDescriptor> handle_;
874 std::vector<GenDcComponent> components_;
875
876 };
877 } // namespace Driver
878
886 using Driver::GenDcPart;
891
892 CVB_END_INLINE_NS
893
894} // namespace Cvb
Class for a GenDC component descriptor.
Definition decl_gendc_descriptor.hpp:535
std::uint64_t GetTimestamp() const
Return the timestamp of this GenDC component's generation.
Definition detail_gendc_descriptor.hpp:500
std::uint32_t GetHeaderSize() const
Return the size of this GenDC component descriptor.
Definition detail_gendc_descriptor.hpp:470
void SetTimestamp(std::uint64_t timestamp)
Set the timestamp of this GenDC component's generation.
Definition detail_gendc_descriptor.hpp:556
std::uint16_t GetRegionId() const
Return the Source ID of this GenDC component.
Definition detail_gendc_descriptor.hpp:485
ComponentId GetTypeId() const
Return the type identifier of this GenDC component.
Definition detail_gendc_descriptor.hpp:505
const std::vector< GenDCPartVariant > & GetParts() const
Return the part descriptors of this GenDC component.
Definition detail_gendc_descriptor.hpp:516
std::uint32_t GetRegionOffsetX() const
Return the X Offset of this GenDC component's region.
Definition detail_gendc_descriptor.hpp:490
std::size_t GetOffset() const
Return the offset of this component descriptor in the GenDC descriptor.
Definition detail_gendc_descriptor.hpp:460
PfncFormat GetFormat() const
Return the format of the whole GenDC component (including all its parts).
Definition detail_gendc_descriptor.hpp:511
void SetSourceId(std::uint16_t id)
Set the Source ID of this GenDC component.
Definition detail_gendc_descriptor.hpp:536
void SetFlags(GenDcComponentFlags flags)
Set the flags of this GenDC component.
Definition detail_gendc_descriptor.hpp:526
std::uint16_t GetGroupId() const
Return the Group ID of this GenDC component.
Definition detail_gendc_descriptor.hpp:475
GenDcComponentFlags GetFlags() const
Return the flags of this GenDC component.
Definition detail_gendc_descriptor.hpp:465
std::uint32_t GetRegionOffsetY() const
Return the Y Offset of this GenDC component's region.
Definition detail_gendc_descriptor.hpp:495
std::uint16_t GetSourceId() const
Return the Source ID of this GenDC component.
Definition detail_gendc_descriptor.hpp:480
void SetRegionOffsetX(std::uint32_t offset)
Set the X Offset of this GenDC component's region.
Definition detail_gendc_descriptor.hpp:546
void SetRegionId(std::uint16_t id)
Set the Source ID of this GenDC component.
Definition detail_gendc_descriptor.hpp:541
void SetRegionOffsetY(std::uint32_t offset)
Set the Y Offset of this GenDC component's region.
Definition detail_gendc_descriptor.hpp:551
void SetGroupId(std::uint16_t id)
Set the Group ID of this GenDC component.
Definition detail_gendc_descriptor.hpp:531
Class for a GenDC container descriptor.
Definition decl_gendc_descriptor.hpp:692
std::uint32_t GetHeaderSize() const
Return the size of this GenDC container descriptor.
Definition detail_gendc_descriptor.hpp:590
std::size_t GetSerializedSize() const
Get the size in bytes of this GenDC descriptor when serialized.
Definition detail_gendc_descriptor.hpp:670
const std::vector< GenDcComponent > & GetComponents() const
Return the component descriptors of this GenDC container.
Definition detail_gendc_descriptor.hpp:620
GenDcDescriptorFlag GetFlags() const
Return the flags of this GenDC container.
Definition detail_gendc_descriptor.hpp:585
void SetVariableFields(GenDcDescriptorVariableField fields)
Set the flags identifying the variable fields of this GenDC container.
Definition detail_gendc_descriptor.hpp:655
void SetContainerId(std::uint64_t id)
Set the identifier of GenDC container.
Definition detail_gendc_descriptor.hpp:650
std::vector< std::uint8_t > Serialize() const
Serialize this GenDC descriptor into a new buffer.
Definition detail_gendc_descriptor.hpp:681
std::uint64_t GetDataSize() const
Return the size of the GenDC data.
Definition detail_gendc_descriptor.hpp:605
std::uint64_t GetContainerId() const
Return the identifier of GenDC container.
Definition detail_gendc_descriptor.hpp:595
void SetFlags(GenDcDescriptorFlag flags)
Set the flags of this GenDC container.
Definition detail_gendc_descriptor.hpp:645
void SetDataSize(std::uint32_t size)
Set the size of the GenDC data.
Definition detail_gendc_descriptor.hpp:660
GenDcDescriptorVariableField GetVariableFields() const
Return the flags identifying the variable fields of this GenDC container.
Definition detail_gendc_descriptor.hpp:600
std::int64_t GetDataOffset() const
Return the offset of the GenDC data.
Definition detail_gendc_descriptor.hpp:610
static std::unique_ptr< GenDcDescriptor > FromHandle(HandleGuard< GenDcDescriptor > &&guard)
Creates a GenDC descriptor from a classic API handle.
Definition detail_gendc_descriptor.hpp:570
std::uint32_t GetDescriptorSize() const
Return the size of the GenDC container descriptor.
Definition detail_gendc_descriptor.hpp:615
void * Handle() const noexcept
Return the Handle to the internal resource.
Definition detail_gendc_descriptor.hpp:665
Version GetVersion() const
Return the GenDC descriptor standards version.
Definition detail_gendc_descriptor.hpp:578
size_t CalculateFlowCount() const
Return the count of flows the container is transported in.
Definition detail_gendc_descriptor.hpp:630
static std::unique_ptr< GenDcDescriptor > Create(const GenDcDescriptorConfig &descriptorConfig)
Create a GenDC descriptor.
Definition detail_gendc_descriptor.hpp:689
Class for a GenDC 1D part descriptor.
Definition decl_gendc_descriptor.hpp:260
void SetPadding(std::uint16_t padding)
Set the padding of this GenDC 1D part.
Definition detail_gendc_descriptor.hpp:249
std::uint16_t GetPadding() const
Return the padding of this GenDC 1D part.
Definition detail_gendc_descriptor.hpp:239
void SetSize(std::uint64_t size)
Set the size of the GenDC 1D part.
Definition detail_gendc_descriptor.hpp:244
std::uint64_t GetSize() const
Return the size of the GenDC 1D part.
Definition detail_gendc_descriptor.hpp:234
Class for a GenDC 2D part descriptor.
Definition decl_gendc_descriptor.hpp:299
virtual void SetSizeY(std::uint32_t size)
Set the Y size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:284
virtual std::uint32_t GetSizeY() const
Return the Y size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:264
virtual std::uint16_t GetPaddingY() const
Return the Y padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:274
virtual void SetPaddingX(std::uint16_t padding)
Set the X padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:289
virtual void SetSizeX(std::uint32_t size)
Set the X size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:279
virtual std::uint16_t GetPaddingX() const
Return the X padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:269
virtual std::uint32_t GetSizeX() const
Return the X size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:259
virtual void SetPaddingY(std::uint16_t padding)
Set the Y padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:294
Class for a GenDC H.264 encoded part descriptor.
Definition decl_gendc_descriptor.hpp:366
std::uint8_t GetLevelIDC() const
Return the level_idc sequence parameter of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:334
void SetSpropMaxDonDiff(std::uint16_t diff)
Set the sprop-max-don-diff of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:402
void SetSizeY(std::uint32_t size) override
Set the Y size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:367
std::uint32_t GetSizeY() const override
Return the Y size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:309
std::uint16_t GetSpropMaxDonDiff() const
Return the sprop-max-don-diff of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:344
void SetPaddingX(std::uint16_t padding) override
Set the X padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:372
std::uint16_t GetSpropInterleavingDepth() const
Return the sprop-interleaving-depth of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:339
void SetSpropInitBufTime(std::uint32_t time)
Set the sprop-init-buf-time of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:412
std::uint8_t GetProfileIDC() const
Return the profile_idc of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:324
void SetSizeX(std::uint32_t size) override
Set the X size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:362
void SetH264Flags(H264Flags flags)
Set the Flags of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:387
std::uint16_t GetPaddingY() const
Return the Y padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:319
void SetProfileIDC(std::uint8_t profile)
Set the profile_idc of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:382
void SetSpropInterleavingDepth(std::uint16_t depth)
Set the sprop-interleaving-depth of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:397
void SetLevelIDC(std::uint8_t level)
Set the level_idc sequence parameter of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:392
std::uint32_t GetSizeX() const override
Return the X size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:304
std::uint16_t GetPaddingX() const override
Return the X padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:314
void SetSpropDeintBufReq(std::uint32_t req)
Set the sprop-deint-buf-req of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:407
std::uint32_t GetSpropDeintBufReq() const
Return the sprop-deint-buf-req of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:350
void SetPaddingY(std::uint16_t padding) override
Set the Y padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:377
H264Flags GetH264Flags() const
Return the Flags of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:329
std::uint32_t GetSpropInitBufTime() const
Return the sprop-init-buf-time of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:356
Class for a generic GenDC part descriptor.
Definition decl_gendc_descriptor.hpp:72
void SetDataOffset(std::size_t offset)
Set the Data offset of this GenDC part.
Definition detail_gendc_descriptor.hpp:166
std::uint32_t GetHeaderSize() const
Return the size of this GenDC part descriptor.
Definition detail_gendc_descriptor.hpp:131
void SetFlags(GenDcPartFlags flags)
Set the flags of this GenDC part.
Definition detail_gendc_descriptor.hpp:161
std::size_t GetDataOffset() const
Return the Data offset of this GenDC part.
Definition detail_gendc_descriptor.hpp:151
std::uint16_t GetFlowId() const
Return the Flow ID of this GenDC part.
Definition detail_gendc_descriptor.hpp:141
std::size_t GetOffset() const
Return the offset of this part descriptor in the GenDC descriptor.
Definition detail_gendc_descriptor.hpp:116
PfncFormat GetFormat() const
Return the data format of this GenDC part.
Definition detail_gendc_descriptor.hpp:136
GenDCPartType GetType() const
Return the type of this GenDC part descriptor.
Definition detail_gendc_descriptor.hpp:121
std::size_t GetDataSize() const
Return the Data size of this GenDC part.
Definition detail_gendc_descriptor.hpp:156
GenDcPartFlags GetFlags() const
Return the flags of this GenDC part.
Definition detail_gendc_descriptor.hpp:126
void SetDataSize(std::size_t size)
Set the Data size of this GenDC part.
Definition detail_gendc_descriptor.hpp:171
std::size_t GetFlowOffset() const
Return the Flow offset of this GenDC part.
Definition detail_gendc_descriptor.hpp:146
Class for a GenDC metadata chunk part descriptor.
Definition decl_gendc_descriptor.hpp:210
std::uint64_t GetGenICamLayoutId() const
Return the Layout ID of this GenDC metadata chunk part.
Definition detail_gendc_descriptor.hpp:201
void SetGenICamLayoutId(std::uint64_t id)
Set the Layout ID of this GenDC metadata chunk part.
Definition detail_gendc_descriptor.hpp:207
Class for a GenDC metadata XML part descriptor.
Definition decl_gendc_descriptor.hpp:235
std::uint64_t GetGenICamLayoutId() const
Return the Layout ID of this GenDC metadata XML part.
Definition detail_gendc_descriptor.hpp:218
void SetGenICamLayoutId(std::uint64_t id)
Set the Layout ID of this GenDC metadata XML part.
Definition detail_gendc_descriptor.hpp:224
Class for a generic GenDC metadata part descriptor.
Definition decl_gendc_descriptor.hpp:171
void SetPadding(std::uint16_t padding)
Set the padding of this GenDC metadata part.
Definition detail_gendc_descriptor.hpp:191
std::uint16_t GetPadding() const
Return the padding of this GenDC metadata part.
Definition detail_gendc_descriptor.hpp:181
void SetSize(std::uint64_t size)
Set the size of the GenDC metadata part.
Definition detail_gendc_descriptor.hpp:186
std::uint64_t GetSize() const
Return the size of the GenDC metadata part.
Definition detail_gendc_descriptor.hpp:176
cvbbool_t ReleaseObject(OBJ &Object)
Namespace for driver or device related operations.
Definition decl_composite.hpp:27
ComponentId
Component type identifier,.
Definition driver.hpp:609
@ Undefined
Undefined component id.
Definition driver.hpp:636
GenDcDescriptorVariableField
Flags specifying which type of data information might vary during the Container reception.
Definition driver.hpp:652
H264Flags
Flags specifying the characteristics and format of the H.264 Part.
Definition driver.hpp:690
GenDCPartType
Part Type Header format identifier,.
Definition driver.hpp:581
GenDcDescriptorFlag
Flags specifying the characteristics and format of the Container.
Definition driver.hpp:641
variant< GenDcPart, GenDcPart1D, GenDcPart2D, GenDcPartMetadata, GenDcPartMetadataGenICamChunk, GenDcPartMetadataGenICamXML, GenDcPartH264 > GenDCPartVariant
Variant that can contain the different types of GenDC descriptor parts.
Definition decl_gendc_descriptor.hpp:530
GenDcPartFlags
Flags specifying the characteristics and format of the Part.
Definition driver.hpp:681
GenDcComponentFlags
Flags specifying the characteristics and format of the Component.
Definition driver.hpp:673
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
Configuration class for a GenDC component descriptor.
Definition decl_gendc_descriptor.hpp:48
std::vector< GenDcDescriptorPartConfig > Parts
Configurations of the GenDC parts in this GenDC component.
Definition decl_gendc_descriptor.hpp:54
ComponentId TypeId
Type ID of this GenDC component.
Definition decl_gendc_descriptor.hpp:50
PfncFormat Format
PFNC Format of this GenDC component.
Definition decl_gendc_descriptor.hpp:52
Configuration class for a GenDC descriptor.
Definition decl_gendc_descriptor.hpp:65
std::vector< GenDcDescriptorComponentConfig > Components
Configurations of the GenDC components in this GenDC descriptor.
Definition decl_gendc_descriptor.hpp:67
Configuration class for a GenDC metadata component descriptor.
Definition decl_gendc_descriptor.hpp:59
Configuration class for a GenDC metadata part descriptor.
Definition decl_gendc_descriptor.hpp:41
Configuration class for a GenDC part descriptor.
Definition decl_gendc_descriptor.hpp:23
GenDCPartType PartType
Type of this GenDC part.
Definition decl_gendc_descriptor.hpp:28
std::uint64_t DataSize
Data Size of this GenDC part.
Definition decl_gendc_descriptor.hpp:36
std::uint64_t FlowOffset
Flow Offset of this GenDC part.
Definition decl_gendc_descriptor.hpp:34
PfncFormat Format
PFNC Format of this GenDC part.
Definition decl_gendc_descriptor.hpp:30
std::uint16_t FlowId
Flow ID of this GenDC part.
Definition decl_gendc_descriptor.hpp:32
Class representing a Semantic Version in Major.Minor.SubMinor format.
Definition version.hpp:14