38#ifndef PMEMOBJ_COMMON_HPP
39#define PMEMOBJ_COMMON_HPP
42#include "libpmemobj/tx_base.h"
67conditional_add_to_tx(
const T *that)
69 if (pmemobj_tx_stage() != TX_STAGE_WORK)
73 if (!pmemobj_pool_by_ptr(that))
76 if (pmemobj_tx_add_range_direct(that,
sizeof(*that)))
77 throw transaction_error(
"Could not add an object to the"
93conditional_add_to_tx(
const obj::persistent_ptr<T> &that)
95 if (pmemobj_tx_stage() != TX_STAGE_WORK)
98 if (pmemobj_tx_add_range(that.raw(), 0,
sizeof(T)))
99 throw transaction_error(
"Could not add an object to the"
110 return typeid(T).hash_code();