CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 65 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 187 of file RefToBaseProd.h.

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

188  : product_(handle.id(), handle.product(), nullptr, false) {
189  std::vector<void const*> pointers;
190  FillViewHelperVector helpers;
191  fillView(*handle, handle.id(), pointers, helpers);
192  product_.setProductPtr(new View<T>(pointers, helpers, nullptr));
193  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:57
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 97 of file RefToBaseProd.h.

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

98  : product_(handle.id(), nullptr, nullptr, false) {
99  product_.setProductPtr(new View<T>(*handle));
100  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:57
template<typename T >
template<typename C >
edm::RefToBaseProd< T >::RefToBaseProd ( OrphanHandle< C > const &  handle)
inlineexplicit

Definition at line 197 of file RefToBaseProd.h.

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

198  : product_(handle.id(), handle.product(), nullptr, false) {
199  std::vector<void const*> pointers;
200  FillViewHelperVector helpers;
201  fillView(*handle, handle.id(), pointers, helpers);
202  product_.setProductPtr(new View<T>(pointers, helpers, nullptr));
203  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:57
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:23
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
template<typename T >
edm::RefToBaseProd< T >::RefToBaseProd ( const RefToBaseProd< T > &  ref)
inline

Definition at line 103 of file RefToBaseProd.h.

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

103  : product_(ref.product_) {
104  if (product_.productPtr()) {
105  product_.setProductPtr(ref.viewPtr() ? (new View<T>(*ref)) : nullptr);
106  }
107  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:57
void const * productPtr() const
Definition: RefCore.h:51
template<typename T >
template<typename C >
edm::RefToBaseProd< T >::RefToBaseProd ( const RefProd< C > &  ref)
inlineexplicit

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

178  : product_(ref.refCore()) {
179  std::vector<void const*> pointers;
180  FillViewHelperVector helpers;
181  fillView(*ref.product(), ref.id(), pointers, helpers);
182  product_.setProductPtr(new View<T>(pointers, helpers, ref.refCore().productGetter()));
183  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:57
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:112
EDProductGetter const * productGetter() const
Definition: RefCore.h:81
product_type const * product() const
Definition: RefProd.h:110
ProductID id() const
Accessor for product ID.
Definition: RefProd.h:124
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 206 of file RefToBaseProd.h.

207  : product_(id, nullptr, getter, false) {}
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:91

Member Function Documentation

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
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 79 of file RefToBaseProd.h.

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

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

Accessor for product ID.

Definition at line 73 of file RefToBaseProd.h.

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

73 { return product_.id(); }
ProductID id() const
Definition: RefCore.h:48
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
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
template<typename T>
bool edm::RefToBaseProd< T >::operator! ( ) const
inline

Checks for null.

Definition at line 70 of file RefToBaseProd.h.

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

70 { return isNull(); }
bool isNull() const
Checks for null.
Definition: RefToBaseProd.h:64
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  }
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 124 of file RefToBaseProd.h.

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

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

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;
133  FillViewHelperVector helpers;
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  }
View< T > const * viewPtr() const
Definition: RefToBaseProd.h:91
bool tryToSetProductPtrForFirstTime(void const *prodPtr) const
Definition: RefCore.h:63
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:83
bool isNull() const
Definition: RefCore.h:68
EDProductGetter const * productGetter() const
Definition: RefCore.h:81
ProductID id() const
Definition: RefCore.h:48
tmp
align.sh
Definition: createJobs.py:716
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 110 of file RefToBaseProd.h.

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

110  {
111  RefToBaseProd<T> temp(other);
112  this->swap(temp);
113  return *this;
114  }
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 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
template<typename T>
EDProductGetter const* edm::RefToBaseProd< T >::productGetter ( ) const
inline

Accessor for product getter.

Definition at line 76 of file RefToBaseProd.h.

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

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

Definition at line 89 of file RefToBaseProd.h.

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

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

Definition at line 148 of file RefToBaseProd.h.

References edm::swap().

Referenced by edm::swap().

148  {
149  edm::swap(product_, other.product_);
150  }
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
template<typename T>
View<T> const* edm::RefToBaseProd< T >::viewPtr ( ) const
inlineprivate

Definition at line 91 of file RefToBaseProd.h.

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

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

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

Member Data Documentation

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