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 isAvailable () const
 
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 (Handle< C > const &handle)
 
 RefToBaseProd (Handle< View< T >> const &handle)
 
template<typename C >
 RefToBaseProd (OrphanHandle< C > const &handle)
 
 RefToBaseProd (const RefToBaseProd< T > &)
 
template<typename C >
 RefToBaseProd (const RefProd< C > &)
 
 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 193 of file RefToBaseProd.h.

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

194  : product_(handle.id(), handle.product(), nullptr, false) {
195  std::vector<void const*> pointers;
197  fillView(*handle, handle.id(), pointers, helpers);
198  product_.setProductPtr(new View<T>(pointers, helpers, nullptr));
199  }
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const *> &pointers, FillViewHelperVector &helpers)
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:57
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector

◆ RefToBaseProd() [3/7]

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

Definition at line 103 of file RefToBaseProd.h.

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

104  : product_(handle.id(), nullptr, nullptr, false) {
105  product_.setProductPtr(new View<T>(*handle));
106  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:57

◆ RefToBaseProd() [4/7]

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

Definition at line 203 of file RefToBaseProd.h.

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

204  : product_(handle.id(), handle.product(), nullptr, false) {
205  std::vector<void const*> pointers;
207  fillView(*handle, handle.id(), pointers, helpers);
208  product_.setProductPtr(new View<T>(pointers, helpers, nullptr));
209  }
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const *> &pointers, FillViewHelperVector &helpers)
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:57
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector

◆ RefToBaseProd() [5/7]

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

Definition at line 109 of file RefToBaseProd.h.

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

109  : product_(ref.product_) {
110  if (product_.productPtr()) {
111  product_.setProductPtr(ref.viewPtr() ? (new View<T>(*ref)) : nullptr);
112  }
113  }
void const * productPtr() const
Definition: RefCore.h:51
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:57

◆ RefToBaseProd() [6/7]

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

Definition at line 184 of file RefToBaseProd.h.

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

184  : product_(ref.refCore()) {
185  std::vector<void const*> pointers;
187  fillView(*ref.product(), ref.id(), pointers, helpers);
188  product_.setProductPtr(new View<T>(pointers, helpers, ref.refCore().productGetter()));
189  }
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const *> &pointers, FillViewHelperVector &helpers)
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:57
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector

◆ RefToBaseProd() [7/7]

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

Definition at line 212 of file RefToBaseProd.h.

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

◆ ~RefToBaseProd()

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

Destructor.

Definition at line 47 of file RefToBaseProd.h.

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

47 { delete viewPtr(); }
View< T > const * viewPtr() const
Definition: RefToBaseProd.h:97

Member Function Documentation

◆ Class_Version()

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

Definition at line 92 of file RefToBaseProd.h.

93 :
94  //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 85 of file RefToBaseProd.h.

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

85 { return product_.productPtr() != nullptr; }
void const * productPtr() const
Definition: RefCore.h:51

◆ id()

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

Accessor for product ID.

Definition at line 79 of file RefToBaseProd.h.

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

79 { return product_.id(); }
ProductID id() const
Definition: RefCore.h:48

◆ isAvailable()

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

Checks if collection is in memory or available in the Event. No type checking is done. This function is potentially costly as it might cause a disk read (note that it does not cause the data to be cached locally)

Definition at line 73 of file RefToBaseProd.h.

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

73 { return product_.isAvailable(); }
bool isAvailable() const
Definition: RefCore.cc:146

◆ isNonnull()

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

Checks for non-null.

Definition at line 67 of file RefToBaseProd.h.

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

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

67 { return product_.isNonnull(); }
bool isNonnull() const
Definition: RefCore.h:71

◆ isNull()

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

Checks for null.

Definition at line 64 of file RefToBaseProd.h.

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

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

64 { return !isNonnull(); }
bool isNonnull() const
Checks for non-null.
Definition: RefToBaseProd.h:67

◆ operator!()

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

Checks for null.

Definition at line 76 of file RefToBaseProd.h.

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

76 { return isNull(); }
bool isNull() const
Checks for null.
Definition: RefToBaseProd.h:64

◆ operator*()

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

Dereference operator.

Definition at line 124 of file RefToBaseProd.h.

124  {
125  return *operator->();
126  }
product_type const * operator->() const
Member dereference operator.

◆ operator->()

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

Member dereference operator.

Definition at line 130 of file RefToBaseProd.h.

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().

130  {
131  //Another thread might change the value returned so just get it once
132  auto getter = product_.productGetter();
133  if (getter != nullptr) {
134  if (product_.isNull()) {
135  Exception::throwThis(errors::InvalidReference, "attempting get view from a null RefToBaseProd.\n");
136  }
137  ProductID tId = product_.id();
138  std::vector<void const*> pointers;
140  WrapperBase const* prod = getter->getIt(tId);
141  if (prod == nullptr) {
142  Exception::throwThis(errors::InvalidReference, "attempting to get view from an unavailable RefToBaseProd.");
143  }
144  prod->fillView(tId, pointers, helpers);
145  std::unique_ptr<View<T>> tmp{new View<T>(pointers, helpers, getter)};
147  tmp.release();
148  }
149  }
150  return viewPtr();
151  }
ProductID id() const
Definition: RefCore.h:48
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:86
bool isNull() const
Definition: RefCore.h:68
bool tryToSetProductPtrForFirstTime(void const *prodPtr) const
Definition: RefCore.h:63
View< T > const * viewPtr() const
Definition: RefToBaseProd.h:97
EDProductGetter const * productGetter() const
Definition: RefCore.h:81
tmp
align.sh
Definition: createJobs.py:716
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector

◆ operator=()

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

Definition at line 116 of file RefToBaseProd.h.

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

116  {
117  RefToBaseProd<T> temp(other);
118  this->swap(temp);
119  return *this;
120  }
void swap(RefToBaseProd< T > &)

◆ 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.

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

61 { return isNull() ? 0 : this->operator->(); }
product_type const * operator->() const
Member dereference operator.
bool isNull() const
Checks for null.
Definition: RefToBaseProd.h:64

◆ productGetter()

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

Accessor for product getter.

Definition at line 82 of file RefToBaseProd.h.

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

82 { return product_.productGetter(); }
EDProductGetter const * productGetter() const
Definition: RefCore.h:81

◆ refCore()

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

Definition at line 95 of file RefToBaseProd.h.

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

95 { return product_; }

◆ swap()

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

Definition at line 154 of file RefToBaseProd.h.

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

Referenced by edm::swap().

154  {
155  edm::swap(product_, other.product_);
156  }
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117

◆ viewPtr()

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

Definition at line 97 of file RefToBaseProd.h.

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

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

97 { return reinterpret_cast<const View<T>*>(product_.productPtr()); }
void const * productPtr() const
Definition: RefCore.h:51

Member Data Documentation

◆ product_

template<typename T>
RefCore edm::RefToBaseProd< T >::product_
private