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
77 conditional_add_to_tx(
const T *that, std::size_t count = 1)
82 if (pmemobj_tx_stage() != TX_STAGE_WORK)
86 if (!pmemobj_pool_by_ptr(that))
89 if (pmemobj_tx_add_range_direct(that,
sizeof(*that) * count))
90 throw transaction_error(
"Could not add object(s) to the"
101 return typeid(T).hash_code();