|
TRIQS/nda 2.0.0
Multi-dimensional array library for C++
|
#include <nda/mem/handle.hpp>
A handle for a memory block on the heap with shared ownership.
| T | Value type of the data. |
| AdrSp | nda::mem::AddressSpace in which the memory is allocated. |
Definition at line 741 of file handle.hpp.
Public Types | |
| using | value_type = T |
| Value type of the data. | |
Public Member Functions | |
| handle_shared ()=default | |
| Default constructor leaves the handle in a null state (nullptr and size 0). | |
| template<Allocator A> requires (A::address_space == address_space) | |
| handle_shared (handle_heap< T, A > const &h) noexcept | |
| Construct a shared handle from an nda::mem::handle_heap. | |
| handle_shared (T *data, size_t size, void *foreign_handle, void(*foreign_decref)(void *)) noexcept | |
| Construct a handle from a shared object from a foreign library. | |
| T * | data () const noexcept |
| Get a pointer to the stored data. | |
| bool | is_null () const noexcept |
| Check if the handle is in a null state. | |
| T const & | operator[] (long i) const noexcept |
| Subscript operator to access the data. | |
| T & | operator[] (long i) noexcept |
| Subscript operator to access the data. | |
| long | refcount () const noexcept |
| Get the reference count of the shared object. | |
| long | size () const noexcept |
| Get the size of the handle. | |
Static Public Attributes | |
| static constexpr auto | address_space = AdrSp |
| nda::mem::AddressSpace in which the memory is allocated. | |
|
inlinenoexcept |
Construct a handle from a shared object from a foreign library.
| data | Pointer to the start of the shared data. |
| size | Size of the data (number of elements). |
| foreign_handle | Pointer to the shared object. |
| foreign_decref | Function to decrease the reference count of the shared object. |
Definition at line 775 of file handle.hpp.
|
inlinenoexcept |
Construct a shared handle from an nda::mem::handle_heap.
| A | nda::mem::Allocator type of the source handle. |
| h | Source handle. |
Definition at line 785 of file handle.hpp.
|
inlinenodiscardnoexcept |
Get a pointer to the stored data.
Definition at line 829 of file handle.hpp.
|
inlinenodiscardnoexcept |
Check if the handle is in a null state.
Definition at line 811 of file handle.hpp.
|
inlinenodiscardnoexcept |
Subscript operator to access the data.
| i | Index of the element to access. |
Definition at line 805 of file handle.hpp.
|
inlinenodiscardnoexcept |
Subscript operator to access the data.
| i | Index of the element to access. |
Definition at line 797 of file handle.hpp.
|
inlinenodiscardnoexcept |
Get the reference count of the shared object.
Definition at line 823 of file handle.hpp.
|
inlinenodiscardnoexcept |
Get the size of the handle.
Definition at line 835 of file handle.hpp.