CMS 3D CMS Logo

edm::Wrapper< T > Class Template Reference

#include <DataFormats/Common/interface/Wrapper.h>

Inheritance diagram for edm::Wrapper< T >:

edm::EDProduct

List of all members.

Public Types

typedef T value_type
typedef T wrapped_type

Public Member Functions

T const * operator-> () const
T const * product () const
 Wrapper (T *)
 REFLEX must call the following constructor the constructor takes ownership of T*.
 Wrapper (std::auto_ptr< T > ptr)
 Wrapper ()
virtual ~Wrapper ()

Static Public Member Functions

static const std::type_info & productTypeInfo ()
static const std::type_info & typeInfo ()

Private Member Functions

virtual void do_fillPtrVector (const std::type_info &iToType, const std::vector< unsigned long > &iIndicies, std::vector< void const * > &oPtr) const
virtual void do_fillView (ProductID const &id, std::vector< void const * > &pointers, helper_vector_ptr &helpers) const
virtual void do_setPtr (const std::type_info &iToType, unsigned long iIndex, void const *&oPtr) const
virtual bool hasIsProductEqual_ ()
virtual bool isMergeable_ ()
virtual bool isPresent_ () const
virtual bool isProductEqual_ (EDProduct *newProduct)
virtual bool mergeProduct_ (EDProduct *newProduct)
Wrapper< T > & operator= (Wrapper< T > const &)
 Wrapper (Wrapper< T > const &rh)

Private Attributes

obj
bool present


Detailed Description

template<class T>
class edm::Wrapper< T >

Definition at line 30 of file Wrapper.h.


Member Typedef Documentation

template<class T>
typedef T edm::Wrapper< T >::value_type

Definition at line 32 of file Wrapper.h.

template<class T>
typedef T edm::Wrapper< T >::wrapped_type

Definition at line 33 of file Wrapper.h.


Constructor & Destructor Documentation

template<class T>
edm::Wrapper< T >::Wrapper (  )  [inline]

Definition at line 34 of file Wrapper.h.

00034 : EDProduct(), present(false), obj() {}

template<class T>
edm::Wrapper< T >::Wrapper ( std::auto_ptr< T >  ptr  )  [inline, explicit]

Definition at line 296 of file Wrapper.h.

References edm::Wrapper< T >::obj, edm::Wrapper< T >::present, and value.

00296                                         :
00297     EDProduct(), 
00298     present(ptr.get() != 0),
00299     obj()
00300   { 
00301     if (present) {
00302       // The following will call swap if T has such a function,
00303       // and use assignment if T has no such function.
00304       typename boost::mpl::if_c<detail::has_swap_function<T>::value, 
00305         DoSwap<T>, 
00306         DoAssign<T> >::type swap_or_assign;
00307       swap_or_assign(obj, *ptr);        
00308     }
00309   }

template<class T>
virtual edm::Wrapper< T >::~Wrapper (  )  [inline, virtual]

Definition at line 36 of file Wrapper.h.

00036 {}

template<class T>
edm::Wrapper< T >::Wrapper ( T *  ptr  )  [inline]

REFLEX must call the following constructor the constructor takes ownership of T*.

Definition at line 312 of file Wrapper.h.

References edm::Wrapper< T >::obj, edm::Wrapper< T >::present, pyDBSRunClass::temp, and value.

00312                             :
00313   EDProduct(), 
00314   present(ptr != 0),
00315   obj()
00316   { 
00317      std::auto_ptr<T> temp(ptr);
00318      if (present) {
00319         // The following will call swap if T has such a function,
00320         // and use assignment if T has no such function.
00321         typename boost::mpl::if_c<detail::has_swap_function<T>::value, 
00322          DoSwap<T>, 
00323         DoAssign<T> >::type swap_or_assign;
00324         swap_or_assign(obj, *ptr);      
00325      }
00326      
00327   }
   

template<class T>
edm::Wrapper< T >::Wrapper ( Wrapper< T > const &  rh  )  [private]


Member Function Documentation

template<typename T>
void edm::Wrapper< T >::do_fillPtrVector ( const std::type_info &  iToType,
const std::vector< unsigned long > &  iIndicies,
std::vector< void const * > &  oPtr 
) const [inline, private, virtual]

Implements edm::EDProduct.

Definition at line 170 of file Wrapper.h.

References value.

00173   {
00174     typename boost::mpl::if_c<has_setPtr<T>::value,
00175     DoSetPtr<T>,
00176     DoNotSetPtr<T> >::type maybe_filler;
00177     maybe_filler(this->obj,iToType,iIndicies,oPtr);
00178   }

template<typename T>
void edm::Wrapper< T >::do_fillView ( ProductID const &  id,
std::vector< void const * > &  pointers,
helper_vector_ptr helpers 
) const [inline, private, virtual]

Implements edm::EDProduct.

Definition at line 108 of file Wrapper.h.

References edm::Wrapper< T >::obj, and value.

00111   {
00112     typename boost::mpl::if_c<has_fillView<T>::value,
00113     DoFillView<T>,
00114     DoNotFillView<T> >::type maybe_filler;
00115     maybe_filler(obj, id, pointers, helpers);
00116   }

template<typename T>
void edm::Wrapper< T >::do_setPtr ( const std::type_info &  iToType,
unsigned long  iIndex,
void const *&  oPtr 
) const [inline, private, virtual]

Implements edm::EDProduct.

Definition at line 159 of file Wrapper.h.

References value.

00162   {
00163     typename boost::mpl::if_c<has_setPtr<T>::value,
00164     DoSetPtr<T>,
00165     DoNotSetPtr<T> >::type maybe_filler;
00166     maybe_filler(this->obj,iToType,iIndex,oPtr);
00167   }

template<class T>
bool edm::Wrapper< T >::hasIsProductEqual_ (  )  [inline, private, virtual]

Reimplemented from edm::EDProduct.

Definition at line 351 of file Wrapper.h.

References edm::Wrapper< T >::obj, and value.

00352   { 
00353     typename boost::mpl::if_c<detail::has_isProductEqual_function<T>::value, 
00354       DoHasIsProductEqual<T>, 
00355       DoNotHasIsProductEqual<T> >::type has_is_equal;
00356     return has_is_equal(obj);
00357   }

template<class T>
bool edm::Wrapper< T >::isMergeable_ (  )  [inline, private, virtual]

Reimplemented from edm::EDProduct.

Definition at line 331 of file Wrapper.h.

References edm::Wrapper< T >::obj, and value.

00332   { 
00333     typename boost::mpl::if_c<detail::has_mergeProduct_function<T>::value, 
00334       IsMergeable<T>, 
00335       IsNotMergeable<T> >::type is_mergeable;
00336     return is_mergeable(obj);
00337   }

template<class T>
virtual bool edm::Wrapper< T >::isPresent_ (  )  const [inline, private, virtual]

Reimplemented from edm::EDProduct.

Definition at line 49 of file Wrapper.h.

References edm::Wrapper< T >::present.

00049 {return present;}

template<class T>
bool edm::Wrapper< T >::isProductEqual_ ( EDProduct newProduct  )  [inline, private, virtual]

Reimplemented from edm::EDProduct.

Definition at line 360 of file Wrapper.h.

References edm::Wrapper< T >::obj, and value.

00361   { 
00362     Wrapper<T>* wrappedNewProduct = dynamic_cast<Wrapper<T>* >(newProduct);
00363     if (wrappedNewProduct == 0) return false;
00364     typename boost::mpl::if_c<detail::has_isProductEqual_function<T>::value, 
00365       DoIsProductEqual<T>, 
00366       DoNotIsProductEqual<T> >::type is_equal;
00367     return is_equal(obj, wrappedNewProduct->obj);
00368   }

template<class T>
bool edm::Wrapper< T >::mergeProduct_ ( EDProduct newProduct  )  [inline, private, virtual]

Reimplemented from edm::EDProduct.

Definition at line 340 of file Wrapper.h.

References edm::Wrapper< T >::obj, and value.

00341   { 
00342     Wrapper<T>* wrappedNewProduct = dynamic_cast<Wrapper<T>* >(newProduct);
00343     if (wrappedNewProduct == 0) return false;
00344     typename boost::mpl::if_c<detail::has_mergeProduct_function<T>::value, 
00345       DoMergeProduct<T>, 
00346       DoNotMergeProduct<T> >::type merge_product;
00347     return merge_product(obj, wrappedNewProduct->obj);
00348   }

template<class T>
T const* edm::Wrapper< T >::operator-> (  )  const [inline]

Definition at line 38 of file Wrapper.h.

References edm::Wrapper< T >::product().

00038 {return product();}

template<class T>
Wrapper<T>& edm::Wrapper< T >::operator= ( Wrapper< T > const &   )  [private]

template<class T>
T const* edm::Wrapper< T >::product (  )  const [inline]

Definition at line 37 of file Wrapper.h.

References edm::Wrapper< T >::obj, and edm::Wrapper< T >::present.

Referenced by edm::convert_handle(), fwlite::Handle< T >::getByLabel(), edm::refcore::getProductPtr_(), edm::Wrapper< T >::operator->(), and edm::Event::put().

00037 {return (present ? &obj : 0);}

template<class T>
static const std::type_info& edm::Wrapper< T >::productTypeInfo (  )  [inline, static]

Definition at line 41 of file Wrapper.h.

00041 { return typeid(T);}

template<class T>
static const std::type_info& edm::Wrapper< T >::typeInfo (  )  [inline, static]

Definition at line 42 of file Wrapper.h.

Referenced by fwlite::Handle< T >::getBranchNameFor(), and fwlite::Handle< T >::getByLabel().

00042 { return typeid(Wrapper<T>);}


Member Data Documentation

template<class T>
T edm::Wrapper< T >::obj [private]

Definition at line 73 of file Wrapper.h.

Referenced by edm::Wrapper< T >::do_fillView(), edm::Wrapper< T >::hasIsProductEqual_(), edm::Wrapper< T >::isMergeable_(), edm::Wrapper< T >::isProductEqual_(), edm::Wrapper< T >::mergeProduct_(), edm::Wrapper< T >::product(), edm::helpers::PtrSetter< T >::set(), and edm::Wrapper< T >::Wrapper().

template<class T>
bool edm::Wrapper< T >::present [private]

Definition at line 71 of file Wrapper.h.

Referenced by edm::Wrapper< T >::isPresent_(), edm::Wrapper< T >::product(), and edm::Wrapper< T >::Wrapper().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:44:49 2009 for CMSSW by  doxygen 1.5.4