1 #ifndef DataFormats_Common_AtomicPtrCache_h
2 #define DataFormats_Common_AtomicPtrCache_h
56 T const*
load()
const;
61 bool set(std::unique_ptr<T> iNewValue)
const;
90 auto ptr = iOther.m_data.load(std::memory_order_acquire);
92 m_data.store(
new T{*ptr}, std::memory_order_release);
97 auto ptr = iOther.
m_data.load(std::memory_order_acquire);
99 auto ourPtr =m_data.load(std::memory_order_acquire);
100 if( ourPtr !=
nullptr) {
103 m_data.store(
new T{*ptr}, std::memory_order_release);
106 delete m_data.exchange(
nullptr, std::memory_order_acq_rel);
114 delete m_data.load(std::memory_order_acquire);
129 T* expected =
nullptr;
130 if( (retValue = m_data.compare_exchange_strong(expected,iNewValue.get(), std::memory_order_acq_rel)) ) {
141 T*
tmp = m_data.exchange(
nullptr);
T const & operator*() const
void reset()
unsets the value and deletes the memory
AtomicPtrCache & operator=(const AtomicPtrCache< T > &)
bool set(std::unique_ptr< T > iNewValue) const
T const * operator->() const
std::vector< std::vector< double > > tmp
std::atomic< T * > m_data