IOLink IOL_v1.8.0_release
Loading...
Searching...
No Matches
ImageViewProvider.h
1#pragma once
2
3#include <memory>
4
5#include <iolink/IOLinkAPI.h>
6#include <iolink/view/ImageView.h>
7
8namespace iolink
9{
10
14class IOLINK_API ImageViewProvider
15{
16public:
17 //============================================================================
18 // Checking ImageView's capacities
19 //============================================================================
20
24 inline static bool isImage(std::shared_ptr<View> view) noexcept
25 {
26 return (dynamic_cast<const ImageView*>(view.get()) != nullptr);
27 }
28
29 //============================================================================
30 // Access to capacities interfaces
31 //============================================================================
32
38 inline static std::shared_ptr<ImageView> toImage(std::shared_ptr<View> view) noexcept
39 {
40 return std::dynamic_pointer_cast<ImageView>(view);
41 }
42
49 static std::shared_ptr<ImageView> toReadOnly(std::shared_ptr<ImageView> image);
50
57 static std::shared_ptr<ImageView> toWriteOnly(std::shared_ptr<ImageView> image);
58};
59
60} // end namespace iolink