CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 (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 63 of file RefToBase.h.

Member Typedef Documentation

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

Definition at line 31 of file RefToBaseProd.h.

Constructor & Destructor Documentation

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_(){}
template<typename T >
template<typename C >
edm::RefToBaseProd< T >::RefToBaseProd ( Handle< C > const &  handle)
inlineexplicit

Definition at line 217 of file RefToBaseProd.h.

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

217  :
218  product_(handle.id(), handle.product(), 0, false) {
219  std::vector<void const*> pointers;
220  FillViewHelperVector helpers;
221  fillView(* handle, handle.id(), pointers, helpers);
222  product_.setProductPtr(new View<T>(pointers, helpers,0));
223  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:51
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers)
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
template<typename T>
edm::RefToBaseProd< T >::RefToBaseProd ( Handle< View< T > > const &  handle)
inlineexplicit

Definition at line 106 of file RefToBaseProd.h.

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

106  :
107  product_(handle.id(), 0, 0, false){
108  product_.setProductPtr(new View<T>(* handle));
109  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:51
template<typename T >
template<typename C >
edm::RefToBaseProd< T >::RefToBaseProd ( OrphanHandle< C > const &  handle)
inlineexplicit

Definition at line 228 of file RefToBaseProd.h.

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

228  :
229  product_(handle.id(), handle.product(), 0, false) {
230  std::vector<void const*> pointers;
231  FillViewHelperVector helpers;
232  fillView(* handle, handle.id(), pointers, helpers);
233  product_.setProductPtr(new View<T>(pointers, helpers,0));
234  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:51
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers)
tuple handle
Definition: patZpeak.py:22
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
template<typename T>
edm::RefToBaseProd< T >::RefToBaseProd ( const RefToBaseProd< T > &  ref)
inline

Definition at line 113 of file RefToBaseProd.h.

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

113  :
114  product_(ref.product_) {
115  if(product_.productPtr()) {
116  product_.setProductPtr(ref.viewPtr() ? (new View<T>(* ref)) : 0);
117  }
118  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:51
void const * productPtr() const
Definition: RefCore.h:45
template<typename T >
template<typename C >
edm::RefToBaseProd< T >::RefToBaseProd ( const RefProd< C > &  ref)
inlineexplicit

Definition at line 205 of file RefToBaseProd.h.

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

205  :
206  product_(ref.refCore()) {
207  std::vector<void const*> pointers;
208  FillViewHelperVector helpers;
209  fillView(* ref.product(), ref.id(), pointers, helpers);
210  product_.setProductPtr(new View<T>(pointers, helpers, ref.refCore().productGetter()));
211  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:51
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers)
RefCore const & refCore() const
Definition: RefProd.h:123
EDProductGetter const * productGetter() const
Definition: RefCore.h:77
product_type const * product() const
Definition: RefProd.h:119
ProductID id() const
Accessor for product ID.
Definition: RefProd.h:137
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
template<typename T>
edm::RefToBaseProd< T >::RefToBaseProd ( ProductID const &  id,
EDProductGetter const *  getter 
)
inline

Definition at line 238 of file RefToBaseProd.h.

238  :
239  product_(id, nullptr, getter, false) { }
template<typename T>
edm::RefToBaseProd< T >::~RefToBaseProd ( )
inline

Destructor.

Definition at line 47 of file RefToBaseProd.h.

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

Member Function Documentation

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

Definition at line 90 of file RefToBaseProd.h.

91 :
92  //NOTE: Access to RefCore should be private since we modify the use of productPtr
template<typename T>
product_type const* edm::RefToBaseProd< T >::get ( ) const
inline
template<typename T>
bool edm::RefToBaseProd< T >::hasCache ( ) const
inline

Checks if product is in memory.

Definition at line 83 of file RefToBaseProd.h.

83 {return product_.productPtr() != 0;}
void const * productPtr() const
Definition: RefCore.h:45
template<typename T>
ProductID edm::RefToBaseProd< T >::id ( ) const
inline

Accessor for product ID.

Definition at line 77 of file RefToBaseProd.h.

77 {return product_.id();}
ProductID id() const
Definition: RefCore.h:42
template<typename T>
bool edm::RefToBaseProd< T >::isNonnull ( ) const
inline

Checks for non-null.

Definition at line 71 of file RefToBaseProd.h.

Referenced by edm::RefToBaseProd< reco::GsfElectronCore >::isNull().

71 { return product_.isNonnull(); }
bool isNonnull() const
Definition: RefCore.h:67
template<typename T>
bool edm::RefToBaseProd< T >::isNull ( ) const
inline
template<typename T>
bool edm::RefToBaseProd< T >::operator! ( ) const
inline

Checks for null.

Definition at line 74 of file RefToBaseProd.h.

74 {return isNull(); }
bool isNull() const
Checks for null.
Definition: RefToBaseProd.h:68
template<typename T >
View< T > const & edm::RefToBaseProd< T >::operator* ( ) const
inline

Dereference operator.

Definition at line 131 of file RefToBaseProd.h.

131  {
132  return * operator->();
133  }
product_type const * operator->() const
Member dereference operator.
template<typename T >
View< T > const * edm::RefToBaseProd< T >::operator-> ( ) const
inline

Member dereference operator.

Definition at line 139 of file RefToBaseProd.h.

References edm::WrapperBase::fillView(), edm::ProductID::id(), edm::errors::InvalidReference, parseEventContent::prod, edm::Exception::throwThis(), and tmp.

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

139  {
140  //Another thread might change the value returned so just get it once
141  auto getter = product_.productGetter();
142  if(getter != nullptr) {
143  if(product_.isNull()) {
145  "attempting get view from a null RefToBaseProd.\n");
146  }
147  ProductID tId = product_.id();
148  std::vector<void const*> pointers;
149  FillViewHelperVector helpers;
150  WrapperBase const* prod = getter->getIt(tId);
151  if(prod == nullptr) {
153  "attempting to get view from an unavailable RefToBaseProd.");
154  }
155  prod->fillView(tId, pointers, helpers);
156  std::unique_ptr<View<T>> tmp{ new View<T>(pointers, helpers, getter) };
158  tmp.release();
159  }
160  }
161  return viewPtr();
162  }
View< T > const * viewPtr() const
Definition: RefToBaseProd.h:97
bool tryToSetProductPtrForFirstTime(void const *prodPtr) const
Definition: RefCore.h:59
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
bool isNull() const
Definition: RefCore.h:64
EDProductGetter const * productGetter() const
Definition: RefCore.h:77
ProductID id() const
Definition: RefCore.h:42
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
template<typename T>
RefToBaseProd< T > & edm::RefToBaseProd< T >::operator= ( const RefToBaseProd< T > &  other)
inline

Definition at line 122 of file RefToBaseProd.h.

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

122  {
123  RefToBaseProd<T> temp(other);
124  this->swap(temp);
125  return *this;
126  }
void swap(RefToBaseProd< T > &)
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 63 of file RefToBaseProd.h.

63  {
64  return isNull() ? 0 : this->operator->();
65  }
product_type const * operator->() const
Member dereference operator.
bool isNull() const
Checks for null.
Definition: RefToBaseProd.h:68
template<typename T>
EDProductGetter const* edm::RefToBaseProd< T >::productGetter ( ) const
inline

Accessor for product getter.

Definition at line 80 of file RefToBaseProd.h.

80 {return product_.productGetter();}
EDProductGetter const * productGetter() const
Definition: RefCore.h:77
template<typename T>
RefCore const& edm::RefToBaseProd< T >::refCore ( ) const
inlineprivate

Definition at line 93 of file RefToBaseProd.h.

93  {
94  return product_;
95  }
template<typename T>
void edm::RefToBaseProd< T >::swap ( RefToBaseProd< T > &  other)
inline

Definition at line 167 of file RefToBaseProd.h.

References edm::swap().

Referenced by edm::swap().

167  {
168  edm::swap(product_, other.product_);
169  }
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:116
template<typename T>
View<T> const* edm::RefToBaseProd< T >::viewPtr ( ) const
inlineprivate

Definition at line 97 of file RefToBaseProd.h.

Referenced by edm::RefToBaseProd< reco::GsfElectronCore >::~RefToBaseProd().

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

Member Data Documentation

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