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

Main libpmemobj namespace. More...

Namespaces

 experimental
 Experimental implementations.
 
 segment_vector_internal
 Internal implementation of pmem's segment vector.
 

Classes

struct  allocation_flag
 Type of flag which can be passed to make_persistent. More...
 
struct  allocation_flag_atomic
 Type of flag which can be passed to make_persistent_atomic. More...
 
class  object_traits
 Encapsulates object specific allocator functionality. More...
 
class  object_traits< void >
 Object traits specialization for the void type. More...
 
class  standard_alloc_policy
 The allocation policy template for a given type. More...
 
class  standard_alloc_policy< void >
 Void specialization of the standard allocation policy. More...
 
class  allocator
 (EXPERIMENTAL) Encapsulates the information about the persistent memory allocation model using PMDK's libpmemobj. More...
 
class  condition_variable
 Persistent memory resident condition variable. More...
 
struct  array
 Persistent container with std::array compatible interface. More...
 
class  basic_string
 Persistent string container with std::basic_string compatible interface. More...
 
class  concurrent_hash_map
 Persistent memory aware implementation of Intel TBB concurrent_hash_map More...
 
class  segment_vector
 Persistent version of segment vector with std::vector compatible interface. More...
 
class  vector
 Persistent container with std::vector compatible interface. More...
 
class  defrag
 Defrag class. More...
 
class  persistent_ptr
 Persistent pointer class. More...
 
class  mutex
 Persistent memory resident mutex implementation. More...
 
class  p
 Resides on pmem class. More...
 
class  pool
 PMEMobj pool class. More...
 
class  persistent_ptr< void >
 persistent_ptr void specialization. More...
 
class  persistent_ptr< const void >
 persistent_ptr const void specialization. More...
 
class  persistent_ptr_base
 Persistent_ptr base (non-template) class. More...
 
class  pool_base
 The non-template pool base class. More...
 
class  shared_mutex
 Persistent memory resident shared_mutex implementation. More...
 
class  slice
 Provides interface to access sequence of objects. More...
 
class  basic_string_view
 Our partial std::string_view implementation. More...
 
class  timed_mutex
 Persistent memory resident timed_mutex implementation. More...
 
class  basic_transaction
 C++ transaction handler class. More...
 
class  flat_transaction
 C++ flat transaction handler class. More...
 

Typedefs

template<template< typename > class SegmentType = pmem::obj::vector>
using exponential_size_array_policy = segment_vector_internal::exponential_size_policy< segment_vector_internal::array_64, SegmentType >
 Exponential size policy with pmemobj array of size 64 as a type of segment vector, so this is a static array of segments and each segment is of SegmentType. More...
 
template<size_t SegmentSize = 1024, template< typename > class SegmentType = pmem::obj::vector>
using fixed_size_vector_policy = segment_vector_internal::fixed_size_policy< pmem::obj::vector, SegmentType, SegmentSize >
 Fixed size policy with pmemobj vector of a given size as a type of segment vector, so this is a dynamic vector of segments and each segment is of SegmentType. More...
 
template<template< typename > class SegmentType = pmem::obj::vector>
using exponential_size_vector_policy = segment_vector_internal::exponential_size_policy< pmem::obj::vector, SegmentType >
 Exponential size policy with pmemobj vector as a type of segment vector, so this is a dynamic vector of segments and each segment is of SegmentType. More...
 
using string = basic_string< char >
 The most typical string usage - the char specialization.
 
using wstring = basic_string< wchar_t >
 The wide char specialization.
 
using u16string = basic_string< char16_t >
 The char16 specialization.
 
using u32string = basic_string< char32_t >
 The char32 specialization.
 
using string_view = basic_string_view< char >
 The most typical string_view usage - the char specialization.
 
using wstring_view = basic_string_view< wchar_t >
 The wide char specialization.
 
using u16string_view = basic_string_view< char16_t >
 The char16 specialization.
 
using u32string_view = basic_string_view< char32_t >
 The char32 specialization.
 
using transaction = basic_transaction
 By default, pmem::obj::transaction is an alias to pmem::obj::basic_transaction. More...
 

Functions

template<typename Key , typename T , typename Hash , typename KeyEqual , typename MutexType , typename ScopedLockType >
bool operator== (const concurrent_hash_map< Key, T, Hash, KeyEqual, MutexType, ScopedLockType > &a, const concurrent_hash_map< Key, T, Hash, KeyEqual, MutexType, ScopedLockType > &b)
 
template<typename Key , typename T , typename Hash , typename KeyEqual , typename MutexType , typename ScopedLockType >
bool operator!= (const concurrent_hash_map< Key, T, Hash, KeyEqual, MutexType, ScopedLockType > &a, const concurrent_hash_map< Key, T, Hash, KeyEqual, MutexType, ScopedLockType > &b)
 
template<typename Key , typename T , typename Hash , typename KeyEqual , typename MutexType , typename ScopedLockType >
void swap (concurrent_hash_map< Key, T, Hash, KeyEqual, MutexType, ScopedLockType > &a, concurrent_hash_map< Key, T, Hash, KeyEqual, MutexType, ScopedLockType > &b)
 
template<typename T , typename Policy >
void swap (segment_vector< T, Policy > &lhs, segment_vector< T, Policy > &rhs)
 
template<typename T , typename Policy >
bool operator== (const segment_vector< T, Policy > &lhs, const segment_vector< T, Policy > &rhs)
 
template<typename T , typename Policy >
bool operator!= (const segment_vector< T, Policy > &lhs, const segment_vector< T, Policy > &rhs)
 
template<typename T , typename Policy >
bool operator< (const segment_vector< T, Policy > &lhs, const segment_vector< T, Policy > &rhs)
 
template<typename T , typename Policy >
bool operator<= (const segment_vector< T, Policy > &lhs, const segment_vector< T, Policy > &rhs)
 
template<typename T , typename Policy >
bool operator> (const segment_vector< T, Policy > &lhs, const segment_vector< T, Policy > &rhs)
 
template<typename T , typename Policy >
bool operator>= (const segment_vector< T, Policy > &lhs, const segment_vector< T, Policy > &rhs)
 
template<typename T , typename Policy >
bool operator== (const segment_vector< T, Policy > &lhs, const std::vector< T > &rhs)
 
template<typename T , typename Policy >
bool operator!= (const segment_vector< T, Policy > &lhs, const std::vector< T > &rhs)
 
template<typename T , typename Policy >
bool operator< (const segment_vector< T, Policy > &lhs, const std::vector< T > &rhs)
 
template<typename T , typename Policy >
bool operator<= (const segment_vector< T, Policy > &lhs, const std::vector< T > &rhs)
 
template<typename T , typename Policy >
bool operator> (const segment_vector< T, Policy > &lhs, const std::vector< T > &rhs)
 
template<typename T , typename Policy >
bool operator>= (const segment_vector< T, Policy > &lhs, const std::vector< T > &rhs)
 
template<typename T , typename Policy >
bool operator== (const std::vector< T > &lhs, const segment_vector< T, Policy > &rhs)
 
template<typename T , typename Policy >
bool operator!= (const std::vector< T > &lhs, const segment_vector< T, Policy > &rhs)
 
template<typename T , typename Policy >
bool operator< (const std::vector< T > &lhs, const segment_vector< T, Policy > &rhs)
 
template<typename T , typename Policy >
bool operator<= (const std::vector< T > &lhs, const segment_vector< T, Policy > &rhs)
 
template<typename T , typename Policy >
bool operator> (const std::vector< T > &lhs, const segment_vector< T, Policy > &rhs)
 
template<typename T , typename Policy >
bool operator>= (const std::vector< T > &lhs, const segment_vector< T, Policy > &rhs)
 
template<typename T >
void swap (vector< T > &lhs, vector< T > &rhs)
 
template<typename T >
bool operator== (const vector< T > &lhs, const vector< T > &rhs)
 
template<typename T >
bool operator!= (const vector< T > &lhs, const vector< T > &rhs)
 
template<typename T >
bool operator< (const vector< T > &lhs, const vector< T > &rhs)
 
template<typename T >
bool operator<= (const vector< T > &lhs, const vector< T > &rhs)
 
template<typename T >
bool operator> (const vector< T > &lhs, const vector< T > &rhs)
 
template<typename T >
bool operator>= (const vector< T > &lhs, const vector< T > &rhs)
 
template<typename T >
bool operator== (const vector< T > &lhs, const std::vector< T > &rhs)
 
template<typename T >
bool operator!= (const vector< T > &lhs, const std::vector< T > &rhs)
 
template<typename T >
bool operator< (const vector< T > &lhs, const std::vector< T > &rhs)
 
template<typename T >
bool operator<= (const vector< T > &lhs, const std::vector< T > &rhs)
 
template<typename T >
bool operator> (const vector< T > &lhs, const std::vector< T > &rhs)
 
template<typename T >
bool operator>= (const vector< T > &lhs, const std::vector< T > &rhs)
 
template<typename T >
bool operator== (const std::vector< T > &lhs, const vector< T > &rhs)
 
template<typename T >
bool operator!= (const std::vector< T > &lhs, const vector< T > &rhs)
 
template<typename T >
bool operator< (const std::vector< T > &lhs, const vector< T > &rhs)
 
template<typename T >
bool operator<= (const std::vector< T > &lhs, const vector< T > &rhs)
 
template<typename T >
bool operator> (const std::vector< T > &lhs, const vector< T > &rhs)
 
template<typename T >
bool operator>= (const std::vector< T > &lhs, const vector< T > &rhs)
 
template<typename T >
static constexpr std::enable_if< detail::t_is_defragmentable< T >::value, bool >::type is_defragmentable () noexcept
 Checks if provided T type is defragmentable. More...
 
template<typename T >
static constexpr std::enable_if<!detail::t_is_defragmentable< T >::value, bool >::type is_defragmentable () noexcept
 Checks if provided T type is defragmentable. More...
 
template<typename T >
ctl_get_detail (PMEMobjpool *pool, const std::string &name)
 
template<typename T >
ctl_set_detail (PMEMobjpool *pool, const std::string &name, T arg)
 
template<typename T >
ctl_exec_detail (PMEMobjpool *pool, const std::string &name, T arg)
 
template<typename T >
ctl_get_detail (PMEMobjpool *pool, const std::wstring &name)
 
template<typename T >
ctl_set_detail (PMEMobjpool *pool, const std::wstring &name, T arg)
 
template<typename T >
ctl_exec_detail (PMEMobjpool *pool, const std::wstring &name, T arg)
 
template<typename T , typename... Args>
detail::pp_if_not_array< T >::type make_persistent (allocation_flag flag, Args &&... args)
 Transactionally allocate and construct an object of type T. More...
 
template<typename T , typename... Args>
std::enable_if< !detail::is_first_arg_same< allocation_flag, Args... >::value, typename detail::pp_if_not_array< T >::type >::type make_persistent (Args &&... args)
 Transactionally allocate and construct an object of type T. More...
 
template<typename T >
void delete_persistent (typename detail::pp_if_not_array< T >::type ptr)
 Transactionally free an object of type T held in a persistent_ptr. More...
 
template<typename T >
detail::pp_if_array< T >::type make_persistent (std::size_t N, allocation_flag flag=allocation_flag::none())
 Transactionally allocate and construct an array of objects of type T. More...
 
template<typename T >
detail::pp_if_size_array< T >::type make_persistent (allocation_flag flag=allocation_flag::none())
 Transactionally allocate and construct an array of objects of type T. More...
 
template<typename T >
void delete_persistent (typename detail::pp_if_array< T >::type ptr, std::size_t N)
 Transactionally free an array of objects of type T held in a persistent_ptr. More...
 
template<typename T >
void delete_persistent (typename detail::pp_if_size_array< T >::type ptr)
 Transactionally free an array of objects of type T held in a persistent_ptr. More...
 
template<typename T >
void make_persistent_atomic (pool_base &pool, typename detail::pp_if_array< T >::type &ptr, std::size_t N, allocation_flag_atomic flag=allocation_flag_atomic::none())
 Atomically allocate an array of objects. More...
 
template<typename T >
void make_persistent_atomic (pool_base &pool, typename detail::pp_if_size_array< T >::type &ptr, allocation_flag_atomic flag=allocation_flag_atomic::none())
 Atomically allocate an array of objects. More...
 
template<typename T >
void delete_persistent_atomic (typename detail::pp_if_array< T >::type &ptr, std::size_t)
 Atomically deallocate an array of objects. More...
 
template<typename T >
void delete_persistent_atomic (typename detail::pp_if_size_array< T >::type &ptr)
 Atomically deallocate an array of objects. More...
 
template<typename T , typename... Args>
void make_persistent_atomic (pool_base &pool, typename detail::pp_if_not_array< T >::type &ptr, allocation_flag_atomic flag, Args &&... args)
 Atomically allocate and construct an object. More...
 
template<typename T , typename... Args>
std::enable_if<!detail::is_first_arg_same< allocation_flag_atomic, Args... >::value >::type make_persistent_atomic (pool_base &pool, typename detail::pp_if_not_array< T >::type &ptr, Args &&... args)
 Atomically allocate and construct an object. More...
 
template<typename T >
void delete_persistent_atomic (typename detail::pp_if_not_array< T >::type &ptr) noexcept
 Atomically deallocate an object. More...
 
template<typename T >
ctl_get (const std::string &name)
 Query libpmemobj state at global scope. More...
 
template<typename T >
ctl_set (const std::string &name, T arg)
 Modify libpmemobj state at global scope. More...
 
template<typename T >
ctl_exec (const std::string &name, T arg)
 Execute function at global scope. More...
 
template<typename T >
ctl_get (const std::wstring &name)
 Query libpmemobj state at global scope. More...
 
template<typename T >
ctl_set (const std::wstring &name, T arg)
 Modify libpmemobj state at global scope. More...
 
template<typename T >
ctl_exec (const std::wstring &name, T arg)
 Execute function at global scope. More...
 
template<typename T >
pool_base pool_by_vptr (const T *that)
 Retrieve pool handle for the given pointer. More...
 
template<typename T >
pool_base pool_by_pptr (const persistent_ptr< T > ptr)
 Retrieve pool handle for the given persistent_ptr. More...
 

Detailed Description

Main libpmemobj namespace.

It contains all libpmemobj's public types, enums, classes with their functions and members. It is located within pmem namespace.

Typedef Documentation

◆ exponential_size_array_policy

template<template< typename > class SegmentType = pmem::obj::vector>
using pmem::obj::exponential_size_array_policy = typedef segment_vector_internal::exponential_size_policy< segment_vector_internal::array_64, SegmentType>

Exponential size policy with pmemobj array of size 64 as a type of segment vector, so this is a static array of segments and each segment is of SegmentType.

  • requires more memory than exponential_size_vector_policy
  • is faster and more efficient than exponential_size_vector_policy

◆ exponential_size_vector_policy

template<template< typename > class SegmentType = pmem::obj::vector>
using pmem::obj::exponential_size_vector_policy = typedef segment_vector_internal::exponential_size_policy<pmem::obj::vector, SegmentType>

Exponential size policy with pmemobj vector as a type of segment vector, so this is a dynamic vector of segments and each segment is of SegmentType.

  • requires less memory than exponential_size_array_policy
  • is slower and less efficient than exponential_size_array_policy

◆ fixed_size_vector_policy

template<size_t SegmentSize = 1024, template< typename > class SegmentType = pmem::obj::vector>
using pmem::obj::fixed_size_vector_policy = typedef segment_vector_internal::fixed_size_policy<pmem::obj::vector, SegmentType, SegmentSize>

Fixed size policy with pmemobj vector of a given size as a type of segment vector, so this is a dynamic vector of segments and each segment is of SegmentType.

  • is slower than the exponential one (because it has more segments)
  • causes less fragmentation than the exponential one

◆ transaction

By default, pmem::obj::transaction is an alias to pmem::obj::basic_transaction.

To change it to pmem::obj::flat_transaction define LIBPMEMOBJ_CPP_USE_FLAT_TRANSACTION macro.

To see what is the difference between the two please look at the examples for flat tx:

using namespace pmem::obj;
void
tx_flat_example()
{
/* pool root structure */
struct root {
p<int> count;
};
/* create a pmemobj pool */
auto pop = pool<root>::create("poolfile", "layout", PMEMOBJ_MIN_POOL);
auto proot = pop.root();
try {
proot->count++;
try {
proot->count++;
throw std::runtime_error("some error");
});
} catch (...) {
/* Transaction is not aborted yet (unlike for
* basic_transaction). */
assert(pmemobj_tx_stage() == TX_STAGE_WORK);
assert(proot->count == 2);
throw;
}
});
/* An internal transaction error occurred, outer tx aborted just
* now. Reacquire locks if necessary. */
assert(proot->count == 0);
} catch (...) {
/* Some other exception thrown, outer tx aborted just now.
* Reacquire locks if necessary. */
assert(proot->count == 0);
}
}
static void run(obj::pool_base &pool, std::function< void()> tx, Locks &... locks)
Execute a closure-like transaction and lock locks.
Definition: transaction.hpp:810
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:694
Custom transaction error class.
Definition: pexceptions.hpp:109
persistent_ptr transactional allocation functions for objects.
Main libpmemobj namespace.
Definition: allocation_flag.hpp:18
Persistent smart pointer.
Convenience extensions for the resides on pmem property template.
C++ pmemobj pool.
C++ pmemobj transactions.
using namespace pmem::obj;
template <typename T>
struct simple_ptr {
simple_ptr()
{
assert(pmemobj_tx_stage() == TX_STAGE_WORK);
ptr = make_persistent<T>();
}
~simple_ptr()
{
assert(pmemobj_tx_stage() == TX_STAGE_WORK);
try {
delete_persistent<T>(ptr);
std::cerr << e.what() << std::endl;
std::terminate();
std::cerr << e.what() << std::endl;
std::terminate();
}
}
persistent_ptr<T> ptr;
};
struct A {
A() : ptr1(), ptr2()
{
}
simple_ptr<int> ptr1;
simple_ptr<char[(1ULL << 30)]> ptr2;
};
struct B {
B() : ptr1(), ptr2()
{
auto pop = pool_base(pmemobj_pool_by_ptr(this));
// It would result in a crash!
// basic_transaction::run(pop, [&]{ throw
// std::runtime_error("Error"); });
pop, [&] { throw std::runtime_error("Error"); });
}
simple_ptr<int> ptr1;
simple_ptr<int> ptr2;
};
void
tx_nested_struct_example()
{
/* pool root structure */
struct root {
persistent_ptr<A> ptrA;
persistent_ptr<B> ptrB;
};
/* create a pmemobj pool */
auto pop = pool<root>::create("poolfile", "layout", PMEMOBJ_MIN_POOL);
auto proot = pop.root();
auto create_a = [&] { proot->ptrA = make_persistent<A>(); };
auto create_b = [&] { proot->ptrB = make_persistent<B>(); };
try {
// It would result in a crash!
// basic_transaction::run(pop, create_a);
flat_transaction::run(pop, create_a);
/* To see why flat_transaction is necessary let's
* consider what happens when calling A ctor. The call stack
* will look like this:
*
* | ptr2 ctor |
* |-----------|
* | ptr1 ctor |
* |-----------|
* | A ctor |
*
* Since ptr2 is a pointer to some huge array of elements,
* calling ptr2 ctor will most likely result in make_persistent
* throwing an exception (due to out of memory). This exception
* will, in turn, cause stack unwinding - already constructed
* elements must be destroyed (in this example ptr1 destructor
* will be called).
*
* If we'd use basic_transaction the allocation failure, apart
* from throwing an exception, would also cause the transaction
* to abort (by default, in basic_transaction, all transactional
* functions failures cause tx abort). This is problematic since
* the ptr1 destructor, which is called during stack unwinding,
* expects the transaction to be in WORK stage (and the actual
* stage is ABORTED). As a result the application will fail on
* assert (and probably crash in NDEBUG mode).
*
* Now, consider what will happen if we'd use flat_transaction
* instead. In this case, make_persistent failure will not abort
* the transaction, it will only result in an exception. This
* means that the transaction is still in WORK stage during
* stack unwinding. Only after it completes, the transaction is
* aborted (it's happening at the outermost level, when exiting
* create_a lambda).
*/
} catch (std::runtime_error &) {
}
try {
basic_transaction::run(pop, create_b);
flat_transaction::run(pop, create_b);
/* Running create_b can be done both within basic and flat
* transaction. However, note that the transaction used in the B
* constructor MUST be a flat_transaction. This is because
* flat_transaction does not abort immediately when catching an
* exception. Instead it passes it to the outermost transaction
* - the abort is performed at that outermost level. In case of
* a basic_transaction the abort would be done within the B ctor
* and it would result in the same problems as with the previous
* example.
*/
} catch (std::runtime_error &) {
}
}
static void run(obj::pool_base &pool, std::function< void()> tx, Locks &... locks)
Execute a closure-like transaction and lock locks.
Definition: transaction.hpp:676
Custom transaction error class.
Definition: pexceptions.hpp:156
Custom transaction error class.
Definition: pexceptions.hpp:167

and basic tx:

using namespace pmem::obj;
int
manual_tx_example()
{
/* pool root structure */
struct root {
mutex pmutex;
shared_mutex shared_pmutex;
p<int> count;
persistent_ptr<root> another_root;
};
/* create a pmemobj pool */
auto pop = pool<root>::create("poolfile", "layout", PMEMOBJ_MIN_POOL);
auto proot = pop.root();
try {
transaction::manual tx(pop, proot->pmutex,
proot->shared_pmutex);
/* atomically allocate objects */
proot->another_root = make_persistent<root>();
/* atomically modify objects */
proot->count++;
/* It's necessary to commit the transaction manually and
* it has to be the last operation in the transaction. */
/* an internal transaction error occurred, tx aborted
* reacquire locks if necessary */
} catch (...) {
/* some other exception thrown, tx aborted
* reacquire locks if necessary */
}
/* In complex cases with library calls, remember to check the status of
* the previous transaction. */
return transaction::error();
}
static void commit()
Manually commit a transaction.
Definition: transaction.hpp:330
typename detail::transaction_base< false >::manual manual
C++ manual scope transaction class.
Definition: transaction.hpp:643
Pmem-resident mutex.
Pmem-resident shared mutex.

Function Documentation

◆ ctl_exec() [1/2]

template<typename T >
T pmem::obj::ctl_exec ( const std::string &  name,
arg 
)

Execute function at global scope.

Parameters
[in]namename of entry point
[in]argextra argument
Returns
copy of arg, possibly modified by query

For more details, see: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3

◆ ctl_exec() [2/2]

template<typename T >
T pmem::obj::ctl_exec ( const std::wstring &  name,
arg 
)

Execute function at global scope.

Parameters
[in]namename of entry point
[in]argextra argument
Returns
copy of arg, possibly modified by query

For more details, see: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3

◆ ctl_get() [1/2]

template<typename T >
T pmem::obj::ctl_get ( const std::string &  name)

Query libpmemobj state at global scope.

Parameters
[in]namename of entry point
Returns
variable representing internal state

For more details, see: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3

◆ ctl_get() [2/2]

template<typename T >
T pmem::obj::ctl_get ( const std::wstring &  name)

Query libpmemobj state at global scope.

Parameters
[in]namename of entry point
Returns
variable representing internal state

For more details, see: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3

◆ ctl_set() [1/2]

template<typename T >
T pmem::obj::ctl_set ( const std::string &  name,
arg 
)

Modify libpmemobj state at global scope.

Parameters
[in]namename of entry point
[in]argextra argument
Returns
copy of arg, possibly modified by query

For more details, see: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3

◆ ctl_set() [2/2]

template<typename T >
T pmem::obj::ctl_set ( const std::wstring &  name,
arg 
)

Modify libpmemobj state at global scope.

Parameters
[in]namename of entry point
[in]argextra argument
Returns
copy of arg, possibly modified by query

For more details, see: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3

◆ is_defragmentable() [1/2]

template<typename T >
static constexpr std::enable_if<detail::t_is_defragmentable<T>::value, bool>::type pmem::obj::is_defragmentable ( )
staticconstexprnoexcept

Checks if provided T type is defragmentable.

This is included in public API, but there's no need to check it before calling 'add()', since 'add' method has a specialization for doing nothing in case of non-defragmentable object.

Returns
bool true when object implements 'for_each_ptr' method.

◆ is_defragmentable() [2/2]

template<typename T >
static constexpr std::enable_if<!detail::t_is_defragmentable<T>::value, bool>::type pmem::obj::is_defragmentable ( )
staticconstexprnoexcept

Checks if provided T type is defragmentable.

Specialization for non-defragmentable objects.

Returns
bool false when object does not implement 'for_each_ptr' method.

◆ pool_by_pptr()

template<typename T >
pool_base pmem::obj::pool_by_pptr ( const persistent_ptr< T >  ptr)
inline

Retrieve pool handle for the given persistent_ptr.

Parameters
[in]ptrpointer to an object from a persistent memory pool.
Returns
handle to the pool containing the object.
Exceptions
pool_errorif the given pointer does not belong to an open pool.

◆ pool_by_vptr()

template<typename T >
pool_base pmem::obj::pool_by_vptr ( const T *  that)
inline

Retrieve pool handle for the given pointer.

Parameters
[in]thatpointer to an object from a persistent memory pool.
Returns
handle to the pool containing the object.
Exceptions
pool_errorif the given pointer does not belong to an open pool.