Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:55

0001 #include "DataFormats/Common/interface/RefCoreWithIndex.h"
0002 #include "DataFormats/Common/interface/RefCore.h"
0003 
0004 namespace edm {
0005 
0006   RefCoreWithIndex::RefCoreWithIndex(ProductID const& theId,
0007                                      void const* prodPtr,
0008                                      EDProductGetter const* prodGetter,
0009                                      bool transient,
0010                                      unsigned int iIndex)
0011       : cachePtr_(prodPtr),
0012         processIndex_(theId.processIndex()),
0013         productIndex_(theId.productIndex()),
0014         elementIndex_(iIndex) {
0015     if (transient) {
0016       setTransient();
0017     }
0018     if (prodPtr == nullptr && prodGetter != nullptr) {
0019       setCacheIsProductGetter(prodGetter);
0020     }
0021   }
0022 
0023   RefCoreWithIndex::RefCoreWithIndex(RefCore const& iCore, unsigned int iIndex)
0024       : processIndex_(iCore.processIndex_), productIndex_(iCore.productIndex_), elementIndex_(iIndex) {
0025     cachePtr_.store(iCore.cachePtr_.load(std::memory_order_relaxed), std::memory_order_relaxed);
0026   }
0027 
0028   RefCoreWithIndex::RefCoreWithIndex(RefCoreWithIndex const& iOther)
0029       : processIndex_(iOther.processIndex_), productIndex_(iOther.productIndex_), elementIndex_(iOther.elementIndex_) {
0030     cachePtr_.store(iOther.cachePtr_.load(std::memory_order_relaxed), std::memory_order_relaxed);
0031   }
0032 
0033   RefCoreWithIndex& RefCoreWithIndex::operator=(RefCoreWithIndex const& iOther) {
0034     cachePtr_.store(iOther.cachePtr_.load(std::memory_order_relaxed), std::memory_order_relaxed);
0035     processIndex_ = iOther.processIndex_;
0036     productIndex_ = iOther.productIndex_;
0037     elementIndex_ = iOther.elementIndex_;
0038     return *this;
0039   }
0040 
0041 }  // namespace edm