CVB++ 15.0
multi_part_image.hpp
1#pragma once
2
3#include <limits>
4
5#include "../global.hpp"
6#include "../composite.hpp"
7#include "stream_image.hpp"
8
9namespace Cvb
10{
11
12CVB_BEGIN_INLINE_NS
13
14namespace Driver
15{
16
18
21 : public StreamImage
22 , public std::enable_shared_from_this<MultiPartImage>
23{
24 friend class Image;
25
26 public:
27
28 MultiPartImage(const MultiPartImage& other) = delete;
29 MultiPartImage& operator=(const MultiPartImage& other) = delete;
30 MultiPartImage(MultiPartImage&& other) = delete;
31 MultiPartImage& operator=(MultiPartImage&& other) = delete;
32 virtual ~MultiPartImage() = default;
33
35
39 int NumParts() const noexcept
40 {
41 return composite_.ItemCount();
42 }
43
45
50 CompositeVariant GetPartAt(int index) const
51 {
52 return composite_.ItemAt(index);
53 }
54
56
62 {
63 CVB_CALL_CAPI(ShareObject(object->Handle()));
64 return FromHandle<MultiPartImage>(HandleGuard<Image>(object->Handle()));
65 }
66
67 protected:
68
69 explicit MultiPartImage(HandleGuard<Image>&& guard)
70 : StreamImage(std::move(guard))
71 , composite_(*this)
72 {
73 }
74
75 private:
76 Composite composite_;
77};
78
79}
80
81using Driver::MultiPartImage;
82
83CVB_END_INLINE_NS
84
85
86
87}
88
Component class is a container for CVB objects.
Definition: decl_composite.hpp:45
CompositeVariant ItemAt(int index) const
Access to a composite item specified by its index.
Definition: decl_composite.hpp:192
int ItemCount() const noexcept
Number of variants in the composite.
Definition: decl_composite.hpp:152
MultiPart image class.
Definition: multi_part_image.hpp:23
static MultiPartImagePtr FromComposite(CompositePtr object)
Creates an image object from a composite.
Definition: multi_part_image.hpp:61
int NumParts() const noexcept
Number of parts in the multi part image.
Definition: multi_part_image.hpp:39
CompositeVariant GetPartAt(int index) const
Access to a multi part image element specified by its index.
Definition: multi_part_image.hpp:50
Base class of all stream related images.
Definition: stream_image.hpp:33
The Common Vision Blox image.
Definition: decl_image.hpp:45
This class is a replacement for C++17 std::variant.
Definition: variant.hpp:49
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24