|
template<class U > |
using | rebind = pmem::obj::persistent_ptr< U > |
| Rebind to a different type of pointer.
|
|
using | persistency_type = p< T > |
| The persistency type to be used with this pointer.
|
|
using | bool_type = bool |
| The used bool_type.
|
|
using | iterator_category = std::random_access_iterator_tag |
| The persistent_ptr iterator category.
|
|
using | difference_type = std::ptrdiff_t |
| The persistent_ptr difference type.
|
|
using | value_type = T |
| The type of the value pointed to by the persistent_ptr.
|
|
using | reference = T & |
| The reference type of the value pointed to by the persistent_ptr.
|
|
using | pointer = persistent_ptr< T > |
| The pointer type.
|
|
typedef pmem::detail::sp_element< T >::type | element_type |
| Type of an actual object with all qualifier removed, used for easy underlying type access.
|
|
|
| persistent_ptr (persistent_ptr< void > const &rhs) noexcept |
| Explicit void specialization of the converting constructor.
|
|
| persistent_ptr (persistent_ptr< const void > const &rhs) noexcept |
| Explicit const void specialization of the converting constructor.
|
|
| operator persistent_ptr< void > () const noexcept |
| Persistent pointer to void conversion operator.
|
|
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[] (std::ptrdiff_t i) const noexcept |
| Array access operator. 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_ptr_base () |
| Default constructor, zeroes the PMEMoid.
|
|
| persistent_ptr_base (PMEMoid oid) noexcept |
| PMEMoid constructor. More...
|
|
| persistent_ptr_base (element_type *ptr) |
| Volatile pointer constructor. More...
|
|
template<typename U , typename = typename std::enable_if< !std::is_same<T, U>::value && std::is_same<typename std::remove_cv<T>::type, U>::value>::type> |
| persistent_ptr_base (persistent_ptr_base< U > const &r) noexcept |
| Copy constructor from a different persistent_ptr<>. More...
|
|
template<typename U , typename Dummy = void, 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> |
| persistent_ptr_base (persistent_ptr_base< U > const &r) noexcept |
| Copy constructor from a different persistent_ptr<>. More...
|
|
template<typename Y , typename = typename std::enable_if< !std::is_same< typename std::remove_cv<T>::type, typename std::remove_cv<Y>::type>::value && !std::is_void<Y>::value, decltype(static_cast<T *>(std::declval<Y *>()))>::type> |
| operator persistent_ptr_base< Y > () noexcept |
| Conversion operator to a different persistent_ptr<>. More...
|
|
| persistent_ptr_base (persistent_ptr_base &&r) noexcept |
| Defaulted move constructor.
|
|
persistent_ptr_base & | operator= (persistent_ptr_base &&r) |
| Defaulted move assignment operator.
|
|
persistent_ptr_base & | operator= (persistent_ptr_base const &r) |
| Assignment operator. More...
|
|
persistent_ptr_base & | operator= (std::nullptr_t &&) |
| Nullptr move assignment operator. More...
|
|
template<typename Y , typename = typename std::enable_if< std::is_convertible<Y *, T *>::value>::type> |
persistent_ptr_base & | operator= (persistent_ptr_base< Y > const &r) |
| Converting assignment operator from a different persistent_ptr<>. More...
|
|
void | swap (persistent_ptr_base &other) |
| Swaps two persistent_ptr objects of the same type. More...
|
|
element_type * | get () const noexcept |
| Get a direct pointer. 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...
|
|
template<typename T>
class pmem::obj::persistent_ptr< T >
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:
#include <fcntl.h>
using namespace pmem::obj;
void
persistent_ptr_example()
{
struct compound_type {
void
set_some_variable(int val)
{
some_variable = val;
}
int some_variable;
double some_other_variable;
};
struct root {
persistent_ptr<compound_type> comp;
} proot;
proot.comp = make_persistent<compound_type>();
proot.comp->set_some_variable(12);
proot.comp->some_other_variable = 2.3;
});
compound_type tmp = *proot.comp;
(void)tmp;
proot.comp->some_variable = 12;
}
static pool< T > create(const std::string &path, const std::string &layout, std::size_t size=PMEMOBJ_MIN_POOL, mode_t mode=DEFAULT_MODE)
Creates a new transactional object store pool.
Definition: pool.hpp:519
static void exec_tx(pool_base &pool, std::function< void()> tx, Locks &... locks)
Execute a closure-like transaction and lock locks.
Definition: transaction.hpp:393
Persistent_ptr transactional allocation functions for objects.
Persistent smart pointer.
C++ pmemobj transactions.