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 | Friends | List of all members
rexlib::dynamic_subscript Class Reference

Class describing a runtime defined subscript. More...

#include <rexlib/core/layout/dynamic_subscript.hpp>

Public Types

enum class  subscript_type { ellipsis , new_axis , index , slice }
 Enumeration holding the types this object can hold.
 

Public Member Functions

REXLIB_NO_EXPLICIT REXLIB_CONSTEXPR dynamic_subscript (ellipsis_tag) noexcept
 Construct a dynamic_subscript holding an ellipsis_tag.
 
REXLIB_NO_EXPLICIT REXLIB_CONSTEXPR dynamic_subscript (new_axis_tag) noexcept
 Construct a dynamic_subscript holding a new_axis_tag.
 
REXLIB_NO_EXPLICIT REXLIB_CONSTEXPR dynamic_subscript (std::ptrdiff_t index) noexcept
 Construct a dynamic_subscript holding an index.
 
REXLIB_NO_EXPLICIT REXLIB_CONSTEXPR dynamic_subscript (const slice &slice) noexcept
 Construct a dynamic_subscript holding a slice.
 
 dynamic_subscript (const dynamic_subscript &other)=default
 
 dynamic_subscript (dynamic_subscript &&other)=default
 
dynamic_subscript & operator= (const dynamic_subscript &other)=default
 
dynamic_subscript & operator= (dynamic_subscript &&other)=default
 
REXLIB_CONSTEXPR subscript_type get_subscript_type () const noexcept
 Get the subscript type held by this object.
 
std::ptrdiff_t get_index () const
 Get the index.
 
slice get_slice () const
 Get the slice.
 

Friends

template<typename T >
std::basic_ostream< T > & operator<< (std::basic_ostream< T > &os, const dynamic_subscript &subscript)
 

Detailed Description

Class describing a runtime defined subscript.

A subscript may be either a

Constructor & Destructor Documentation

◆ dynamic_subscript() [1/2]

REXLIB_NO_EXPLICIT REXLIB_CONSTEXPR rexlib::dynamic_subscript::dynamic_subscript ( std::ptrdiff_t  index)
noexcept

Construct a dynamic_subscript holding an index.

Parameters
indexThe index that is assigned to this object.

◆ dynamic_subscript() [2/2]

REXLIB_NO_EXPLICIT REXLIB_CONSTEXPR rexlib::dynamic_subscript::dynamic_subscript ( const slice &  slice)
noexcept

Construct a dynamic_subscript holding a slice.

Parameters
slicethe slice that is assigned to this object.

Member Function Documentation

◆ get_index()

std::ptrdiff_t rexlib::dynamic_subscript::get_index ( ) const

Get the index.

This method shall only be called if get_subscript_type() returns subscript_type::index. Otherwise an exception is thrown.

Returns
std::ptrdiff_t The index held by this object.
Exceptions
bad_dynamic_subscript_access

◆ get_slice()

slice rexlib::dynamic_subscript::get_slice ( ) const

Get the slice.

This method shall only be called if get_subscript_type() returns subscript_type::slice. Otherwise an exception is thrown.

Returns
slice The slice held by this object.
Exceptions
bad_dynamic_subscript_access

◆ get_subscript_type()

REXLIB_CONSTEXPR subscript_type rexlib::dynamic_subscript::get_subscript_type ( ) const
noexcept

Get the subscript type held by this object.

Returns
subscript_type

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