PMDK C++ bindings  1.13.0-git107.g7e59f08f
This is the C++ bindings documentation for PMDK's libpmemobj.
pmem::obj::persistent_ptr_base Class Reference

Persistent_ptr base (non-template) class. More...

#include <libpmemobj++/persistent_ptr_base.hpp>

Inheritance diagram for pmem::obj::persistent_ptr_base:

Public Member Functions

 persistent_ptr_base () noexcept
 Default constructor, zeroes the PMEMoid.
 
 persistent_ptr_base (PMEMoid oid) noexcept
 PMEMoid constructor. More...
 
 persistent_ptr_base (persistent_ptr_base const &r) noexcept
 
 persistent_ptr_base (persistent_ptr_base &&r) noexcept
 Move constructor.
 
persistent_ptr_baseoperator= (persistent_ptr_base &&r)
 Move assignment operator.
 
persistent_ptr_baseoperator= (persistent_ptr_base const &r)
 Assignment operator. More...
 
persistent_ptr_baseoperator= (std::nullptr_t &&)
 Nullptr move assignment operator. More...
 
void swap (persistent_ptr_base &other)
 Swaps two persistent_ptr objects of the same type. More...
 
const PMEMoid & raw () const noexcept
 Get PMEMoid encapsulated by this object. More...
 
PMEMoid * raw_ptr () noexcept
 Get pointer to PMEMoid encapsulated by this object. More...
 

Protected Attributes

PMEMoid oid
 

Detailed Description

Persistent_ptr base (non-template) class.

Implements some of the functionality of the persistent_ptr class. It defines all applicable conversions from and to a persistent_ptr_base.

It can be used e.g. as a parameter, where persistent_ptr of any template type is required. It is similar to persistent_ptr<void> (it can point to whatever type), but it can be used when you want to have pointer to some unspecified persistent_ptr (with persistent_ptr<void> it can't be done, because: persistent_ptr<T>* does not convert to persistent_ptr<void>*).

Constructor & Destructor Documentation

◆ persistent_ptr_base()

pmem::obj::persistent_ptr_base::persistent_ptr_base ( PMEMoid  oid)
inlinenoexcept

PMEMoid constructor.

Provided for easy interoperability between C++ and C API's.

Parameters
oidC-style persistent pointer

Member Function Documentation

◆ operator=() [1/2]

persistent_ptr_base& pmem::obj::persistent_ptr_base::operator= ( persistent_ptr_base const &  r)
inline

Assignment operator.

Persistent 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]

persistent_ptr_base& pmem::obj::persistent_ptr_base::operator= ( std::nullptr_t &&  )
inline

Nullptr move assignment operator.

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

◆ raw()

const PMEMoid& pmem::obj::persistent_ptr_base::raw ( ) const
inlinenoexcept

Get PMEMoid encapsulated by this object.

For C API compatibility.

Returns
const reference to the PMEMoid

◆ raw_ptr()

PMEMoid* pmem::obj::persistent_ptr_base::raw_ptr ( )
inlinenoexcept

Get pointer to PMEMoid encapsulated by this object.

For C API compatibility.

Returns
pointer to the PMEMoid

◆ swap()

void pmem::obj::persistent_ptr_base::swap ( persistent_ptr_base other)
inline

Swaps two persistent_ptr objects of the same type.

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

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