IOLink IOL_v1.8.0_release
Loading...
Searching...
No Matches
RegionX.h
1#pragma once
2
3#include <iolink/IOLinkAPI.h>
4#include <iolink/VectorX.h>
5
6namespace iolink
7{
8
12template <typename T>
13class RegionX final
14{
15public:
16 using VectorType = VectorX<T>;
17 using SizeType = VectorX<T>;
18
19 static RegionX fromIndex(const VectorX<T>& index);
20
26 explicit RegionX(size_t dimension);
27
29 RegionX(const RegionX& region) = default;
30 RegionX& operator=(const RegionX& other) = default;
31
33 RegionX(RegionX&& region) noexcept = default;
34 RegionX& operator=(RegionX&& other) noexcept = default;
35
40
44 static RegionX createFullRegion(const SizeType& regionSize);
45
49 size_t dimensionCount() const;
50
54 const VectorType& origin() const;
55
59 const SizeType& size() const;
60
66 VectorType min() const;
67
71 VectorType max() const;
72
79 size_t elementCount() const;
80
87 bool isEmpty() const;
88
93 bool contains(const RegionX& other) const;
94
99 bool contains(const VectorType& position) const;
100
105 bool intersect(const RegionX& other) const;
106
113 RegionX intersection(const RegionX& other) const;
114
133 RegionX extractSliceFromAxis(size_t dimension, T origin) const;
134
135 bool operator==(const RegionX& other) const;
136 bool operator!=(const RegionX& other) const;
137
141 std::string toString() const;
142
143private:
144 VectorType m_origin;
145 SizeType m_size;
146};
147
148// ============================ //
149// Extern template declarations //
150// ============================ //
151
152extern template class IOLINK_API_IMPORT RegionX<uint64_t>;
153
154// ================= //
155// Alias definitions //
156// ================= //
157
159
160} // end namespace iolink