PMDK C++ bindings
1.11
This is the C++ bindings documentation for PMDK's libpmemobj.
|
Persistent self-relative pointer class. More...
#include <libpmemobj++/experimental/self_relative_ptr.hpp>
Public Types | |
using | iterator_category = std::random_access_iterator_tag |
Random access iterator requirements (members) More... | |
using | difference_type = typename base_type::difference_type |
The self_relative_ptr difference type. | |
using | value_type = T |
The type of the value pointed to by the self_relative_ptr. | |
using | reference = T & |
The reference type of the value pointed to by the self_relative_ptr. | |
Public Member Functions | |
constexpr | self_relative_ptr () noexcept=default |
Default constructor, equal the nullptr. | |
constexpr | self_relative_ptr (std::nullptr_t) noexcept |
Nullptr constructor. | |
self_relative_ptr (element_type *ptr) noexcept | |
Volatile pointer constructor. More... | |
self_relative_ptr (persistent_ptr< T > ptr) noexcept | |
Constructor from persistent_ptr<T> | |
self_relative_ptr (PMEMoid oid) noexcept | |
PMEMoid constructor. More... | |
self_relative_ptr (const self_relative_ptr &ptr) noexcept | |
Copy constructor. | |
template<typename U , typename = typename std::enable_if< !std::is_same< typename std::remove_cv<T>::type, typename std::remove_cv<U>::type>::value && !std::is_void<U>::value, decltype(static_cast<T *>(std::declval<U *>()))>::type> | |
self_relative_ptr (self_relative_ptr< U > const &r) noexcept | |
Copy constructor from a different self_relative_ptr<>. More... | |
element_type * | get () const noexcept |
Get the direct pointer. More... | |
persistent_ptr< T > | to_persistent_ptr () const |
Conversion to persitent ptr. | |
operator bool () const noexcept | |
Bool conversion operator. | |
operator persistent_ptr< T > () const | |
Conversion operator to persistent_ptr. | |
pmem::detail::sp_dereference< T >::type | operator* () const noexcept |
Dereference operator. | |
pmem::detail::sp_member_access< T >::type | operator-> () const noexcept |
Member access operator. | |
template<typename = typename std::enable_if<!std::is_void<T>::value>> | |
pmem::detail::sp_array_access< T >::type | operator[] (difference_type i) const noexcept |
Array access operator. More... | |
self_relative_ptr & | operator= (const self_relative_ptr &r) |
Assignment operator. More... | |
template<typename Y , typename = typename std::enable_if< std::is_convertible<Y *, T *>::value>::type> | |
self_relative_ptr< T > & | operator= (self_relative_ptr< Y > const &r) |
Converting assignment operator from a different self_relative_ptr<>. More... | |
self_relative_ptr & | operator= (std::nullptr_t) |
Nullptr move assignment operator. More... | |
self_relative_ptr< T > & | operator++ () |
Prefix increment operator. | |
self_relative_ptr< T > | operator++ (int) |
Postfix increment operator. | |
self_relative_ptr< T > & | operator-- () |
Prefix decrement operator. | |
self_relative_ptr< T > | operator-- (int) |
Postfix decrement operator. | |
self_relative_ptr< T > & | operator+= (std::ptrdiff_t s) |
Addition assignment operator. | |
self_relative_ptr< T > & | operator-= (std::ptrdiff_t s) |
Subtraction assignment operator. | |
Public Member Functions inherited from pmem::detail::self_relative_ptr_base_impl< OffsetType > | |
constexpr | self_relative_ptr_base_impl () noexcept |
Default constructor, equal the nullptr. | |
constexpr | self_relative_ptr_base_impl (std::nullptr_t) noexcept |
Nullptr constructor. | |
self_relative_ptr_base_impl (void *ptr) noexcept | |
Volatile pointer constructor. More... | |
self_relative_ptr_base_impl (self_relative_ptr_base_impl const &r) noexcept | |
Copy constructor. More... | |
self_relative_ptr_base_impl & | operator= (self_relative_ptr_base_impl const &r) |
Assignment operator. More... | |
self_relative_ptr_base_impl & | operator= (std::nullptr_t &&) |
Nullptr move assignment operator. More... | |
void | swap (self_relative_ptr_base_impl &other) |
Swaps two self_relative_ptr_base objects of the same type. More... | |
byte_ptr_type | to_byte_pointer () const noexcept |
Conversion to byte pointer. | |
void * | to_void_pointer () const noexcept |
Conversion to void*. | |
operator void * () const noexcept | |
Explicit conversion operator to void*. | |
operator byte_ptr_type () const noexcept | |
Explicit conversion operator to byte pointer. | |
bool | is_null () const noexcept |
Fast null checking without conversion to void*. | |
Protected Member Functions | |
void | verify_type () |
Verify if element_type is not polymorphic. | |
Protected Member Functions inherited from pmem::detail::self_relative_ptr_base_impl< OffsetType > | |
self_relative_ptr_base_impl (difference_type offset) noexcept | |
Offset constructor. More... | |
void * | offset_to_pointer (difference_type other_offset) const noexcept |
Conversion to void* use other offset. | |
difference_type | pointer_to_offset (const self_relative_ptr_base_impl &ptr) const noexcept |
Conversion self_relative_ptr_base to offset from itself. | |
difference_type | pointer_to_offset (void *ptr) const noexcept |
Conversion pointer to offset. | |
Additional Inherited Members | |
Static Public Member Functions inherited from pmem::detail::self_relative_ptr_base_impl< OffsetType > | |
static difference_type | distance_between (const self_relative_ptr_base_impl &first, const self_relative_ptr_base_impl &second) |
Byte distance between two relative pointers. | |
Persistent self-relative pointer class.
self_relative_ptr implements a smart ptr. It encapsulates the self offseted pointer and provides member access, dereference and array access operators.
Template parameter type has following requirements:
Casting to self_relative_ptr_base can be easily done from any self_relative_ptr<T> objects, but when casting between convertible objects be advised to use constructors or operator= specified for such conversion, see:
The current version uses an approach where we store offset=real_offset-1 and zero offset (or real_offset equal one) is a null pointer. This is needed to support zero initialization.
using pmem::obj::experimental::self_relative_ptr< T >::iterator_category = std::random_access_iterator_tag |
Random access iterator requirements (members)
The self_relative_ptr iterator category.
|
inlinenoexcept |
Volatile pointer constructor.
ptr | volatile pointer, pointing to persistent memory. |
|
inlinenoexcept |
PMEMoid constructor.
Provided for easy interoperability between C++ and C API's.
oid | C-style persistent pointer |
|
inlinenoexcept |
Copy constructor from a different self_relative_ptr<>.
Available only for convertible, non-void types.
|
inlinenoexcept |
Get the direct pointer.
|
inline |
Assignment operator.
self-relative pointer assignment within a transaction automatically registers this operation so that a rollback is possible.
pmem::transaction_error | when adding the object to the transaction failed. |
|
inline |
Converting assignment operator from a different self_relative_ptr<>.
Available only for convertible types. Just like regular assignment, also automatically registers itself in a transaction.
pmem::transaction_error | when adding the object to the transaction failed. |
|
inline |
Nullptr move assignment operator.
pmem::transaction_error | when adding the object to the transaction failed. |
|
inlinenoexcept |
Array access operator.
Contains run-time bounds checking for static arrays.