test
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 61 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 213 of file RefToBaseProd.h.

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

213  :
214  product_(handle.id(), handle.product(), 0, false) {
215  std::vector<void const*> pointers;
216  FillViewHelperVector helpers;
217  fillView(* handle, handle.id(), pointers, helpers);
218  product_.setProductPtr(new View<T>(pointers, helpers,0));
219  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:58
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:58
template<typename T >
template<typename C >
edm::RefToBaseProd< T >::RefToBaseProd ( OrphanHandle< C > const &  handle)
inlineexplicit

Definition at line 224 of file RefToBaseProd.h.

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

224  :
225  product_(handle.id(), handle.product(), 0, false) {
226  std::vector<void const*> pointers;
227  FillViewHelperVector helpers;
228  fillView(* handle, handle.id(), pointers, helpers);
229  product_.setProductPtr(new View<T>(pointers, helpers,0));
230  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:58
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:58
void const * productPtr() const
Definition: RefCore.h:52
template<typename T >
template<typename C >
edm::RefToBaseProd< T >::RefToBaseProd ( const RefProd< C > &  ref)
inlineexplicit

Definition at line 202 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().

202  :
203  product_(ref.refCore()) {
204  std::vector<void const*> pointers;
205  FillViewHelperVector helpers;
206  fillView(* ref.product(), ref.id(), pointers, helpers);
207  product_.setProductPtr(new View<T>(pointers, helpers, ref.refCore().productGetter()));
208  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:58
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:84
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 234 of file RefToBaseProd.h.

234  :
235  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:52
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:49
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:74
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 138 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().

138  {
139  //Another thread might change the value returned so just get it once
140  auto getter = product_.productGetter();
141  if(getter != nullptr) {
142  if(product_.isNull()) {
144  "attempting get view from a null RefToBaseProd.\n");
145  }
146  ProductID tId = product_.id();
147  std::vector<void const*> pointers;
148  FillViewHelperVector helpers;
149  WrapperBase const* prod = getter->getIt(tId);
150  if(prod == nullptr) {
152  "attempting to get view from an unavailable RefToBaseProd.");
153  }
154  prod->fillView(tId, pointers, helpers);
155  std::unique_ptr<View<T>> tmp{ new View<T>(pointers, helpers, getter) };
157  tmp.release();
158  }
159  }
160  return viewPtr();
161  }
View< T > const * viewPtr() const
Definition: RefToBaseProd.h:97
bool tryToSetProductPtrForFirstTime(void const *prodPtr) const
Definition: RefCore.h:66
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:71
EDProductGetter const * productGetter() const
Definition: RefCore.h:84
ProductID id() const
Definition: RefCore.h:49
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:84
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 165 of file RefToBaseProd.h.

References edm::swap().

Referenced by edm::swap().

165  {
166  edm::swap(product_, other.product_);
167  }
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:52

Member Data Documentation

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