| IOLink 1.11.0

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
8 namespace iolink
9{
10
14 class IOLINK_API ImageViewProvider
15{
16 public:
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
iolink::ImageView
Interface representing an N dimensional image.
Definition ImageView.h:70
iolink::ImageViewProvider
Utility class to check and convert a View into an ImagevView.
Definition ImageViewProvider.h:15
iolink::ImageViewProvider::toReadOnly
static std::shared_ptr< ImageView > toReadOnly(std::shared_ptr< ImageView > image)
Remove all capacities except READ to an ImageView.
iolink::ImageViewProvider::isImage
static bool isImage(std::shared_ptr< View > view) noexcept
Checks if a given View is an ImageView.
Definition ImageViewProvider.h:24
iolink::ImageViewProvider::toWriteOnly
static std::shared_ptr< ImageView > toWriteOnly(std::shared_ptr< ImageView > image)
Remove all capacities except WRITE to an ImageView.
iolink::ImageViewProvider::toImage
static std::shared_ptr< ImageView > toImage(std::shared_ptr< View > view) noexcept
Extracts the ImageView interface from a given generic view.
Definition ImageViewProvider.h:38
iolink
All IOLink symbols are enclosed in this namespace.
Definition ArrayX.h:8