vitrio 0.3.1
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
index_table.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2
3#pragma once
4
5#include <vitrio/export.hpp>
6#include <vitrio/span.hpp>
7
8#include <cstddef>
9#include <vector>
10
11namespace vitrio
12{
13
29{
30public:
34 VITRIO_API
35 index_table() noexcept;
36
42 VITRIO_API
43 explicit index_table(std::size_t rank);
44
45 VITRIO_API
46 index_table(const index_table &other);
47 VITRIO_API
48 index_table(index_table &&other) noexcept;
49 VITRIO_API
50 ~index_table();
51
52 VITRIO_API
53 index_table& operator=(const index_table &other);
54 VITRIO_API
55 index_table& operator=(index_table &&other) noexcept;
56
64 VITRIO_API
65 void add(span<const std::size_t> index);
66
70 VITRIO_API
71 void clear() noexcept;
72
78 VITRIO_API
79 void reserve(std::size_t count);
80
86 VITRIO_API
87 std::size_t get_rank() const noexcept;
88
94 VITRIO_API
95 std::size_t get_index_count() const noexcept;
96
106 VITRIO_API
107 span<const std::size_t> get(std::size_t position) const noexcept;
108
109private:
110 std::vector<std::size_t> m_values;
111 std::size_t m_rank;
112 std::size_t m_size;
113};
114
115} // namespace vitrio
std::size_t get_rank() const noexcept
Get the number of coordinates each index carries.
span< const std::size_t > get(std::size_t position) const noexcept
Get one index.
void reserve(std::size_t count)
Make room for a number of indices without allocating later.
void clear() noexcept
Drop the indices held, keeping the rank and the capacity.
std::size_t get_index_count() const noexcept
Get how many indices are held.
index_table() noexcept
Construct an empty table of rank zero.
void add(span< const std::size_t > index)
Append one index.
A view of a contiguous sequence of elements.
Definition span.hpp:29