#include "DataFormats/Common/interface/AtomicPtrCache.h"
Public Member Functions | |
AtomicPtrCache () | |
AtomicPtrCache (T *) | |
Takes exclusive ownership of the value. More... | |
AtomicPtrCache (const AtomicPtrCache< T > &) | |
Uses T's copy constructor to make a copy. More... | |
bool | isSet () const |
T const * | load () const |
T * | load () |
T const & | operator* () const |
T & | operator* () |
T const * | operator-> () const |
T * | operator-> () |
AtomicPtrCache & | operator= (const AtomicPtrCache< T > &) |
T * | release () |
void | reset () |
unsets the value and deletes the memory More... | |
bool | set (std::unique_ptr< T > iNewValue) const |
~AtomicPtrCache () | |
Private Attributes | |
std::atomic< T * > | m_data |
Description: A thread safe cache managed by a pointer
Usage: Data products which need to cache results into non-trivial structures (e.g. an std::vector) can use this class to manage the cache in a thread-safe way. The thread-safety guarantee is only the standard C++, if calls are made to const functions simultaneously then everything is thread safe. Calling a non-const function while calling any other functions is not thread-safe.
This class also hides the std::atomic from ROOT so this class can safely be used in a stored class.
WARNING: member data which uses this class must be made transient in the classes_def.xml file!
Definition at line 38 of file AtomicPtrCache.h.
|
inline |
Definition at line 81 of file AtomicPtrCache.h.
|
inlineexplicit |
|
inline |
Uses T's copy constructor to make a copy.
Definition at line 87 of file AtomicPtrCache.h.
References edm::AtomicPtrCache< T >::m_data.
|
inline |
|
inline |
Definition at line 124 of file AtomicPtrCache.h.
References edm::AtomicPtrCache< T >::m_data.
Referenced by HcalGeometry::fillDetIds(), HcalGeometry::getHxSize(), reco::PFTau::isolationPFCands(), reco::PFTau::isolationPFChargedHadrCands(), reco::PFTau::isolationPFGammaCands(), reco::PFTau::isolationPFNeutrHadrCands(), edm::AtomicPtrCache< std::vector< reco::CandidatePtr > >::operator*(), reco::PFTau::setisolationGammaCands(), reco::PFTau::signalPFCands(), reco::PFTau::signalPFChargedHadrCands(), reco::PFTau::signalPFGammaCands(), and reco::PFTau::signalPFNeutrHadrCands().
|
inline |
Definition at line 121 of file AtomicPtrCache.h.
References edm::AtomicPtrCache< T >::m_data.
Referenced by HcalGeometry::getValidDetIds(), edm::AtomicPtrCache< std::vector< reco::CandidatePtr > >::operator*(), and edm::AtomicPtrCache< std::vector< reco::CandidatePtr > >::operator->().
|
inline |
|
inline |
Definition at line 55 of file AtomicPtrCache.h.
|
inline |
Definition at line 66 of file AtomicPtrCache.h.
|
inline |
Definition at line 54 of file AtomicPtrCache.h.
|
inline |
Definition at line 65 of file AtomicPtrCache.h.
|
inline |
|
inline |
Definition at line 140 of file AtomicPtrCache.h.
References edm::AtomicPtrCache< T >::m_data, and tmp.
Referenced by edm::AtomicPtrCache< std::vector< reco::CandidatePtr > >::operator*().
|
inline |
unsets the value and deletes the memory
Definition at line 137 of file AtomicPtrCache.h.
References edm::AtomicPtrCache< T >::m_data.
Referenced by edm::AtomicPtrCache< std::vector< reco::CandidatePtr > >::operator*(), and reco::PFTau::setisolationGammaCands().
|
inline |
returns true if actually was set. Will delete value held by iNewValue if not the first time set
Definition at line 127 of file AtomicPtrCache.h.
References edm::AtomicPtrCache< T >::m_data.
Referenced by HcalGeometry::fillDetIds(), reco::PFTau::isolationPFCands(), reco::PFTau::isolationPFChargedHadrCands(), reco::PFTau::isolationPFGammaCands(), reco::PFTau::isolationPFNeutrHadrCands(), reco::PFTau::setisolationGammaCands(), reco::PFTau::signalPFCands(), reco::PFTau::signalPFChargedHadrCands(), reco::PFTau::signalPFGammaCands(), and reco::PFTau::signalPFNeutrHadrCands().
|
mutableprivate |
Definition at line 78 of file AtomicPtrCache.h.
Referenced by edm::AtomicPtrCache< T >::AtomicPtrCache(), edm::AtomicPtrCache< T >::isSet(), edm::AtomicPtrCache< T >::load(), edm::AtomicPtrCache< T >::operator=(), edm::AtomicPtrCache< T >::release(), edm::AtomicPtrCache< T >::reset(), edm::AtomicPtrCache< T >::set(), and edm::AtomicPtrCache< T >::~AtomicPtrCache().