CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::RefToBaseProd< T > Class Template Reference

#include <RefToBase.h>

Public Types

typedef View< Tproduct_type
 

Public Member Functions

product_type const * get () const
 
bool hasCache () const
 Checks if product is in memory. More...
 
ProductID id () const
 Accessor for product ID. More...
 
bool isNonnull () const
 Checks for non-null. More...
 
bool isNull () const
 Checks for null. More...
 
bool operator! () const
 Checks for null. More...
 
product_type const & operator* () const
 Dereference operator. More...
 
product_type const * operator-> () const
 Member dereference operator. More...
 
RefToBaseProd< T > & operator= (const RefToBaseProd< T > &other)
 
product_type const * product () const
 
EDProductGetter const * productGetter () const
 Accessor for product getter. More...
 
 RefToBaseProd ()
 Default constructor needed for reading from persistent store. Not for direct use. More...
 
template<typename C >
 RefToBaseProd (const RefProd< C > &)
 
 RefToBaseProd (const RefToBaseProd< T > &)
 
template<typename C >
 RefToBaseProd (Handle< C > const &handle)
 
 RefToBaseProd (Handle< View< T >> const &handle)
 
template<typename C >
 RefToBaseProd (OrphanHandle< C > const &handle)
 
 RefToBaseProd (ProductID const &, EDProductGetter const *)
 
void swap (RefToBaseProd< T > &)
 
 ~RefToBaseProd ()
 Destructor. More...
 

Static Public Member Functions

static short Class_Version ()
 

Private Member Functions

RefCore const & refCore () const
 
View< T > const * viewPtr () const
 

Private Attributes

RefCore product_
 

Detailed Description

template<typename T>
class edm::RefToBaseProd< T >

Definition at line 65 of file RefToBase.h.

Member Typedef Documentation

◆ product_type

template<typename T>
typedef View<T> edm::RefToBaseProd< T >::product_type

Definition at line 31 of file RefToBaseProd.h.

Constructor & Destructor Documentation

◆ RefToBaseProd() [1/7]

template<typename T>
edm::RefToBaseProd< T >::RefToBaseProd ( )
inline

Default constructor needed for reading from persistent store. Not for direct use.

Definition at line 34 of file RefToBaseProd.h.

34 : product_() {}

◆ RefToBaseProd() [2/7]

template<typename T >
template<typename C >
edm::RefToBaseProd< T >::RefToBaseProd ( Handle< C > const &  handle)
inlineexplicit

Definition at line 187 of file RefToBaseProd.h.

188  : product_(handle.id(), handle.product(), nullptr, false) {
189  std::vector<void const*> pointers;
191  fillView(*handle, handle.id(), pointers, helpers);
192  product_.setProductPtr(new View<T>(pointers, helpers, nullptr));
193  }

References edm::fillView(), patZpeak::handle, edm::RefToBaseProd< T >::product_, and edm::RefCore::setProductPtr().

◆ RefToBaseProd() [3/7]

template<typename T >
edm::RefToBaseProd< T >::RefToBaseProd ( Handle< View< T >> const &  handle)
inlineexplicit

Definition at line 97 of file RefToBaseProd.h.

98  : product_(handle.id(), nullptr, nullptr, false) {
100  }

References patZpeak::handle, edm::RefToBaseProd< T >::product_, and edm::RefCore::setProductPtr().

◆ RefToBaseProd() [4/7]

template<typename T >
template<typename C >
edm::RefToBaseProd< T >::RefToBaseProd ( OrphanHandle< C > const &  handle)
inlineexplicit

Definition at line 197 of file RefToBaseProd.h.

198  : product_(handle.id(), handle.product(), nullptr, false) {
199  std::vector<void const*> pointers;
201  fillView(*handle, handle.id(), pointers, helpers);
202  product_.setProductPtr(new View<T>(pointers, helpers, nullptr));
203  }

References edm::fillView(), patZpeak::handle, edm::RefToBaseProd< T >::product_, and edm::RefCore::setProductPtr().

◆ RefToBaseProd() [5/7]

template<typename T >
edm::RefToBaseProd< T >::RefToBaseProd ( const RefToBaseProd< T > &  ref)
inline

Definition at line 103 of file RefToBaseProd.h.

103  : product_(ref.product_) {
104  if (product_.productPtr()) {
105  product_.setProductPtr(ref.viewPtr() ? (new View<T>(*ref)) : nullptr);
106  }
107  }

References edm::RefToBaseProd< T >::product_, edm::RefCore::productPtr(), and edm::RefCore::setProductPtr().

◆ RefToBaseProd() [6/7]

template<typename T >
template<typename C >
edm::RefToBaseProd< T >::RefToBaseProd ( const RefProd< C > &  ref)
inlineexplicit

Definition at line 178 of file RefToBaseProd.h.

178  : product_(ref.refCore()) {
179  std::vector<void const*> pointers;
181  fillView(*ref.product(), ref.id(), pointers, helpers);
182  product_.setProductPtr(new View<T>(pointers, helpers, ref.refCore().productGetter()));
183  }

References edm::fillView(), edm::RefProd< C >::id(), edm::RefProd< C >::product(), edm::RefToBaseProd< T >::product_, edm::RefProd< C >::refCore(), and edm::RefCore::setProductPtr().

◆ RefToBaseProd() [7/7]

template<typename T >
edm::RefToBaseProd< T >::RefToBaseProd ( ProductID const &  id,
EDProductGetter const *  getter 
)
inline

Definition at line 206 of file RefToBaseProd.h.

207  : product_(id, nullptr, getter, false) {}

◆ ~RefToBaseProd()

template<typename T>
edm::RefToBaseProd< T >::~RefToBaseProd ( )
inline

Destructor.

Definition at line 47 of file RefToBaseProd.h.

47 { delete viewPtr(); }

References edm::RefToBaseProd< T >::viewPtr().

Member Function Documentation

◆ Class_Version()

template<typename T>
static short edm::RefToBaseProd< T >::Class_Version ( )
inlinestatic

Definition at line 86 of file RefToBaseProd.h.

87 :
88  //NOTE: Access to RefCore should be private since we modify the use of productPtr

◆ get()

template<typename T>
product_type const* edm::RefToBaseProd< T >::get ( ) const
inline

◆ hasCache()

template<typename T>
bool edm::RefToBaseProd< T >::hasCache ( ) const
inline

Checks if product is in memory.

Definition at line 79 of file RefToBaseProd.h.

79 { return product_.productPtr() != nullptr; }

References edm::RefToBaseProd< T >::product_, and edm::RefCore::productPtr().

◆ id()

template<typename T>
ProductID edm::RefToBaseProd< T >::id ( ) const
inline

Accessor for product ID.

Definition at line 73 of file RefToBaseProd.h.

73 { return product_.id(); }

References edm::RefCore::id(), and edm::RefToBaseProd< T >::product_.

◆ isNonnull()

template<typename T>
bool edm::RefToBaseProd< T >::isNonnull ( ) const
inline

Checks for non-null.

Definition at line 67 of file RefToBaseProd.h.

67 { return product_.isNonnull(); }

References edm::RefCore::isNonnull(), and edm::RefToBaseProd< T >::product_.

Referenced by edm::RefToBaseProd< T >::isNull().

◆ isNull()

template<typename T>
bool edm::RefToBaseProd< T >::isNull ( ) const
inline

◆ operator!()

template<typename T>
bool edm::RefToBaseProd< T >::operator! ( ) const
inline

Checks for null.

Definition at line 70 of file RefToBaseProd.h.

70 { return isNull(); }

References edm::RefToBaseProd< T >::isNull().

◆ operator*()

template<typename T >
View< T > const & edm::RefToBaseProd< T >::operator* ( ) const
inline

Dereference operator.

Definition at line 118 of file RefToBaseProd.h.

118  {
119  return *operator->();
120  }

◆ operator->()

template<typename T >
View< T > const * edm::RefToBaseProd< T >::operator-> ( ) const
inline

Member dereference operator.

Definition at line 124 of file RefToBaseProd.h.

124  {
125  //Another thread might change the value returned so just get it once
126  auto getter = product_.productGetter();
127  if (getter != nullptr) {
128  if (product_.isNull()) {
129  Exception::throwThis(errors::InvalidReference, "attempting get view from a null RefToBaseProd.\n");
130  }
131  ProductID tId = product_.id();
132  std::vector<void const*> pointers;
134  WrapperBase const* prod = getter->getIt(tId);
135  if (prod == nullptr) {
136  Exception::throwThis(errors::InvalidReference, "attempting to get view from an unavailable RefToBaseProd.");
137  }
138  prod->fillView(tId, pointers, helpers);
139  std::unique_ptr<View<T>> tmp{new View<T>(pointers, helpers, getter)};
141  tmp.release();
142  }
143  }
144  return viewPtr();
145  }

References edm::ProductID::id(), edm::errors::InvalidReference, dumpMFGeometry_cfg::prod, edm::Exception::throwThis(), and createJobs::tmp.

Referenced by edm::RefToBaseProd< T >::get(), and edm::RefToBaseProd< T >::product().

◆ operator=()

template<typename T >
RefToBaseProd< T > & edm::RefToBaseProd< T >::operator= ( const RefToBaseProd< T > &  other)
inline

Definition at line 110 of file RefToBaseProd.h.

110  {
111  RefToBaseProd<T> temp(other);
112  this->swap(temp);
113  return *this;
114  }

References trackingPlots::other, edm::swap(), and groupFilesInBlocks::temp.

◆ product()

template<typename T>
product_type const* edm::RefToBaseProd< T >::product ( ) const
inline

Returns C++ pointer to the product Will attempt to retrieve product

Definition at line 61 of file RefToBaseProd.h.

61 { return isNull() ? 0 : this->operator->(); }

References edm::RefToBaseProd< T >::isNull(), and edm::RefToBaseProd< T >::operator->().

◆ productGetter()

template<typename T>
EDProductGetter const* edm::RefToBaseProd< T >::productGetter ( ) const
inline

Accessor for product getter.

Definition at line 76 of file RefToBaseProd.h.

76 { return product_.productGetter(); }

References edm::RefToBaseProd< T >::product_, and edm::RefCore::productGetter().

◆ refCore()

template<typename T>
RefCore const& edm::RefToBaseProd< T >::refCore ( ) const
inlineprivate

Definition at line 89 of file RefToBaseProd.h.

89 { return product_; }

References edm::RefToBaseProd< T >::product_.

◆ swap()

template<typename T >
void edm::RefToBaseProd< T >::swap ( RefToBaseProd< T > &  other)
inline

Definition at line 148 of file RefToBaseProd.h.

148  {
149  edm::swap(product_, other.product_);
150  }

References trackingPlots::other, and edm::swap().

Referenced by edm::swap().

◆ viewPtr()

template<typename T>
View<T> const* edm::RefToBaseProd< T >::viewPtr ( ) const
inlineprivate

Definition at line 91 of file RefToBaseProd.h.

91 { return reinterpret_cast<const View<T>*>(product_.productPtr()); }

References edm::RefToBaseProd< T >::product_, and edm::RefCore::productPtr().

Referenced by edm::RefToBaseProd< T >::~RefToBaseProd().

Member Data Documentation

◆ product_

template<typename T>
RefCore edm::RefToBaseProd< T >::product_
private
edm::FillViewHelperVector
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
Definition: FillViewHelperVector.h:30
edm::RefCore::setProductPtr
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:57
edm::errors::InvalidReference
Definition: EDMException.h:39
View< T >
patZpeak.handle
handle
Definition: patZpeak.py:23
edm::swap
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::RefCore::productGetter
EDProductGetter const * productGetter() const
Definition: RefCore.h:81
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
trackingPlots.other
other
Definition: trackingPlots.py:1465
edm::RefCore::tryToSetProductPtrForFirstTime
bool tryToSetProductPtrForFirstTime(void const *prodPtr) const
Definition: RefCore.h:63
edm::RefToBaseProd::isNull
bool isNull() const
Checks for null.
Definition: RefToBaseProd.h:64
helpers
Definition: makeCompositeCandidate.h:8
edm::RefToBaseProd::swap
void swap(RefToBaseProd< T > &)
Definition: RefToBaseProd.h:148
edm::RefToBaseProd::viewPtr
View< T > const * viewPtr() const
Definition: RefToBaseProd.h:91
edm::RefCore::id
ProductID id() const
Definition: RefCore.h:48
edm::RefCore::productPtr
void const * productPtr() const
Definition: RefCore.h:51
edm::Exception::throwThis
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:83
edm::RefToBaseProd::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: RefToBaseProd.h:67
edm::RefToBaseProd::operator->
product_type const * operator->() const
Member dereference operator.
Definition: RefToBaseProd.h:124
edm::RefCore::isNull
bool isNull() const
Definition: RefCore.h:68
edm::fillView
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers)
Definition: AssociationVector.h:290
edm::RefToBaseProd::product_
RefCore product_
Definition: RefToBaseProd.h:93
edm::RefCore::isNonnull
bool isNonnull() const
Definition: RefCore.h:71