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
12 CVB_BEGIN_INLINE_NS
13
14 namespace Driver
15 {
16
18
20 class MultiPartImage
21 : public StreamImage
22 , public std::enable_shared_from_this<MultiPartImage>
23 {
24 friend class Image;
25
26 public:
27 MultiPartImage(const MultiPartImage &other) = delete;
28 MultiPartImage &operator=(const MultiPartImage &other) = delete;
29 MultiPartImage(MultiPartImage &&other) = delete;
30 MultiPartImage &operator=(MultiPartImage &&other) = delete;
31 virtual ~MultiPartImage() = default;
32
34
38 int NumParts() const noexcept
39 {
40 return composite_.ItemCount();
41 }
42
44
49 CompositeVariant GetPartAt(int index) const
50 {
51 return composite_.ItemAt(index);
52 }
53
55
61 {
62 CVB_CALL_CAPI(ShareObject(object->Handle()));
63 return FromHandle<MultiPartImage>(HandleGuard<Image>(object->Handle()));
64 }
65
66 protected:
67 explicit MultiPartImage(HandleGuard<Image> &&guard)
68 : StreamImage(std::move(guard))
69 , composite_(*this)
70 {
71 }
72
73 private:
74 Composite composite_;
75 };
76
77 } // namespace Driver
78
80
81 CVB_END_INLINE_NS
82
83} // namespace Cvb
Component class is a container for CVB objects.
Definition decl_composite.hpp:45
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:60
int NumParts() const noexcept
Number of parts in the multi part image.
Definition multi_part_image.hpp:38
CompositeVariant GetPartAt(int index) const
Access to a multi part image element specified by its index.
Definition multi_part_image.hpp:49
Base class of all stream related images.
Definition stream_image.hpp:32
static std::unique_ptr< Image > FromHandle(HandleGuard< Image > &&guard)
Creates an image from a classic API handle.
Definition decl_image.hpp:155
cvbbool_t ShareObject(OBJ Object)
Namespace for driver or device related operations.
Definition decl_composite.hpp:27
std::shared_ptr< MultiPartImage > MultiPartImagePtr
Convenience shared pointer for StreamImage.
Definition driver.hpp:88
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
Cvb::variant< ImagePtr, PlanePtr, PlaneEnumeratorPtr, BufferPtr, PFNCBufferPtr, CompressedPFNCBufferPtr, HandleOnlyPtr > CompositeVariant
Variant that can contain the different types of composite items.
Definition decl_composite.hpp:38
std::shared_ptr< Composite > CompositePtr
Convenience shared pointer for Composite.
Definition global.hpp:102