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 53 #if LIBPMEMOBJ_CPP_VG_ENABLED 54 #undef LIBPMEMOBJ_CPP_VG_PMEMCHECK_ENABLED 55 #undef LIBPMEMOBJ_CPP_VG_MEMCHECK_ENABLED 56 #undef LIBPMEMOBJ_CPP_VG_HELGRIND_ENABLED 57 #undef LIBPMEMOBJ_CPP_VG_DRD_ENABLED 59 #define LIBPMEMOBJ_CPP_VG_PMEMCHECK_ENABLED 1 60 #define LIBPMEMOBJ_CPP_VG_MEMCHECK_ENABLED 1 61 #define LIBPMEMOBJ_CPP_VG_HELGRIND_ENABLED 1 62 #define LIBPMEMOBJ_CPP_VG_DRD_ENABLED 1 65 #if LIBPMEMOBJ_CPP_VG_PMEMCHECK_ENABLED || \ 66 LIBPMEMOBJ_CPP_VG_MEMCHECK_ENABLED || \ 67 LIBPMEMOBJ_CPP_VG_HELGRIND_ENABLED || LIBPMEMOBJ_CPP_VG_DRD_ENABLED 68 #define LIBPMEMOBJ_CPP_ANY_VG_TOOL_ENABLED 1 71 #if LIBPMEMOBJ_CPP_ANY_VG_TOOL_ENABLED 75 #if LIBPMEMOBJ_CPP_VG_PMEMCHECK_ENABLED 76 #include <pmemcheck.h> 79 #if LIBPMEMOBJ_CPP_VG_MEMCHECK_ENABLED 83 #if LIBPMEMOBJ_CPP_VG_HELGRIND_ENABLED 87 #if LIBPMEMOBJ_CPP_VG_DRD_ENABLED 98 #if !defined(LIBPMEMOBJ_CPP_USE_HAS_TRIVIAL_COPY) 99 #if !defined(__clang__) && defined(__GNUG__) && __GNUC__ < 5 100 #define LIBPMEMOBJ_CPP_USE_HAS_TRIVIAL_COPY 1 102 #define LIBPMEMOBJ_CPP_USE_HAS_TRIVIAL_COPY 0 106 #if LIBPMEMOBJ_CPP_USE_HAS_TRIVIAL_COPY 107 #define LIBPMEMOBJ_CPP_IS_TRIVIALLY_COPYABLE(T) __has_trivial_copy(T) 109 #define LIBPMEMOBJ_CPP_IS_TRIVIALLY_COPYABLE(T) \ 110 std::is_trivially_copyable<T>::value 118 template <
typename T>
135 template <
typename T>
137 conditional_add_to_tx(
const T *that, std::size_t count = 1)
142 if (pmemobj_tx_stage() != TX_STAGE_WORK)
146 if (!pmemobj_pool_by_ptr(that))
149 if (pmemobj_tx_add_range_direct(that,
sizeof(*that) * count))
151 "Could not add object(s) to the transaction.");
157 template <
typename T>
161 return typeid(T).hash_code();
Persistent pointer class.
Definition: common.hpp:119
uint64_t next_pow_2(uint64_t v)
Round up to the next lowest power of 2.
Definition: common.hpp:168
Custom transaction error class.
Definition: pexceptions.hpp:63