vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
array.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/array/const_array.hpp>
7#include <vitrio/byte.hpp>
8#include <vitrio/export.hpp>
9#include <vitrio/span.hpp>
10
11#include <memory>
12
13namespace vitrio
14{
15
16class array_implementation;
17
36class array
37{
38public:
44 VITRIO_API
45 array() noexcept;
46
62 VITRIO_API
64 span<byte> memory,
65 std::shared_ptr<void> owner,
66 array_descriptor descriptor
67 );
68
69 array(const array &other) = delete;
70 VITRIO_API
71 array(array &&other) noexcept;
72 VITRIO_API
73 ~array();
74
75 array& operator=(const array &other) = delete;
76 VITRIO_API
77 array& operator=(array &&other) noexcept;
78
85 VITRIO_API
86 const array_descriptor& get_descriptor() const noexcept;
87
95 VITRIO_API
96 byte* get_data() noexcept;
97
105 VITRIO_API
106 const byte* get_data() const noexcept;
107
114 VITRIO_API
115 array share() noexcept;
116
123 VITRIO_API
124 const_array share_const() const noexcept;
125
126private:
127 explicit array(
128 std::shared_ptr<const array_implementation> implementation
129 ) noexcept;
130
131 std::shared_ptr<const array_implementation> m_implementation;
132};
133
146VITRIO_API
147array make_array(const array_descriptor &descriptor);
148
149} // namespace vitrio
How a block of memory is read as a multidimensional array.
Definition array_descriptor.hpp:31
A multidimensional array of numbers in host memory.
Definition array.hpp:37
const_array share_const() const noexcept
Make a read-only array over the same memory.
array share() noexcept
Make another array over the same memory.
byte * get_data() noexcept
Get the memory holding the elements.
const array_descriptor & get_descriptor() const noexcept
Get how the memory is read as an array.
array() noexcept
Construct an array that holds nothing.
A multidimensional array of numbers that cannot be written through.
Definition const_array.hpp:29
A view of a contiguous sequence of elements.
Definition span.hpp:29