38 #ifndef LIBPMEMOBJ_CPP_COMMON_HPP 39 #define LIBPMEMOBJ_CPP_COMMON_HPP 42 #include <libpmemobj/tx_base.h> 45 #if defined(__GNUC__) || defined(__clang__) 46 #define POBJ_CPP_DEPRECATED __attribute__((deprecated)) 47 #elif defined(_MSC_VER) 48 #define POBJ_CPP_DEPRECATED __declspec(deprecated) 50 #define POBJ_CPP_DEPRECATED 60 #if !defined(__clang__) && defined(__GNUG__) && __GNUC__ < 5 61 #define IS_TRIVIALLY_COPYABLE(T) __has_trivial_copy(T) 63 #define IS_TRIVIALLY_COPYABLE(T) std::is_trivially_copyable<T>::value 90 conditional_add_to_tx(
const T *that, std::size_t count = 1)
95 if (pmemobj_tx_stage() != TX_STAGE_WORK)
99 if (!pmemobj_pool_by_ptr(that))
102 if (pmemobj_tx_add_range_direct(that,
sizeof(*that) * count))
104 "Could not add object(s) to the transaction.");
110 template <
typename T>
114 return typeid(T).hash_code();
Persistent pointer class.
Definition: common.hpp:72
uint64_t next_pow_2(uint64_t v)
Round up to the next lowest power of 2.
Definition: common.hpp:121
Custom transaction error class.
Definition: pexceptions.hpp:63
Definition: allocator.hpp:48