1 #ifndef DataFormats_Common_refcore_implementation_h
2 #define DataFormats_Common_refcore_implementation_h
34 namespace refcoreimpl {
46 std::uintptr_t
tmp =
reinterpret_cast<std::uintptr_t
>(iGetter);
48 ptr.store(reinterpret_cast<void const*>(tmp));
53 std::uintptr_t
tmp =
reinterpret_cast<std::uintptr_t
>(iGetter);
55 ptr =
reinterpret_cast<void const*
>(
tmp);
59 inline void setCacheIsItem(std::atomic<void const*>& iCache,
void const* iNewValue) {
64 auto cache = iCache.load();
66 return iCache.compare_exchange_strong(cache, iNewValue);
71 inline void const*
productPtr(std::atomic<void const*>
const& iCache) {
72 auto tmp = iCache.load();
77 auto tmp = iCache.load();
92 #define ID_IMPL return ProductID(processIndex_ & refcoreimpl::kProcessIndexMask,productIndex_)
94 #define PRODUCTPTR_IMPL return refcoreimpl::productPtr(cachePtr_)
96 #define ISNONNULL_IMPL return isTransient() ? productPtr() != nullptr : id().isValid()
98 #define PRODUCTGETTER_IMPL return refcoreimpl::productGetter(cachePtr_)
100 #define ISTRANSIENT_IMPL return 0!=(processIndex_ & refcoreimpl::kTransientBit)
102 #define SETTRANSIENT_IMPL processIndex_ |=refcoreimpl::kTransientBit
104 #define SETCACHEISPRODUCTPTR_IMPL(_item_) refcoreimpl::setCacheIsItem(cachePtr_,_item_)
106 #define SETCACHEISPRODUCTGETTER_IMPL(_getter_) refcoreimpl::setCacheIsProductGetter(cachePtr_, _getter_)
void const * productPtr(std::atomic< void const * > const &iCache)
void setCacheIsItem(std::atomic< void const * > &iCache, void const *iNewValue)
EDProductGetter const * productGetter(std::atomic< void const * > const &iCache)
bool tryToSetCacheItemForFirstTime(std::atomic< void const * > &iCache, void const *iNewValue)
void setCacheIsProductGetter(std::atomic< void const * > &ptr, EDProductGetter const *iGetter)
const std::uintptr_t kCacheIsProductPtrMask
const unsigned short kProcessIndexMask
bool cacheIsProductPtr(void const *iPtr)
std::vector< std::vector< double > > tmp
const std::uintptr_t kCacheIsProductPtrBit
const unsigned short kTransientBit