IOLink  IOL_v1.2.0_release
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 
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 
34 
35 // Define bitwise operators for MultiImageCapability
36 IOLINK_DEFINE_ENUM_BITWISE_OPERATORS(MultiImageCapability)
37 
38 
49 class 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