NVML C++ bindings
0.1 experimental
This is the C++ bindings documentation for NVML's libpmemobj.
|
Persistent pointer class. More...
#include <libpmemobj++/persistent_ptr.hpp>
Public Types | |
typedef nvml::detail::sp_element< T >::type | element_type |
Type of an actual object with all qualifier removed, used for easy underlying type access. | |
Public Member Functions | |
persistent_ptr () | |
Default constructor, zeroes the PMEMoid. | |
persistent_ptr (std::nullptr_t) noexcept | |
Default null constructor, zeroes the PMEMoid. | |
persistent_ptr (PMEMoid oid) noexcept | |
PMEMoid constructor. More... | |
template<typename Y , typename = typename std::enable_if< std::is_convertible<Y *, T *>::value>::type> | |
persistent_ptr (const persistent_ptr< Y > &r) noexcept | |
Copy constructor from a different persistent_ptr<>. More... | |
persistent_ptr (persistent_ptr &&r) noexcept | |
Defaulted move constructor. | |
persistent_ptr & | operator= (persistent_ptr &&r) |
Defaulted move assignment operator. | |
persistent_ptr & | operator= (const persistent_ptr &r) |
Assignment operator. More... | |
template<typename Y , typename = typename std::enable_if< std::is_convertible<Y *, T *>::value>::type> | |
persistent_ptr & | operator= (const persistent_ptr< Y > &r) |
Converting assignment operator from a different persistent_ptr<>. More... | |
nvml::detail::sp_dereference< T >::type | operator* () const noexcept |
Dereference operator. | |
nvml::detail::sp_member_access< T >::type | operator-> () const noexcept |
Member access operator. | |
nvml::detail::sp_array_access< T >::type | operator[] (std::ptrdiff_t i) const noexcept |
Array access operator. More... | |
element_type * | get () const noexcept |
Get a direct pointer. More... | |
void | swap (persistent_ptr &other) noexcept |
Swaps two persistent_ptr objects of the same type. | |
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... | |
persistent_ptr< T > & | operator++ () |
Prefix increment operator. | |
persistent_ptr< T > | operator++ (int) |
Postfix increment operator. | |
persistent_ptr< T > & | operator-- () |
Prefix decrement operator. | |
persistent_ptr< T > | operator-- (int) |
Postfix decrement operator. | |
persistent_ptr< T > & | operator+= (std::ptrdiff_t s) |
Addition assignment operator. | |
persistent_ptr< T > & | operator-= (std::ptrdiff_t s) |
Subtraction assignment operator. | |
void | persist (pool_base &pop) |
Persists the content of the underlying object. More... | |
void | persist (void) |
Persists what the persistent pointer points to. More... | |
void | flush (pool_base &pop) |
Flushes what the persistent pointer points to. More... | |
void | flush (void) |
Flushes what the persistent pointer points to. More... | |
Persistent pointer class.
persistent_ptr implements a smart ptr. It encapsulates the PMEMoid fat pointer and provides member access, dereference and array access operators. The persistent_ptr is not designed to work with polymorphic types, as they have runtime RTTI info embedded, which is implementation specific and thus not consistently rebuildable. Such constructs as polymorphic members or members of a union defined within a class held in a persistent_ptr will also yield undefined behavior. This type does NOT manage the life-cycle of the object. The typical usage example would be:
|
inlinenoexcept |
PMEMoid constructor.
Provided for easy interoperability between C++ and C API's.
oid | C-style persistent pointer |
|
inlinenoexcept |
Copy constructor from a different persistent_ptr<>.
Available only for convertible types.
|
inline |
Flushes what the persistent pointer points to.
[in] | pop | Pmemobj pool |
|
inline |
Flushes what the persistent pointer points to.
pool_error | when cannot get pool from persistent pointer |
|
inlinenoexcept |
Get a direct pointer.
Performs a calculations on the underlying C-style pointer.
|
inline |
Assignment operator.
Persistent pointer assignment within a transaction automatically registers this operation so that a rollback is possible.
nvml::transaction_error | when adding the object to the transaction failed. |
|
inline |
Converting assignment operator from a different persistent_ptr<>.
Available only for convertible types. Just like regular assignment, also automatically registers itself in a transaction.
nvml::transaction_error | when adding the object to the transaction failed. |
|
inlinenoexcept |
Array access operator.
Contains run-time bounds checking for static arrays.
|
inline |
Persists the content of the underlying object.
[in] | pop | Pmemobj pool |
|
inline |
Persists what the persistent pointer points to.
pool_error | when cannot get pool from persistent pointer |
|
inlinenoexcept |
Get PMEMoid encapsulated by this object.
For C API compatibility.
|
inlinenoexcept |
Get pointer to PMEMoid encapsulated by this object.
For C API compatibility.