rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
rexlib::numerical_type_domain Class Reference

Set of numerical_type-s. More...

#include <rexlib/core/numerical/numerical_type_domain.hpp>

Public Types

using mask_type = std::uint32_t
 Underlying bit mask representation.
 

Public Member Functions

REXLIB_CONSTEXPR numerical_type_domain () noexcept
 Construct an empty domain.
 
REXLIB_CONSTEXPR numerical_type_domain (mask_type mask) noexcept
 Construct a domain from its bit mask representation.
 
REXLIB_CONSTEXPR_CPP14 numerical_type_domain (std::initializer_list< numerical_type > types) noexcept
 Construct a domain from an explicit list of types.
 
 numerical_type_domain (const numerical_type_domain &other)=default
 
 numerical_type_domain (numerical_type_domain &&other) noexcept=default
 
numerical_type_domain & operator= (const numerical_type_domain &other)=default
 
numerical_type_domain & operator= (numerical_type_domain &&other) noexcept=default
 
REXLIB_CONSTEXPR bool contains (numerical_type type) const noexcept
 Check whether a type belongs to this domain.
 
REXLIB_CONSTEXPR bool empty () const noexcept
 Check whether the domain admits no type at all.
 
REXLIB_CONSTEXPR mask_type get_mask () const noexcept
 Get the bit mask representation of the domain.
 

Static Public Member Functions

static REXLIB_CONSTEXPR numerical_type_domain all () noexcept
 Create the domain containing every representable type.
 
static REXLIB_CONSTEXPR numerical_type_domain none () noexcept
 Create the domain containing no type.
 

Friends

REXLIB_CONSTEXPR bool operator== (const numerical_type_domain &lhs, const numerical_type_domain &rhs) noexcept
 
REXLIB_CONSTEXPR bool operator!= (const numerical_type_domain &lhs, const numerical_type_domain &rhs) noexcept
 
REXLIB_CONSTEXPR numerical_type_domain operator& (const numerical_type_domain &lhs, const numerical_type_domain &rhs) noexcept
 Compute the intersection of two domains.
 
REXLIB_CONSTEXPR numerical_type_domain operator| (const numerical_type_domain &lhs, const numerical_type_domain &rhs) noexcept
 Compute the union of two domains.
 
std::ostream & operator<< (std::ostream &os, const numerical_type_domain &domain)
 Write a human readable representation of a domain.
 

Detailed Description

Set of numerical_type-s.

Represents which numerical types are admissible in a given context, such as the operand types an operation accepts or the subset of those a backend is able to execute. Domains compose with the usual set operations, which lets a backend narrow an operation's domain without restating it.

The set is stored as a bit mask indexed by the numerical_type enumerator, so it is a trivially copyable value type.

See also
numerical_type

Constructor & Destructor Documentation

◆ numerical_type_domain() [1/2]

REXLIB_CONSTEXPR rexlib::numerical_type_domain::numerical_type_domain ( mask_type  mask)
explicitnoexcept

Construct a domain from its bit mask representation.

Parameters
maskThe bit mask, indexed by numerical_type enumerator.

◆ numerical_type_domain() [2/2]

REXLIB_CONSTEXPR_CPP14 rexlib::numerical_type_domain::numerical_type_domain ( std::initializer_list< numerical_type >  types)
noexcept

Construct a domain from an explicit list of types.

Types with no bit representation, such as numerical_type::unknown, are ignored.

Parameters
typesThe types belonging to the domain.

Member Function Documentation

◆ all()

static REXLIB_CONSTEXPR numerical_type_domain rexlib::numerical_type_domain::all ( )
staticnoexcept

Create the domain containing every representable type.

Returns
numerical_type_domain The full domain.

◆ contains()

REXLIB_CONSTEXPR bool rexlib::numerical_type_domain::contains ( numerical_type  type) const
noexcept

Check whether a type belongs to this domain.

Parameters
typeThe type to be tested.
Returns
true The type belongs to the domain.
false The type does not belong to the domain, or has no bit representation.

◆ empty()

REXLIB_CONSTEXPR bool rexlib::numerical_type_domain::empty ( ) const
noexcept

Check whether the domain admits no type at all.

Returns
true The domain is empty.
false The domain admits at least one type.

◆ get_mask()

REXLIB_CONSTEXPR mask_type rexlib::numerical_type_domain::get_mask ( ) const
noexcept

Get the bit mask representation of the domain.

Returns
mask_type The bit mask.

◆ none()

static REXLIB_CONSTEXPR numerical_type_domain rexlib::numerical_type_domain::none ( )
staticnoexcept

Create the domain containing no type.

Returns
numerical_type_domain The empty domain.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const numerical_type_domain &  domain 
)
friend

Write a human readable representation of a domain.

The types are listed in enumerator order, separated by commas.

Parameters
osThe stream where the domain is written.
domainThe domain to be written.
Returns
std::ostream& The stream.

The documentation for this class was generated from the following file: