|
vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
|
How a block of memory is read as a multidimensional array. More...
#include <vitrio/array/array_descriptor.hpp>
Public Member Functions | |
| array_descriptor () noexcept | |
| Construct a descriptor that describes nothing. | |
| array_descriptor (std::vector< std::size_t > extents, std::vector< std::ptrdiff_t > strides, std::ptrdiff_t offset, numerical_type data_type) | |
| Construct a descriptor from its components. | |
| array_descriptor (const array_descriptor &other) | |
| array_descriptor (array_descriptor &&other) noexcept | |
| array_descriptor & | operator= (const array_descriptor &other) |
| array_descriptor & | operator= (array_descriptor &&other) noexcept |
| span< const std::size_t > | get_extents () const noexcept |
| Get the number of elements along each axis. | |
| span< const std::ptrdiff_t > | get_strides () const noexcept |
| Get the distance between consecutive elements along each axis. | |
| std::ptrdiff_t | get_offset () const noexcept |
| Get the position of the element at the origin. | |
| numerical_type | get_data_type () const noexcept |
| Get the type of the elements. | |
Friends | |
| bool | operator== (const array_descriptor &lhs, const array_descriptor &rhs) noexcept |
| bool | operator!= (const array_descriptor &lhs, const array_descriptor &rhs) noexcept |
How a block of memory is read as a multidimensional array.
A descriptor states the extents of the array, where each of its elements is within the memory, and the type of the elements. It does not refer to any memory itself.
The element at index (i0,i1,...) is offset+i0*strides[0]+i1*strides[1]+... elements after the first byte of the memory. Strides and the offset are counted in elements, not in bytes. A stride may be negative, as long as the offset keeps every element at or after the first byte.
|
noexcept |
Construct a descriptor that describes nothing.
It has no extents and its data type is unknown.
| vitrio::array_descriptor::array_descriptor | ( | std::vector< std::size_t > | extents, |
| std::vector< std::ptrdiff_t > | strides, | ||
| std::ptrdiff_t | offset, | ||
| numerical_type | data_type | ||
| ) |
Construct a descriptor from its components.
| extents | Number of elements along each axis, slowest axis first. |
| strides | Distance between consecutive elements along each axis, in elements. There must be one per extent. |
| offset | Position of the element at the origin, in elements from the first byte of the memory. |
| data_type | Type of the elements. |
| std::invalid_argument | If strides does not have one stride per extent, or if data_type is unknown. |
|
noexcept |
Get the type of the elements.
Get the number of elements along each axis.
|
noexcept |
Get the position of the element at the origin.
Get the distance between consecutive elements along each axis.