vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
array_ref.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2
3#pragma once
4
5#include <vitrio/array/array_descriptor.hpp>
6#include <vitrio/byte.hpp>
7#include <vitrio/export.hpp>
8#include <vitrio/span.hpp>
9
10namespace vitrio
11{
12
13class array;
14
32{
33public:
39 VITRIO_API
40 array_ref() noexcept;
41
54 VITRIO_API
55 array_ref(span<byte> memory, const array_descriptor &descriptor);
56
57 // A temporary descriptor would be gone before the reference is used.
58 array_ref(span<byte> memory, const array_descriptor &&descriptor) = delete;
59
66 VITRIO_API
67 array_ref(array &other) noexcept;
68
69 // A temporary array would be gone before the reference is used. MSVC
70 // binds one to the constructor above unless this one is deleted.
71 array_ref(array &&other) = delete;
72
73 array_ref(const array_ref &other) noexcept = default;
74 ~array_ref() = default;
75
76 array_ref& operator=(const array_ref &other) noexcept = default;
77
84 VITRIO_API
85 const array_descriptor& get_descriptor() const noexcept;
86
94 VITRIO_API
95 byte* get_data() const noexcept;
96
97private:
98 byte *m_data;
99 const array_descriptor *m_descriptor;
100};
101
102} // namespace vitrio
How a block of memory is read as a multidimensional array.
Definition array_descriptor.hpp:31
A reference to a multidimensional array that does not keep it alive.
Definition array_ref.hpp:32
byte * get_data() const noexcept
Get the memory holding the elements.
const array_descriptor & get_descriptor() const noexcept
Get how the memory is read as an array.
array_ref() noexcept
Construct a reference to nothing.
A multidimensional array of numbers in host memory.
Definition array.hpp:37
A view of a contiguous sequence of elements.
Definition span.hpp:29