rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rexlib::array_ref Class Reference

Non-owning reference to an array. More...

#include <rexlib/core/ndarray/array_ref.hpp>

Public Member Functions

 array_ref () noexcept
 Construct an uninitialized array_ref.
 
 array_ref (const array_implementation *implementation) noexcept
 Construct an array_ref from an implementation pointer.
 
 array_ref (array &other) noexcept
 Construct an array_ref referencing an array.
 
 array_ref (const array_ref &other) noexcept=default
 
 array_ref (array_ref &&other) noexcept=default
 
array_ref & operator= (const array_ref &other) noexcept=default
 
array_ref & operator= (array_ref &&other) noexcept=default
 
const array_descriptor & get_descriptor () const noexcept
 Get the descriptor of this array.
 
buffer * get_storage () noexcept
 Get the storage of this array.
 
const buffer * get_storage () const noexcept
 Get the storage of this array.
 
std::shared_ptr< buffer > share_storage () noexcept
 Get a shared pointer to the storage of this array.
 
std::shared_ptr< const buffer > share_storage () const noexcept
 Get a shared pointer to the storage of this array.
 
access_hazard_tracker * get_access_hazard_tracker () const noexcept
 Get the tracker of the commands that access the memory of this array.
 
const array_implementation * get_implementation () const noexcept
 Get a pointer to the implementation.
 

Detailed Description

Non-owning reference to an array.

An array_ref refers to the contents of an array without sharing its ownership. It is intended to be used as a parameter type at interface boundaries where ownership does not need to be extended, analogously to std::string_view. The referenced array must outlive the array_ref; do not store array_ref objects.

See also
array
const_array_ref

Constructor & Destructor Documentation

◆ array_ref() [1/2]

rexlib::array_ref::array_ref ( const array_implementation *  implementation)
explicitnoexcept

Construct an array_ref from an implementation pointer.

Parameters
implementationThe implementation referenced by this.
Note
This function is not part of the public API and shall only be used internally or for testing purposes.

◆ array_ref() [2/2]

rexlib::array_ref::array_ref ( array &  other)
noexcept

Construct an array_ref referencing an array.

Parameters
otherThe array to be referenced. Must outlive this array_ref.

Member Function Documentation

◆ get_access_hazard_tracker()

access_hazard_tracker * rexlib::array_ref::get_access_hazard_tracker ( ) const
noexcept

Get the tracker of the commands that access the memory of this array.

Arrays obtained from one another share one tracker. Arrays built separately over the same storage do not.

Returns
access_hazard_tracker* The tracker. nullptr if the array_ref is not initialized.

◆ get_descriptor()

const array_descriptor & rexlib::array_ref::get_descriptor ( ) const
noexcept

Get the descriptor of this array.

Returns
array_descriptor The descriptor.

◆ get_implementation()

const array_implementation * rexlib::array_ref::get_implementation ( ) const
noexcept

Get a pointer to the implementation.

Returns
const array_implementation* Pointer to the implementation. nullptr if the array_ref is not initialized.
Note
This method is meant to be used internally and for testing purposes, as the array_implementation is not publicly available.

◆ get_storage() [1/2]

const buffer * rexlib::array_ref::get_storage ( ) const
noexcept

Get the storage of this array.

Returns
const buffer* The storage. nullptr if the array_ref is not initialized.

◆ get_storage() [2/2]

buffer * rexlib::array_ref::get_storage ( )
noexcept

Get the storage of this array.

Returns
buffer* The storage. nullptr if the array_ref is not initialized.

◆ share_storage() [1/2]

std::shared_ptr< const buffer > rexlib::array_ref::share_storage ( ) const
noexcept

Get a shared pointer to the storage of this array.

Returns
std::shared_ptr<const buffer> The storage. nullptr if the array_ref is not initialized.

◆ share_storage() [2/2]

std::shared_ptr< buffer > rexlib::array_ref::share_storage ( )
noexcept

Get a shared pointer to the storage of this array.

Returns
std::shared_ptr<buffer> The storage. nullptr if the array_ref is not initialized.

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