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 
9 namespace Cvb
10 {
11 
12 CVB_BEGIN_INLINE_NS
13 
14 namespace 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  virtual ~MultiPartImage() = default;
29 
31 
35  int NumParts() const noexcept
36  {
37  return composite_.ItemCount();
38  }
39 
41 
46  CompositeVariant GetPartAt(int index) const
47  {
48  return composite_.ItemAt(index);
49  }
50 
52 
58  {
59  CVB_CALL_CAPI(ShareObject(object->Handle()));
60  return FromHandle<MultiPartImage>(HandleGuard<Image>(object->Handle()));
61  }
62 
63  protected:
64 
65  MultiPartImage(HandleGuard<Image>&& guard) noexcept
66  : StreamImage(std::move(guard))
67  , composite_(*this)
68  {
69  }
70 
71  private:
72  Composite composite_;
73 };
74 
75 }
76 
77 using Driver::MultiPartImage;
78 
79 CVB_END_INLINE_NS
80 
81 
82 
83 }
84 
STL class.
This class is a replacement for C++17 std::variant.
Definition: variant.hpp:48
MultiPart image class.
Definition: multi_part_image.hpp:20
Base class of all stream related images.
Definition: stream_image.hpp:31
Root namespace for the Image Manager interface.
Definition: version.hpp:11
The Common Vision Blox image.
Definition: decl_image.hpp:44
int NumParts() const noexcept
Number of parts in the multi part image.
Definition: multi_part_image.hpp:35
CompositeVariant GetPartAt(int index) const
Access to a multi part image element specified by its index.
Definition: multi_part_image.hpp:46
static MultiPartImagePtr FromComposite(CompositePtr object)
Creates an image object from a composite.
Definition: multi_part_image.hpp:57
Component class is a container for CVB objects.
Definition: decl_composite.hpp:44
int ItemCount() const noexcept
Number of variants in the composite.
Definition: decl_composite.hpp:152
CompositeVariant ItemAt(int index) const
Access to a composite item specified by its index.
Definition: decl_composite.hpp:192