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<class HandleC >
 RefToBaseProd (HandleC const &handle)
 General purpose constructor from handle-like object. More...
 
 RefToBaseProd (Handle< View< T > > const &handle)
 
template<typename C , typename F >
 RefToBaseProd (Ref< C, T, F > const &ref)
 Constructor from Ref<C,T,F> More...
 
 RefToBaseProd (RefToBase< T > const &ref)
 Constructor from RefToBase. More...
 
 RefToBaseProd (const View< T > &)
 
 RefToBaseProd (const RefToBaseProd< T > &)
 
template<typename C >
 RefToBaseProd (const RefProd< C > &)
 
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 62 of file RefToBase.h.

Member Typedef Documentation

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

Definition at line 24 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 27 of file RefToBaseProd.h.

27 : product_(){}
template<typename T >
template<class HandleC >
edm::RefToBaseProd< T >::RefToBaseProd ( HandleC const &  handle)
inlineexplicit

General purpose constructor from handle-like object.

Definition at line 244 of file RefToBaseProd.h.

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

244  :
245  product_(handle.id(), handle.product(), 0, false) {
246  std::vector<void const*> pointers;
247  typedef typename refhelper::RefToBaseProdTrait<typename HandleC::element_type>::ref_vector_type ref_vector;
248  typedef reftobase::RefVectorHolder<ref_vector> holder_type;
249  helper_vector_ptr helpers(new holder_type);
250  detail::reallyFillView(* handle, handle.id(), pointers, * helpers);
251  product_.setProductPtr(new View<T>(pointers, helpers));
252  }
boost::shared_ptr< reftobase::RefVectorHolderBase > helper_vector_ptr
Definition: EDProductfwd.h:46
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:34
void reallyFillView(COLLECTION const &coll, ProductID const &id, std::vector< void const * > &ptrs, helper_vector &helpers)
Definition: FillView.h:49
tuple handle
Definition: patZpeak.py:22
template<typename T >
edm::RefToBaseProd< T >::RefToBaseProd ( Handle< View< T > > const &  handle)
inlineexplicit

Definition at line 132 of file RefToBaseProd.h.

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

132  :
133  product_(handle->id(), 0, handle->productGetter(), false){
134  product_.setProductPtr(new View<T>(* handle));
135  assert(handle->productGetter() == 0);
136  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:34
template<typename T >
template<typename C , typename F >
edm::RefToBaseProd< T >::RefToBaseProd ( Ref< C, T, F > const &  ref)
inlineexplicit

Constructor from Ref<C,T,F>

Constructor from Ref.

Definition at line 258 of file RefToBaseProd.h.

References edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::product(), edm::RefToBaseProd< T >::product_, edm::detail::reallyFillView(), and edm::RefCore::setProductPtr().

258  :
259  product_(ref.id(),
260  ref.hasProductCache() ? ref.product() : 0,
261  ref.productGetter(),
262  false) {
263  std::vector<void const*> pointers;
264  typedef typename refhelper::RefToBaseProdTrait<C>::ref_vector_type ref_vector;
265  typedef reftobase::RefVectorHolder<ref_vector> holder_type;
266  helper_vector_ptr helpers(new holder_type);
267  detail::reallyFillView(* ref.product(), ref.id(), pointers, * helpers);
268  product_.setProductPtr(new View<T>(pointers, helpers));
269  }
boost::shared_ptr< reftobase::RefVectorHolderBase > helper_vector_ptr
Definition: EDProductfwd.h:46
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:34
void reallyFillView(COLLECTION const &coll, ProductID const &id, std::vector< void const * > &ptrs, helper_vector &helpers)
Definition: FillView.h:49
template<typename T >
edm::RefToBaseProd< T >::RefToBaseProd ( RefToBase< T > const &  ref)
inlineexplicit

Constructor from RefToBase.

Definition at line 274 of file RefToBaseProd.h.

References edm::RefToBase< T >::holder_, edm::RefToBase< T >::id(), edm::RefToBase< T >::product(), edm::RefToBaseProd< T >::product_, and edm::RefCore::setProductPtr().

274  :
275  product_(ref.id(),
276  ref.hasProductCache() ? ref.product() : 0,
277  ref.productGetter(),
278  false) {
279  std::vector<void const*> pointers;
280  helper_vector_ptr helpers(ref.holder_->makeVectorBaseHolder().release());
281  helpers->reallyFillView(ref.product(), ref.id(), pointers);
282  product_.setProductPtr(new View<T>(pointers, helpers));
283  }
boost::shared_ptr< reftobase::RefVectorHolderBase > helper_vector_ptr
Definition: EDProductfwd.h:46
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:34
template<typename T >
edm::RefToBaseProd< T >::RefToBaseProd ( const View< T > &  view)
inlineexplicit

Definition at line 140 of file RefToBaseProd.h.

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

140  :
141  product_(view.id(), 0, view.productGetter(), false) {
142  product_.setProductPtr(new View<T>(view));
143  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:34
template<typename T >
edm::RefToBaseProd< T >::RefToBaseProd ( const RefToBaseProd< T > &  ref)
inline

Definition at line 147 of file RefToBaseProd.h.

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

147  :
148  product_(ref.product_) {
149  if(product_.productPtr()) {
150  product_.setProductPtr(ref.viewPtr() ? (new View<T>(* ref)) : 0);
151  }
152  }
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:34
void const * productPtr() const
Definition: RefCore.h:32
template<typename T >
template<typename C >
edm::RefToBaseProd< T >::RefToBaseProd ( const RefProd< C > &  ref)
inline

Definition at line 231 of file RefToBaseProd.h.

References edm::RefProd< T >::id(), edm::RefProd< T >::product(), edm::RefToBaseProd< T >::product_, edm::detail::reallyFillView(), and edm::RefCore::setProductPtr().

231  :
232  product_(ref.refCore()) {
233  std::vector<void const*> pointers;
234  typedef typename refhelper::RefToBaseProdTrait<C>::ref_vector_type ref_vector;
235  typedef reftobase::RefVectorHolder<ref_vector> holder_type;
236  helper_vector_ptr helpers(new holder_type);
237  detail::reallyFillView(* ref.product(), ref.id(), pointers, * helpers);
238  product_.setProductPtr(new View<T>(pointers, helpers));
239  }
boost::shared_ptr< reftobase::RefVectorHolderBase > helper_vector_ptr
Definition: EDProductfwd.h:46
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:34
void reallyFillView(COLLECTION const &coll, ProductID const &id, std::vector< void const * > &ptrs, helper_vector &helpers)
Definition: FillView.h:49
RefCore const & refCore() const
Definition: RefProd.h:126
product_type const * product() const
Definition: RefProd.h:122
ProductID id() const
Accessor for product ID.
Definition: RefProd.h:140
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

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 ( void  ) const
inline

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

Definition at line 57 of file RefToBaseProd.h.

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

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), and betterConfigParser.BetterConfigParser::getResultingSection().

57  {
58  return isNull() ? 0 : this->operator->();
59  }
product_type const * operator->() const
Member dereference operator.
bool isNull() const
Checks for null.
Definition: RefToBaseProd.h:68
template<typename T>
bool edm::RefToBaseProd< T >::hasCache ( ) const
inline

Checks if product is in memory.

Definition at line 83 of file RefToBaseProd.h.

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

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

Accessor for product ID.

Definition at line 77 of file RefToBaseProd.h.

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

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

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

Checks for non-null.

Definition at line 71 of file RefToBaseProd.h.

References edm::RefToBaseProd< T >::id(), and edm::ProductID::isValid().

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

71 {return id().isValid(); }
ProductID id() const
Accessor for product ID.
Definition: RefToBaseProd.h:77
bool isValid() const
Definition: ProductID.h:35
template<typename T>
bool edm::RefToBaseProd< T >::isNull ( ) const
inline

Checks for null.

Definition at line 68 of file RefToBaseProd.h.

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

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

68 {return !isNonnull(); }
bool isNonnull() const
Checks for non-null.
Definition: RefToBaseProd.h:71
template<typename T>
bool edm::RefToBaseProd< T >::operator! ( ) const
inline

Checks for null.

Definition at line 74 of file RefToBaseProd.h.

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

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

165  {
166  return * operator->();
167  }
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 172 of file RefToBaseProd.h.

References edm::WrapperHolder::fillView(), edm::ProductID::id(), edm::errors::InvalidReference, edm::WrapperHolder::isValid(), and edm::Exception::throwThis().

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

172  {
173  if(product_.productPtr() == 0) {
174  if(product_.isNull()) {
176  "attempting get view from a null RefToBaseProd.\n");
177  }
178  ProductID tId = product_.id();
179  std::vector<void const*> pointers;
180  helper_vector_ptr helpers;
181  WrapperHolder it = product_.productGetter()->getIt(tId);
182  if(!it.isValid()) {
184  "attempting to get view from an unavailable RefToBaseProd.");
185  }
186  it.fillView(tId, pointers, helpers);
187  product_.setProductPtr((new View<T>(pointers, helpers)));
188  }
189  return viewPtr();
190  }
View< T > const * viewPtr() const
Definition: RefToBaseProd.h:97
boost::shared_ptr< reftobase::RefVectorHolderBase > helper_vector_ptr
Definition: EDProductfwd.h:46
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:34
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
virtual WrapperHolder getIt(ProductID const &) const =0
void const * productPtr() const
Definition: RefCore.h:32
bool isNull() const
Definition: RefCore.h:40
EDProductGetter const * productGetter() const
Definition: RefCore.h:53
ProductID id() const
Definition: RefCore.h:29
template<typename T >
RefToBaseProd< T > & edm::RefToBaseProd< T >::operator= ( const RefToBaseProd< T > &  other)
inline

Definition at line 156 of file RefToBaseProd.h.

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

156  {
157  RefToBaseProd<T> temp(other);
158  this->swap(temp);
159  return *this;
160  }
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.

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

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.

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

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

Definition at line 93 of file RefToBaseProd.h.

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

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

Definition at line 194 of file RefToBaseProd.h.

References std::swap().

Referenced by edm::swap().

194  {
195  std::swap(product_, other.product_);
196  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
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  {
98  return reinterpret_cast<const View<T>*>(product_.productPtr());
99  }
void const * productPtr() const
Definition: RefCore.h:32

Member Data Documentation

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