PMDK C++ bindings  1.11.1
This is the C++ bindings documentation for PMDK's libpmemobj.
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
pmem::detail::self_relative_ptr_base_impl< OffsetType > Class Template Reference

self_relative_ptr base template class More...

#include <libpmemobj++/detail/self_relative_ptr_base_impl.hpp>

Inheritance diagram for pmem::detail::self_relative_ptr_base_impl< OffsetType >:
pmem::obj::experimental::self_relative_ptr< T > pmem::obj::experimental::self_relative_ptr< list_node_type >

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_imploperator= (self_relative_ptr_base_impl const &r)
 Assignment operator. More...
 
self_relative_ptr_base_imploperator= (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.
 

Detailed Description

template<typename OffsetType>
class pmem::detail::self_relative_ptr_base_impl< OffsetType >

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.

Constructor & Destructor Documentation

◆ self_relative_ptr_base_impl() [1/3]

template<typename OffsetType >
pmem::detail::self_relative_ptr_base_impl< OffsetType >::self_relative_ptr_base_impl ( void *  ptr)
inlinenoexcept

Volatile pointer constructor.

Parameters
ptrvolatile pointer, pointing to persistent memory.

◆ self_relative_ptr_base_impl() [2/3]

template<typename OffsetType >
pmem::detail::self_relative_ptr_base_impl< OffsetType >::self_relative_ptr_base_impl ( self_relative_ptr_base_impl< OffsetType > const &  r)
inlinenoexcept

Copy constructor.

Parameters
rpointer to the same type.

◆ self_relative_ptr_base_impl() [3/3]

template<typename OffsetType >
pmem::detail::self_relative_ptr_base_impl< OffsetType >::self_relative_ptr_base_impl ( difference_type  offset)
inlineprotectednoexcept

Offset constructor.

Parameters
offsetoffset from self.

Member Function Documentation

◆ operator=() [1/2]

template<typename OffsetType >
self_relative_ptr_base_impl& pmem::detail::self_relative_ptr_base_impl< OffsetType >::operator= ( self_relative_ptr_base_impl< OffsetType > const &  r)
inline

Assignment operator.

Self-relative pointer assignment within a transaction automatically registers this operation so that a rollback is possible.

Exceptions
pmem::transaction_errorwhen adding the object to the transaction failed.

◆ operator=() [2/2]

template<typename OffsetType >
self_relative_ptr_base_impl& pmem::detail::self_relative_ptr_base_impl< OffsetType >::operator= ( std::nullptr_t &&  )
inline

Nullptr move assignment operator.

Exceptions
pmem::transaction_errorwhen adding the object to the transaction failed.

◆ swap()

template<typename OffsetType >
void pmem::detail::self_relative_ptr_base_impl< OffsetType >::swap ( self_relative_ptr_base_impl< OffsetType > &  other)
inline

Swaps two self_relative_ptr_base objects of the same type.

Parameters
[in,out]otherthe other self_relative_ptr to swap.

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