vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
vitrio::index_table Class Reference

A sequence of indices of one and the same rank. More...

#include <vitrio/index_table.hpp>

Public Member Functions

 index_table () noexcept
 Construct an empty table of rank zero.
 
 index_table (std::size_t rank)
 Construct an empty table of a given rank.
 
 index_table (const index_table &other)
 
 index_table (index_table &&other) noexcept
 
index_table & operator= (const index_table &other)
 
index_table & operator= (index_table &&other) noexcept
 
void add (span< const std::size_t > index)
 Append one index.
 
void clear () noexcept
 Drop the indices held, keeping the rank and the capacity.
 
void reserve (std::size_t count)
 Make room for a number of indices without allocating later.
 
std::size_t get_rank () const noexcept
 Get the number of coordinates each index carries.
 
std::size_t get_index_count () const noexcept
 Get how many indices are held.
 
span< const std::size_t > get (std::size_t position) const noexcept
 Get one index.
 

Detailed Description

A sequence of indices of one and the same rank.

Each index is a tuple of one coordinate per axis. The indices are held in one flat vector of get_index_count by get_rank values rather than one vector each, so a table of any length costs a bounded number of allocations, and clear keeps the capacity: a table refilled after clearing allocates nothing until it outgrows what it held before.

The rank is stated when a table is constructed and never changes, so every index it holds carries it. A table of rank zero holds indices of no coordinates, each addressing the single position a space of rank zero has.

Constructor & Destructor Documentation

◆ index_table()

vitrio::index_table::index_table ( std::size_t  rank)
explicit

Construct an empty table of a given rank.

Parameters
rankNumber of coordinates each index carries.

Member Function Documentation

◆ add()

void vitrio::index_table::add ( span< const std::size_t >  index)

Append one index.

Parameters
indexThe coordinates. Their number must equal get_rank.
Exceptions
std::invalid_argumentIf index does not have the rank of this table.

◆ get()

span< const std::size_t > vitrio::index_table::get ( std::size_t  position) const
noexcept

Get one index.

Parameters
positionPosition of the index. Must be below get_index_count.
Returns
span<const std::size_t> The coordinates, of rank get_rank. It refers to storage owned by this table, which adding to, assigning to or destroying it invalidates.

◆ get_index_count()

std::size_t vitrio::index_table::get_index_count ( ) const
noexcept

Get how many indices are held.

Returns
std::size_t The number of indices.

◆ get_rank()

std::size_t vitrio::index_table::get_rank ( ) const
noexcept

Get the number of coordinates each index carries.

Returns
std::size_t The rank.

◆ reserve()

void vitrio::index_table::reserve ( std::size_t  count)

Make room for a number of indices without allocating later.

Parameters
countNumber of indices to make room for.

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