PMDK C++ bindings
1.13.0-git23.gf49772ac
This is the C++ bindings documentation for PMDK's libpmemobj.
|
self_relative_ptr base template class More...
#include <libpmemobj++/detail/self_relative_ptr_base_impl.hpp>
Public Member Functions | |
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*. | |
Static Public Member Functions | |
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. | |
Protected Member Functions | |
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. | |
self_relative_ptr base template class
Implements some of the functionality of the self_relative_ptr class. It defines all applicable conversions from and to a self_relative_ptr_base.
It can be used e.g. as a parameter, where self_relative_ptr of any template type is required. It is similar to self_relative_ptr<void> (it can point to whatever type), but it can be used when you want to have pointer to some unspecified self_relative_ptr (with self_relative_ptr<void> it can't be done, because: self_relative_ptr<T>* does not convert to self_relative_ptr<void>*).
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.
|
inlinenoexcept |
Volatile pointer constructor.
ptr | volatile pointer, pointing to persistent memory. |
|
inlinenoexcept |
Copy constructor.
r | pointer to the same type. |
|
inlineprotectednoexcept |
Offset constructor.
offset | offset from self. |
|
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 |
Nullptr move assignment operator.
pmem::transaction_error | when adding the object to the transaction failed. |
|
inline |
Swaps two self_relative_ptr_base objects of the same type.
[in,out] | other | the other self_relative_ptr to swap. |