| IOLink 1.11.0

Loading...
Searching...
No Matches
ParallelAccessExtension.h
1#pragma once
2
3#include <memory>
4#include <string>
5
6#include <iolink/FlagSet.h>
7#include <iolink/view/Extension.h>
8
9 namespace iolink
10{
11
15 enum class ParallelAccessCapability
16{
27 THREAD_SAFE = 0x1,
28
36 PARALLEL_TILE_READ = 0x2,
37
45 PARALLEL_TILE_WRITE = 0x4,
46
54 PARALLEL_READ = 0x8,
55
63 PARALLEL_WRITE = 0x10
64};
65
66 extern template class IOLINK_API_IMPORT FlagSet<ParallelAccessCapability>;
67
71 using ParallelAccessCapabilitySet = FlagSet<ParallelAccessCapability>;
72
73// Define bitwise operators for ParallelAccessCapability
74IOLINK_DEFINE_ENUM_BITWISE_OPERATORS(ParallelAccessCapability)
75
76
88class IOLINK_API ParallelAccessExtension : public Extension
89{
90 public:
94 static constexpr size_t EXTENSION_ID = 0x2;
95
102 inline static std::shared_ptr<ParallelAccessExtension> cast(const std::shared_ptr<Extension>& extension)
103 {
104 return std::dynamic_pointer_cast<ParallelAccessExtension>(extension);
105 }
106
110 virtual ParallelAccessCapabilitySet capabilities() const = 0;
111
115 inline bool support(ParallelAccessCapabilitySet flags) { return this->capabilities().has(flags); }
116
120 std::string toString() const;
121};
122
123} // end namespace iolink
iolink::Extension
Parent class for all views extensions.
Definition Extension.h:25
iolink::FlagSet
Template class to handle a flags system from an enum.
Definition FlagSet.h:43
iolink::ParallelAccessExtension
ImageView extension to give information about how to efficiently access it in a multi-threaded enviro...
Definition ParallelAccessExtension.h:89
iolink::ParallelAccessExtension::support
bool support(ParallelAccessCapabilitySet flags)
Checks if the view supports the given capabilities.
Definition ParallelAccessExtension.h:115
iolink::ParallelAccessExtension::capabilities
virtual ParallelAccessCapabilitySet capabilities() const =0
Return the parallel-access capabilities of this view.
iolink::ParallelAccessExtension::toString
std::string toString() const
String representation of the extension.
iolink::ParallelAccessExtension::cast
static std::shared_ptr< ParallelAccessExtension > cast(const std::shared_ptr< Extension > &extension)
Upcast a generic extension to this specific type.
Definition ParallelAccessExtension.h:102
iolink
All IOLink symbols are enclosed in this namespace.
Definition ArrayX.h:8
iolink::ParallelAccessCapability
ParallelAccessCapability
Define multi-access capabilities of an ImageView.
Definition ParallelAccessExtension.h:16
iolink::ParallelAccessCapability::THREAD_SAFE
@ THREAD_SAFE
Image can be multi-accessed (READ and/or WRITE) without any race condition, but with no control on th...
iolink::ParallelAccessCapability::PARALLEL_TILE_WRITE
@ PARALLEL_TILE_WRITE
Hints that writing tiles in parallel will provide performance benefits, But remember that parallel ca...
iolink::ParallelAccessCapability::PARALLEL_TILE_READ
@ PARALLEL_TILE_READ
Hints that reading tiles in parallel will provide performance benefits.
iolink::ParallelAccessCapability::PARALLEL_WRITE
@ PARALLEL_WRITE
Hints that regions of the image can be written in parallel with performance benefits.
iolink::ParallelAccessCapability::PARALLEL_READ
@ PARALLEL_READ
Hints that regions of the image can be read in parallel with performance benefits.