rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
numerical_type_domain.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include "numerical_type.hpp"
6
7#include "../platform/constexpr.hpp"
8#include "../platform/dynamic_shared_object.h"
9
10#include <cstdint>
11#include <initializer_list>
12#include <ostream>
13
14namespace rexlib
15{
16
32{
33public:
37 using mask_type = std::uint32_t;
38
42 REXLIB_CONSTEXPR
44
50 REXLIB_CONSTEXPR
52
61 REXLIB_CONSTEXPR_CPP14
64 ) noexcept;
65
69
74
83 REXLIB_CONSTEXPR
85
92 REXLIB_CONSTEXPR
94
100 REXLIB_CONSTEXPR
102
108 static REXLIB_CONSTEXPR
110
116 static REXLIB_CONSTEXPR
118
119 friend REXLIB_CONSTEXPR bool operator==(
122 ) noexcept
123 {
124 return lhs.get_mask() == rhs.get_mask();
125 }
126
127 friend REXLIB_CONSTEXPR bool operator!=(
130 ) noexcept
131 {
132 return !(lhs == rhs);
133 }
134
138 friend REXLIB_CONSTEXPR numerical_type_domain operator&(
141 ) noexcept
142 {
143 return numerical_type_domain(lhs.get_mask() & rhs.get_mask());
144 }
145
149 friend REXLIB_CONSTEXPR numerical_type_domain operator|(
152 ) noexcept
153 {
154 return numerical_type_domain(lhs.get_mask() | rhs.get_mask());
155 }
156
166 friend REXLIB_API std::ostream& operator<<(
167 std::ostream &os,
169 );
170
171private:
172 mask_type m_mask;
173};
174
185REXLIB_CONSTEXPR
187
194REXLIB_CONSTEXPR
196
205REXLIB_CONSTEXPR_CPP14
208) noexcept;
209
210
211
212} // namespace rexlib
213
214#include "numerical_type_domain.inl"
Container for multidimensional numeric data.
Definition array.hpp:31
Set of numerical_type-s.
Definition numerical_type_domain.hpp:32
friend REXLIB_CONSTEXPR numerical_type_domain operator|(const numerical_type_domain &lhs, const numerical_type_domain &rhs) noexcept
Compute the union of two domains.
Definition numerical_type_domain.hpp:149
REXLIB_CONSTEXPR mask_type get_mask() const noexcept
Get the bit mask representation of the domain.
REXLIB_CONSTEXPR bool empty() const noexcept
Check whether the domain admits no type at all.
std::uint32_t mask_type
Underlying bit mask representation.
Definition numerical_type_domain.hpp:37
friend REXLIB_CONSTEXPR numerical_type_domain operator&(const numerical_type_domain &lhs, const numerical_type_domain &rhs) noexcept
Compute the intersection of two domains.
Definition numerical_type_domain.hpp:138
REXLIB_CONSTEXPR bool contains(numerical_type type) const noexcept
Check whether a type belongs to this domain.
static REXLIB_CONSTEXPR numerical_type_domain all() noexcept
Create the domain containing every representable type.
friend std::ostream & operator<<(std::ostream &os, const numerical_type_domain &domain)
Write a human readable representation of a domain.
static REXLIB_CONSTEXPR numerical_type_domain none() noexcept
Create the domain containing no type.
REXLIB_CONSTEXPR numerical_type_domain() noexcept
Construct an empty domain.
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
REXLIB_CONSTEXPR bool is_domain_representable(numerical_type type) noexcept
Check whether a type has a bit representation within a domain.
numerical_type
Representation of all considered numerical types for computations.
Definition numerical_type.hpp:19
numerical_type_category
Broad categorical classification of numerical_type.
Definition numerical_type.hpp:54
REXLIB_CONSTEXPR_CPP14 numerical_type_domain make_numerical_type_domain(numerical_type_category category) noexcept
Create the domain holding every type of a given category.