| IOLink 1.11.0

Loading...
Searching...
No Matches
MultiImageView.h
1#pragma once
2
3#include <cstdint>
4#include <memory>
5
6#include <iolink/FlagSet.h>
7#include <iolink/IOLinkAPI.h>
8#include <iolink/metadata/MetadataNode.h>
9#include <iolink/view/ImageView.h>
10#include <iolink/view/View.h>
11
12 namespace iolink
13{
14
18 enum class MultiImageCapability
19{
20 // Flags
21 READ = 0x1,
22 WRITE = 0x2,
23
24 // Combinations
25 READ_WRITE = 0x3,
26};
27
28 extern template class IOLINK_API_IMPORT FlagSet<MultiImageCapability>;
29
33 using MultiImageCapabilitySet = FlagSet<MultiImageCapability>;
34
35// Define bitwise operators for MultiImageCapability
36IOLINK_DEFINE_ENUM_BITWISE_OPERATORS(MultiImageCapability)
37
38
49class IOLINK_API MultiImageView : public View
50{
51 public:
52 virtual ~MultiImageView() = default;
53
57 virtual MultiImageCapabilitySet capabilities() const = 0;
58
62 inline bool support(MultiImageCapabilitySet flags) { return this->capabilities().has(flags); }
63
67 std::string toString() const;
68
69 // ==== //
70 // READ //
71 // ==== //
72
81 virtual size_t frameCount() const;
82
89 virtual std::shared_ptr<ImageView> frame(size_t index);
90
94 virtual std::shared_ptr<const MetadataNode> metadata() const;
95
96 // ===== //
97 // WRITE //
98 // ===== //
99
103 virtual void addFrame(std::shared_ptr<ImageView> newFrame);
104
108 virtual void setFrame(size_t index, std::shared_ptr<ImageView> frame);
109
113 virtual void removeFrame(size_t index);
114
118 virtual void setMetadata(std::shared_ptr<MetadataNode> metadata);
119};
120
121} // namespace iolink
iolink::FlagSet
Template class to handle a flags system from an enum.
Definition FlagSet.h:43
iolink::MultiImageView
Interface representing a multi-image view, i.e.
Definition MultiImageView.h:50
iolink::MultiImageView::frame
virtual std::shared_ptr< ImageView > frame(size_t index)
Gets the ith frame of the set.
iolink::MultiImageView::toString
std::string toString() const
Return a string representation.
iolink::MultiImageView::setFrame
virtual void setFrame(size_t index, std::shared_ptr< ImageView > frame)
Set the frame at the given index (index must already exist, no allocation)
iolink::MultiImageView::support
bool support(MultiImageCapabilitySet flags)
Checks if the MultiImageView supports the given capabilities.
Definition MultiImageView.h:62
iolink::MultiImageView::removeFrame
virtual void removeFrame(size_t index)
Remove the ith frame.
iolink::MultiImageView::metadata
virtual std::shared_ptr< const MetadataNode > metadata() const
Returns the root node of the metadata attached to this multi-image.
iolink::MultiImageView::addFrame
virtual void addFrame(std::shared_ptr< ImageView > newFrame)
Add a new frame at the end of the set.
iolink::MultiImageView::capabilities
virtual MultiImageCapabilitySet capabilities() const =0
Return the capabilities of this multi image.
iolink::MultiImageView::setMetadata
virtual void setMetadata(std::shared_ptr< MetadataNode > metadata)
Attach a new metadata node to the image.
iolink::MultiImageView::frameCount
virtual size_t frameCount() const
Returns the number of frames in the set.
iolink::View
Interface representing a generic view on data.
Definition View.h:16
iolink
All IOLink symbols are enclosed in this namespace.
Definition ArrayX.h:8
iolink::RandomAccessCapability::READ
@ READ
Data can be read.
iolink::RandomAccessCapability::WRITE
@ WRITE
Data can be written.
iolink::MultiImageCapability
MultiImageCapability
Define capabilities of an MultiImageView.
Definition MultiImageView.h:19