|
vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
|
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. | |
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.
|
explicit |
Construct an empty table of a given rank.
| rank | Number of coordinates each index carries. |
Append one index.
| index | The coordinates. Their number must equal get_rank. |
| std::invalid_argument | If index does not have the rank of this table. |
Get one index.
| position | Position of the index. Must be below get_index_count. |
|
noexcept |
Get how many indices are held.
|
noexcept |
Get the number of coordinates each index carries.
| void vitrio::index_table::reserve | ( | std::size_t | count | ) |
Make room for a number of indices without allocating later.
| count | Number of indices to make room for. |