1 #ifndef DataFormats_Common_Ref_h
2 #define DataFormats_Common_Ref_h
117 #include "boost/functional.hpp"
118 #include "boost/call_traits.hpp"
119 #include "boost/type_traits.hpp"
120 #include "boost/mpl/has_xxx.hpp"
121 #include "boost/utility/enable_if.hpp"
123 BOOST_MPL_HAS_XXX_TRAIT_DEF(key_compare)
126 typename boost::enable_if<has_key_compare<C>,
bool>::
type
128 typedef typename C::key_compare comparison_functor;
129 return comparison_functor()(lhs, rhs);
132 template <
typename C,
typename K>
133 typename boost::disable_if<has_key_compare<C>,
bool>
::type
141 template<
typename C,
typename T,
typename F>
147 template <
typename C,
168 typedef typename boost::binary_traits<F>::second_argument_type
argument_type;
241 T const*
get()
const {
307 template <
typename C,
typename T,
typename F>
310 product_(handle.id(), handle.product(), 0,
false), index_(itemKey){
312 assert(
key() == itemKey);
318 template <
typename C,
typename T,
typename F>
321 product_(handle.id(), handle.product(), 0,
false), index_(itemKey) {
323 assert(
key() == itemKey);
329 template <
typename C,
typename T,
typename F>
332 product_(refvector.id(), refvector.product(), 0, refvector.isTransient()), index_(itemKey) {
334 assert(
key() == itemKey);
346 template <
typename C,
typename T,
typename F>
353 if (iSetNow && iProduct != 0) {getPtr_<C, T, F>(
product_,
index_);}
358 template <
typename C,
typename T,
typename F>
361 product_(handle.id(), handle.product(), 0,
true), index_(itemKey) {
363 assert(
key() == itemKey);
369 template <
typename C,
typename T,
typename F>
372 product_(refProd.id(), refProd.refCore().productPtr(), refProd.refCore().productGetter(), refProd.refCore().isTransient()), index_(itemKey) {
373 assert(
index() == itemKey);
378 template <
typename C,
typename T,
typename F>
386 template <
typename C,
typename T,
typename F>
390 return *getPtr<C, T, F>(product_, index_);
394 template <
typename C,
typename T,
typename F>
398 return getPtr<C, T, F>(product_, index_);
401 template <
typename C,
typename T,
typename F>
405 return lhs.key() == rhs.key() && lhs.refCore() == rhs.refCore() ;
408 template <
typename C,
typename T,
typename F>
412 return !(lhs == rhs);
415 template <
typename C,
typename T,
typename F>
421 return (lhs.refCore() == rhs.refCore() ? compare_key<C>(lhs.key(), rhs.key()) : lhs.refCore() < rhs.refCore());
432 namespace reftobase {
434 template <
typename T,
typename REF>
437 typedef RefVector<
typename REF::product_type,
439 typename REF::finder_type> REFV;
443 typedef RefVector<
typename REF::product_type,
445 typename REF::finder_type> REFV;
450 template<
typename T1,
typename C,
typename T,
typename F>
455 template <
typename REF>
458 typedef RefVector<
typename REF::product_type,
460 typename REF::finder_type> REFV;
465 template<
typename C,
typename T,
typename F>
EDProductGetter const * mustBeNonZero(EDProductGetter const *prodGetter, std::string refType, ProductID const &productID)
RefHolderToVector< T1, Ref< C, T, F > > type
edm::Ref< Container > Ref
T const * operator->() const
Member dereference operator.
static std::auto_ptr< BaseVectorHolder< T > > makeVectorHolder()
C const * product() const
Accessor for product collection.
T const * product() const
boost::enable_if< has_key_compare< C >, bool >::type compare_key(K const &lhs, K const &rhs)
void checkTypeAtCompileTime(C const *)
bool operator!() const
Checks for null.
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
T const & operator*() const
Dereference operator.
#define CMS_CLASS_VERSION(_version_)
static std::auto_ptr< RefVectorHolderBase > makeVectorHolder()
bool isNonnull() const
Checks for non-null.
bool isNull() const
Checks for null.
RefRefHolderToRefVector< Ref< C, T, F > > type
boost::binary_traits< F >::second_argument_type argument_type
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
void const * productPtr() const
Ref(ProductID const &productID, key_type itemKey, EDProductGetter const *prodGetter)
RefCore const & refCore() const
C product_type
etc. etc.: more nesting levels could be supported ...
Container::value_type value_type
Ref(ProductID const &iId)
refhelper::FindRefVectorUsingAdvance< RefVector< C, T, F > > VF
Ref()
Default constructor needed for reading from persistent store. Not for direct use. ...
refhelper::FindRefVectorUsingAdvance< RefToBaseVector< T > > VBF
Ref(ProductID const &iProductID, T const *, key_type iItemKey, C const *iProduct)
Constructor for use in the various X::fillView(...) functions.
T const * product() const
key_type key() const
Accessor for product key.
T const * product() const
EDProductGetter const * productGetter() const
bool hasProductCache() const
Returns true if container referenced by the Ref has been cached.
ProductID id() const
Accessor for product ID.
EDProductGetter const * productGetter() const
Accessor for product getter.
static std::auto_ptr< RefVectorHolderBase > makeVectorBaseHolder()
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
C const * product() const
Accessor for product collection.
edm::RefVector< Container > RefVector
bool isTransient() const
Checks if this ref is transient (i.e. not persistable).