CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::RefCoreWithIndex Class Reference

#include <RefCoreWithIndex.h>

Public Member Functions

WrapperBase const * getProductPtr (std::type_info const &type, EDProductGetter const *prodGetter) const
 
ProductID id () const
 
unsigned int index () const
 
bool isAvailable () const
 
bool isNonnull () const
 
bool isNull () const
 
bool isTransient () const
 
int isTransientInt () const
 
void nullPointerForTransientException (std::type_info const &type) const
 
bool operator! () const
 
RefCoreWithIndexoperator= (RefCoreWithIndex const &)
 
RefCoreWithIndexoperator= (RefCoreWithIndex &&)=default
 
EDProductGetter const * productGetter () const
 
void productNotFoundException (std::type_info const &type) const
 
void const * productPtr () const
 
void pushBackItem (RefCoreWithIndex const &productToBeInserted, bool checkPointer)
 
 RefCoreWithIndex ()
 
 RefCoreWithIndex (ProductID const &theId, void const *prodPtr, EDProductGetter const *prodGetter, bool transient, unsigned int elementIndex)
 
 RefCoreWithIndex (RefCore const &iCore, unsigned int)
 
 RefCoreWithIndex (RefCoreWithIndex const &)
 
 RefCoreWithIndex (RefCoreWithIndex &&iOther)
 
void setProductGetter (EDProductGetter const *prodGetter) const
 
void setProductPtr (void const *prodPtr) const
 
void swap (RefCoreWithIndex &)
 
RefCore const & toRefCore () const
 
bool tryToSetProductPtrForFirstTime (void const *prodPtr) const
 
void wrongTypeException (std::type_info const &expectedType, std::type_info const &actualType) const
 

Private Member Functions

void setCacheIsProductGetter (EDProductGetter const *iGetter) const
 
void setCacheIsProductPtr (void const *iItem) const
 
void setId (ProductID const &iId)
 
void setTransient ()
 
RefCoretoUnConstRefCore ()
 

Private Attributes

std::atomic< void const * > cachePtr_
 
unsigned int elementIndex_
 
ProcessIndex processIndex_
 
ProductIndex productIndex_
 

Detailed Description

Definition at line 26 of file RefCoreWithIndex.h.

Constructor & Destructor Documentation

edm::RefCoreWithIndex::RefCoreWithIndex ( )
inline

Definition at line 28 of file RefCoreWithIndex.h.

edm::RefCoreWithIndex::RefCoreWithIndex ( ProductID const &  theId,
void const *  prodPtr,
EDProductGetter const *  prodGetter,
bool  transient,
unsigned int  elementIndex 
)

Definition at line 11 of file RefCoreWithIndex.cc.

References setCacheIsProductGetter(), and setTransient().

11  :
12  cachePtr_(prodPtr),
13  processIndex_(theId.processIndex()),
14  productIndex_(theId.productIndex()),
15  elementIndex_(iIndex)
16  {
17  if(transient) {
18  setTransient();
19  }
20  if(prodPtr==nullptr && prodGetter!=nullptr) {
21  setCacheIsProductGetter(prodGetter);
22  }
23  }
std::atomic< void const * > cachePtr_
void setCacheIsProductGetter(EDProductGetter const *iGetter) const
edm::RefCoreWithIndex::RefCoreWithIndex ( RefCore const &  iCore,
unsigned int  iIndex 
)

Definition at line 25 of file RefCoreWithIndex.cc.

25  :
26  cachePtr_(iCore.cachePtr_.load()),
27  processIndex_(iCore.processIndex_),
28  productIndex_(iCore.productIndex_),
29  elementIndex_(iIndex){}
std::atomic< void const * > cachePtr_
edm::RefCoreWithIndex::RefCoreWithIndex ( RefCoreWithIndex const &  iOther)

Definition at line 31 of file RefCoreWithIndex.cc.

31  :
32  cachePtr_(iOther.cachePtr_.load()),
33  processIndex_(iOther.processIndex_),
34  productIndex_(iOther.productIndex_),
35  elementIndex_(iOther.elementIndex_){}
std::atomic< void const * > cachePtr_
edm::RefCoreWithIndex::RefCoreWithIndex ( RefCoreWithIndex &&  iOther)
inline

Definition at line 39 of file RefCoreWithIndex.h.

39  : cachePtr_(iOther.cachePtr_.load()),processIndex_(iOther.processIndex_),
40  productIndex_(iOther.productIndex_),elementIndex_(iOther.elementIndex_) {}
std::atomic< void const * > cachePtr_

Member Function Documentation

WrapperBase const* edm::RefCoreWithIndex::getProductPtr ( std::type_info const &  type,
EDProductGetter const *  prodGetter 
) const
inline

Definition at line 96 of file RefCoreWithIndex.h.

References edm::RefCore::getProductPtr(), and toRefCore().

96  {
97  return toRefCore().getProductPtr(type,prodGetter);
98  }
type
Definition: HCALResponse.h:21
WrapperBase const * getProductPtr(std::type_info const &type, EDProductGetter const *prodGetter) const
Definition: RefCore.cc:60
RefCore const & toRefCore() const
ProductID edm::RefCoreWithIndex::id ( ) const
inline

Definition at line 44 of file RefCoreWithIndex.h.

References ID_IMPL.

Referenced by OmniClusterRef::id(), edm::RefCoreWithIndexStreamer::operator()(), and reco::LeafRefCandidateT::overlap().

44 {ID_IMPL;}
#define ID_IMPL
Definition: classes.h:93
unsigned int edm::RefCoreWithIndex::index ( ) const
inline
bool edm::RefCoreWithIndex::isAvailable ( ) const
inline

Definition at line 79 of file RefCoreWithIndex.h.

References edm::RefCore::isAvailable(), and toRefCore().

79  {
80  return toRefCore().isAvailable();
81  }
RefCore const & toRefCore() const
bool isAvailable() const
Definition: RefCore.cc:168
bool edm::RefCoreWithIndex::isNonnull ( ) const
inline

Definition at line 71 of file RefCoreWithIndex.h.

References ISNONNULL_IMPL.

Referenced by isNull().

#define ISNONNULL_IMPL
Definition: classes.h:97
bool edm::RefCoreWithIndex::isNull ( ) const
inline

Definition at line 68 of file RefCoreWithIndex.h.

References isNonnull().

Referenced by operator!().

68 {return !isNonnull(); }
bool edm::RefCoreWithIndex::isTransient ( ) const
inline

Definition at line 114 of file RefCoreWithIndex.h.

References ISTRANSIENT_IMPL.

Referenced by isTransientInt(), and edm::RefCoreWithIndexStreamer::operator()().

#define ISTRANSIENT_IMPL
Definition: classes.h:101
int edm::RefCoreWithIndex::isTransientInt ( ) const
inline

Definition at line 116 of file RefCoreWithIndex.h.

References isTransient().

116 {return isTransient() ? 1 : 0;}
void edm::RefCoreWithIndex::nullPointerForTransientException ( std::type_info const &  type) const
inline

Definition at line 108 of file RefCoreWithIndex.h.

References edm::RefCore::nullPointerForTransientException(), and toRefCore().

108  {
110  }
type
Definition: HCALResponse.h:21
RefCore const & toRefCore() const
void nullPointerForTransientException(std::type_info const &type) const
Definition: RefCore.cc:160
bool edm::RefCoreWithIndex::operator! ( ) const
inline

Definition at line 74 of file RefCoreWithIndex.h.

References isNull().

74 {return isNull();}
RefCoreWithIndex & edm::RefCoreWithIndex::operator= ( RefCoreWithIndex const &  iOther)

Definition at line 37 of file RefCoreWithIndex.cc.

References cachePtr_, elementIndex_, processIndex_, and productIndex_.

37  {
38  cachePtr_ = iOther.cachePtr_.load();
39  processIndex_ = iOther.processIndex_;
40  productIndex_ = iOther.productIndex_;
41  elementIndex_ = iOther.elementIndex_;
42  return *this;
43  }
std::atomic< void const * > cachePtr_
RefCoreWithIndex& edm::RefCoreWithIndex::operator= ( RefCoreWithIndex &&  )
default
EDProductGetter const* edm::RefCoreWithIndex::productGetter ( ) const
inline

Definition at line 88 of file RefCoreWithIndex.h.

References PRODUCTGETTER_IMPL.

88  {
90  }
#define PRODUCTGETTER_IMPL
Definition: classes.h:99
void edm::RefCoreWithIndex::productNotFoundException ( std::type_info const &  type) const
inline

Definition at line 100 of file RefCoreWithIndex.h.

References edm::RefCore::productNotFoundException(), and toRefCore().

100  {
102  }
type
Definition: HCALResponse.h:21
RefCore const & toRefCore() const
void productNotFoundException(std::type_info const &type) const
Definition: RefCore.cc:140
void const* edm::RefCoreWithIndex::productPtr ( ) const
inline

If productPtr is not 0 then productGetter will be 0 since only one is available at a time

Definition at line 47 of file RefCoreWithIndex.h.

References PRODUCTPTR_IMPL.

#define PRODUCTPTR_IMPL
Definition: classes.h:95
void edm::RefCoreWithIndex::pushBackItem ( RefCoreWithIndex const &  productToBeInserted,
bool  checkPointer 
)
inline

Definition at line 118 of file RefCoreWithIndex.h.

References edm::RefCore::pushBackItem(), toRefCore(), and toUnConstRefCore().

118  {
119  toUnConstRefCore().pushBackItem(productToBeInserted.toRefCore(),checkPointer);
120  }
void pushBackItem(RefCore const &productToBeInserted, bool checkPointer)
Definition: RefCore.cc:193
void edm::RefCoreWithIndex::setCacheIsProductGetter ( EDProductGetter const *  iGetter) const
inlineprivate

Definition at line 132 of file RefCoreWithIndex.h.

References SETCACHEISPRODUCTGETTER_IMPL.

Referenced by RefCoreWithIndex().

#define SETCACHEISPRODUCTGETTER_IMPL(_getter_)
Definition: classes.h:107
void edm::RefCoreWithIndex::setCacheIsProductPtr ( void const *  iItem) const
inlineprivate

Definition at line 131 of file RefCoreWithIndex.h.

References SETCACHEISPRODUCTPTR_IMPL.

Referenced by setProductPtr().

#define SETCACHEISPRODUCTPTR_IMPL(_item_)
Definition: classes.h:105
void edm::RefCoreWithIndex::setId ( ProductID const &  iId)
inlineprivate

Definition at line 127 of file RefCoreWithIndex.h.

References edm::RefCore::setId(), and toUnConstRefCore().

127  {
128  toUnConstRefCore().setId(iId);
129  }
void setId(ProductID const &iId)
Definition: RefCore.cc:184
void edm::RefCoreWithIndex::setProductGetter ( EDProductGetter const *  prodGetter) const
inline

Definition at line 92 of file RefCoreWithIndex.h.

References edm::RefCore::setProductGetter(), and toRefCore().

92  {
93  toRefCore().setProductGetter(prodGetter);
94  }
RefCore const & toRefCore() const
void setProductGetter(EDProductGetter const *prodGetter) const
Definition: RefCore.cc:179
void edm::RefCoreWithIndex::setProductPtr ( void const *  prodPtr) const
inline

This function is 'const' even though it changes an internal value becuase it is meant to be used as a way to store in a thread-safe way a cache of a value. This allows classes which use the RefCore to not have to declare it 'mutable'

Definition at line 53 of file RefCoreWithIndex.h.

References setCacheIsProductPtr().

53  {
54  setCacheIsProductPtr(prodPtr);
55  }
void setCacheIsProductPtr(void const *iItem) const
void edm::RefCoreWithIndex::setTransient ( )
inlineprivate

Definition at line 130 of file RefCoreWithIndex.h.

References SETTRANSIENT_IMPL.

Referenced by RefCoreWithIndex().

#define SETTRANSIENT_IMPL
Definition: classes.h:103
void edm::RefCoreWithIndex::swap ( RefCoreWithIndex other)
inline

Definition at line 158 of file RefCoreWithIndex.h.

References cachePtr_, elementIndex_, processIndex_, productIndex_, and std::swap().

Referenced by edm::swap().

158  {
159  std::swap(processIndex_, other.processIndex_);
160  std::swap(productIndex_, other.productIndex_);
161  other.cachePtr_.store(cachePtr_.exchange(other.cachePtr_.load()));
162  std::swap(elementIndex_,other.elementIndex_);
163  }
std::atomic< void const * > cachePtr_
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
RefCore const& edm::RefCoreWithIndex::toRefCore ( ) const
inline
RefCore& edm::RefCoreWithIndex::toUnConstRefCore ( )
inlineprivate

Definition at line 123 of file RefCoreWithIndex.h.

Referenced by pushBackItem(), and setId().

123  {
124  return *reinterpret_cast<RefCore*>(this);
125  }
bool edm::RefCoreWithIndex::tryToSetProductPtrForFirstTime ( void const *  prodPtr) const
inline

This function is 'const' even though it changes an internal value becuase it is meant to be used as a way to store in a thread-safe way a cache of a value. This allows classes which use the RefCore to not have to declare it 'mutable'

Definition at line 61 of file RefCoreWithIndex.h.

References cachePtr_, and edm::refcoreimpl::tryToSetCacheItemForFirstTime().

61  {
63  }
std::atomic< void const * > cachePtr_
bool tryToSetCacheItemForFirstTime(std::atomic< void const * > &iCache, void const *iNewValue)
void edm::RefCoreWithIndex::wrongTypeException ( std::type_info const &  expectedType,
std::type_info const &  actualType 
) const
inline

Definition at line 104 of file RefCoreWithIndex.h.

References toRefCore(), and edm::RefCore::wrongTypeException().

104  {
105  toRefCore().wrongTypeException(expectedType,actualType);
106  }
RefCore const & toRefCore() const
void wrongTypeException(std::type_info const &expectedType, std::type_info const &actualType) const
Definition: RefCore.cc:150

Member Data Documentation

std::atomic<void const*> edm::RefCoreWithIndex::cachePtr_
mutableprivate

Definition at line 142 of file RefCoreWithIndex.h.

Referenced by operator=(), swap(), and tryToSetProductPtrForFirstTime().

unsigned int edm::RefCoreWithIndex::elementIndex_
private

Definition at line 151 of file RefCoreWithIndex.h.

Referenced by index(), operator=(), and swap().

ProcessIndex edm::RefCoreWithIndex::processIndex_
private

Definition at line 149 of file RefCoreWithIndex.h.

Referenced by operator=(), and swap().

ProductIndex edm::RefCoreWithIndex::productIndex_
private

Definition at line 150 of file RefCoreWithIndex.h.

Referenced by operator=(), and swap().