vitrio 0.1.4
High-throughput image I/O for Cryo-Electron Microscopy (CryoEM)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
vitrio::const_array_ref Class Reference

A read-only reference to a multidimensional array that does not keep it alive. More...

#include <vitrio/array/const_array_ref.hpp>

Public Member Functions

 const_array_ref () noexcept
 Construct a reference to nothing.
 
 const_array_ref (span< const byte > memory, const array_descriptor &descriptor)
 Construct a reference to memory the caller keeps alive.
 
 const_array_ref (span< const byte > memory, const array_descriptor &&descriptor)=delete
 
 const_array_ref (const array &other) noexcept
 Construct a reference to an array.
 
 const_array_ref (const const_array &other) noexcept
 Construct a reference to a read-only array.
 
 const_array_ref (array_ref other) noexcept
 Construct a reference to what another reference refers to.
 
 const_array_ref (const const_array_ref &other) noexcept=default
 
const_array_ref & operator= (const const_array_ref &other) noexcept=default
 
const array_descriptor & get_descriptor () const noexcept
 Get how the memory is read as an array.
 
const byte * get_data () const noexcept
 Get the memory holding the elements.
 

Detailed Description

A read-only reference to a multidimensional array that does not keep it alive.

It is an array_ref whose elements can only be read: two pointers that own nothing and are as cheap to copy. An array, a const_array and an array_ref each convert to it.

See also
const_array
array_ref

Constructor & Destructor Documentation

◆ const_array_ref() [1/5]

vitrio::const_array_ref::const_array_ref ( )
noexcept

Construct a reference to nothing.

Its descriptor is not initialized and it has no memory.

◆ const_array_ref() [2/5]

vitrio::const_array_ref::const_array_ref ( span< const byte >  memory,
const array_descriptor &  descriptor 
)

Construct a reference to memory the caller keeps alive.

Parameters
memoryThe memory holding the elements. It must outlive the reference and its copies.
descriptorHow memory is read as an array. It must outlive the reference and its copies.
Exceptions
std::invalid_argumentIf descriptor is not initialized, or if memory is not aligned to the elements.
std::out_of_rangeIf an element descriptor addresses lies outside memory.

◆ const_array_ref() [3/5]

vitrio::const_array_ref::const_array_ref ( const array &  other)
noexcept

Construct a reference to an array.

Parameters
otherThe array to refer to. It must outlive the reference and its copies.

◆ const_array_ref() [4/5]

vitrio::const_array_ref::const_array_ref ( const const_array &  other)
noexcept

Construct a reference to a read-only array.

Parameters
otherThe array to refer to. It must outlive the reference and its copies.

◆ const_array_ref() [5/5]

vitrio::const_array_ref::const_array_ref ( array_ref  other)
noexcept

Construct a reference to what another reference refers to.

Parameters
otherThe reference whose array to refer to.

Member Function Documentation

◆ get_data()

const byte * vitrio::const_array_ref::get_data ( ) const
noexcept

Get the memory holding the elements.

Returns
const byte* The first byte of the memory. The element at the origin is at the offset the descriptor states. Null when the reference is to nothing.

◆ get_descriptor()

const array_descriptor & vitrio::const_array_ref::get_descriptor ( ) const
noexcept

Get how the memory is read as an array.

Returns
const array_descriptor& The descriptor. Not initialized when the reference is to nothing.

The documentation for this class was generated from the following file: