| IOLink 1.11.0

Loading...
Searching...
No Matches
RegionX.h
1#pragma once
2
3#include <iolink/IOLinkAPI.h>
4#include <iolink/VectorX.h>
5
6 namespace iolink
7{
8
12 template <typename T>
13 class RegionX final
14{
15 public:
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
39 RegionX(const VectorType& origin, const SizeType& size);
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
143 private:
144 VectorType m_origin;
145 SizeType m_size;
146};
147
148// ============================ //
149// Extern template declarations //
150// ============================ //
151
152 extern template class IOLINK_API_IMPORT RegionX<uint64_t>;
153
154// ================= //
155// Alias definitions //
156// ================= //
157
158 using RegionXu64 = RegionX<uint64_t>;
159
160} // end namespace iolink
iolink::RegionX
A Region using dynamic vectors.
Definition RegionX.h:14
iolink::RegionX::intersection
RegionX intersection(const RegionX &other) const
Returns the intersection of this region and another.
iolink::RegionX::RegionX
RegionX(RegionX &&region) noexcept=default
move constructor
iolink::RegionX::RegionX
RegionX(const RegionX &region)=default
copy constructor
iolink::RegionX::createFullRegion
static RegionX createFullRegion(const SizeType &regionSize)
Utility factory that create the region of origin [0, 0, 0] and given size.
iolink::RegionX::contains
bool contains(const VectorType &position) const
Checks if this region contains a point.
iolink::RegionX::intersect
bool intersect(const RegionX &other) const
Checks if this region intersect another.
iolink::RegionX::dimensionCount
size_t dimensionCount() const
The dimension of this region.
iolink::RegionX::toString
std::string toString() const
Return a string representation.
iolink::RegionX::elementCount
size_t elementCount() const
Returns the number of cells in this region.
iolink::RegionX::min
VectorType min() const
Returns the minimal point of the region.
iolink::RegionX::max
VectorType max() const
Return the maximal point of the region.
iolink::RegionX::origin
const VectorType & origin() const
Returns the position of the region's origin.
iolink::RegionX::size
const SizeType & size() const
Returns the region's size.
iolink::RegionX::RegionX
RegionX(size_t dimension)
Creates an empty region.
iolink::RegionX::contains
bool contains(const RegionX &other) const
Checks if this region conatins another.
iolink::RegionX::extractSliceFromAxis
RegionX extractSliceFromAxis(size_t dimension, T origin) const
Returns a region of size one along one axis.
iolink::RegionX::isEmpty
bool isEmpty() const
Checks if the region is empty.
iolink::RegionX::RegionX
RegionX(const VectorType &origin, const SizeType &size)
Builds a region from its origin and size.
iolink::VectorX
A dynamically sized arithmetic vector.
Definition VectorX.h:18
iolink
All IOLink symbols are enclosed in this namespace.
Definition ArrayX.h:8