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" 125 BOOST_MPL_HAS_XXX_TRAIT_DEF(key_compare)
128 typename
boost::enable_if<has_key_compare<C>,
bool>::
type 130 typedef typename C::key_compare comparison_functor;
131 return comparison_functor()(lhs, rhs);
134 template <
typename C,
typename K>
135 typename boost::disable_if<has_key_compare<C>,
bool>
::type 143 template<
typename C,
typename T,
typename F>
149 template <
typename C,
167 typedef typename boost::binary_traits<F>::second_argument_type
argument_type;
188 Ref(
C const* product, key_type itemKey,
bool setNow=
true);
209 Ref(
ProductID const& iProductID, T
const* item, key_type itemKey,
C const* ) :
217 Ref(
ProductID const& iProductID, T
const* item, key_type itemKey,
bool transient) :
244 T
const*
get()
const {
302 #define REF_FOR_VECTOR_ARGS std::vector<E>,typename refhelper::ValueTrait<std::vector<E> >::value,typename refhelper::FindTrait<std::vector<E>, typename refhelper::ValueTrait<std::vector<E> >::value>::value 304 template <
typename E>
314 friend class
RefVector<RefVector<std::vector<E>, T, F>, T, VF>;
315 friend class
RefVector<RefVector<std::vector<E>, T, F>, T, VBF>;
324 typedef typename boost::binary_traits<F>::second_argument_type
argument_type;
375 product_(iProductID, item, 0, transient, itemKey)
401 T
const*
get()
const {
462 template <
typename C,
typename T,
typename F>
467 refitem::findRefItem<C, T, F, key_type>(
product_, handle.
product(), itemKey);
471 template <
typename E>
476 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
product_.toRefCore(),
482 template <
typename C,
typename T,
typename F>
487 refitem::findRefItem<C, T, F, key_type>(
product_, handle.
product(), itemKey);
491 template <
typename E>
496 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
product_.toRefCore(),
508 template <
typename C,
typename T,
typename F>
512 if(iProduct !=
nullptr) {
513 refitem::findRefItem<C, T, F, key_type>(
product_, iProduct, itemKey);
517 template <
typename E>
521 if(iProduct !=
nullptr) {
522 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
product_.toRefCore(), iProduct, itemKey);
528 template <
typename C,
typename T,
typename F>
532 if(itemKey == key_traits<key_type>::value)
return;
533 refitem::findRefItem<C, T, F, key_type>(
product_, handle.
product(), itemKey);
536 template <
typename E>
540 if(itemKey == key_traits<key_type>::value)
return;
541 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
product_.toRefCore(),
547 template <
typename C,
typename T,
typename F>
553 if(refProd.
refCore().productPtr() !=
nullptr && itemKey != key_traits<key_type>::value) {
554 refitem::findRefItem<C, T, F, key_type>(
product_,
560 template <
typename E>
563 product_(refProd.id(),
nullptr, refProd.refCore().productGetter(), refProd.refCore().isTransient(), itemKey) {
565 if(refProd.refCore().productPtr() !=
nullptr && itemKey != key_traits<key_type>::value) {
566 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
568 static_cast<product_type const*
>(refProd.refCore().productPtr()),
573 template <
typename C,
typename T,
typename F>
583 template <
typename E>
590 return isThinnedAvailable<std::vector<E> >(
product_.toRefCore(),
key());
594 template <
typename C,
typename T,
typename F>
600 template <
typename E>
604 return *getRefPtr<REF_FOR_VECTOR_ARGS>(
product_.toRefCore(),
key());
608 template <
typename C,
typename T,
typename F>
614 template <
typename E>
618 return getRefPtr<REF_FOR_VECTOR_ARGS>(
product_.toRefCore(),
key());
621 template <
typename C,
typename T,
typename F>
625 return lhs.key() == rhs.key() && lhs.refCore() == rhs.refCore() ;
628 template <
typename C,
typename T,
typename F>
632 return !(lhs == rhs);
635 template <
typename C,
typename T,
typename F>
641 return (lhs.refCore() == rhs.refCore() ? compare_key<C>(lhs.key(), rhs.key()) : lhs.refCore() < rhs.refCore());
refhelper::ValueTrait< std::vector< E > >::value T
EDProductGetter const * mustBeNonZero(EDProductGetter const *prodGetter, std::string refType, ProductID const &productID)
edm::Ref< Container > Ref
bool isNonnull() const
Checks for non-null.
void checkTypeAtCompileTime(C const *)
T const * product() const
boost::enable_if< has_key_compare< C >, bool >::type compare_key(K const &lhs, K const &rhs)
refhelper::FindRefVectorUsingAdvance< RefVector< std::vector< E >, T, F > > VF
Ref(ProductID const &iProductID, T const *item, key_type itemKey, product_type const *)
Constructor for use in the various X::fillView(...) functions.
boost::binary_traits< F >::second_argument_type argument_type
void checkTypeAtCompileTime(product_type const *)
bool isTransient() const
Checks if this ref is transient (i.e. not persistable).
bool hasProductCache() const
Returns true if container referenced by the Ref has been cached.
RefCore const & refCore() const
RefCore const & refCore() const
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
Ref(ProductID const &iProductID, T const *item, key_type itemKey, bool transient)
Ref()
Default constructor needed for reading from persistent store. Not for direct use. ...
key_type key() const
Accessor for product key.
bool isNull() const
Checks for null.
#define REF_FOR_VECTOR_ARGS
#define CMS_CLASS_VERSION(_version_)
Ref(ProductID const &iId)
ProductID id() const
Accessor for product ID.
value_type const element_type
bool isTransient() const
Checks if this ref is transient (i.e. not persistable).
bool operator!() const
Checks for null.
Ref(ProductID const &productID, key_type itemKey, EDProductGetter const *prodGetter)
std::vector< E > product_type
for export
EDProductGetter const * productGetter() const
Accessor for product getter.
bool isNonnull() const
Checks for non-null.
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
void const * productPtr() const
static key_type invalidKey()
bool hasProductCache() const
Returns true if container referenced by the Ref has been cached.
Ref(ProductID const &iProductID, T const *item, key_type itemKey)
ProductID id() const
Accessor for product ID.
RefCore const & refCore() const
def template(fileName, svg, replaceme="REPLACEME")
refhelper::FindRefVectorUsingAdvance< RefToBaseVector< T > > VBF
bool isNull() const
Checks for null.
refhelper::FindTrait< std::vector< E >, typename refhelper::ValueTrait< std::vector< E > >::value >::value F
refhelper::FindRefVectorUsingAdvance< RefVector< C, T, F > > VF
T const * product() const
refhelper::ValueTrait< std::vector< E > >::value value_type
refhelper::FindRefVectorUsingAdvance< RefToBaseVector< T > > VBF
T const * product() const
boost::binary_traits< F >::second_argument_type argument_type
Ref(ProductID const &iProductID, T const *item, key_type itemKey, bool transient)
Ref(ProductID const &iId)
Ref(ProductID const &iProductID, T const *item, key_type itemKey)
EDProductGetter const * productGetter() const
bool operator!() const
Checks for null.
Ref(ProductID const &productID, key_type itemKey, EDProductGetter const *prodGetter)
Ref()
Default constructor needed for reading from persistent store. Not for direct use. ...
RefCoreWithIndex product_
EDProductGetter const * productGetter() const
Accessor for product getter.
T const * operator->() const
Member dereference operator.
FindUsingAdvance< C, T > value
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Ref(ProductID const &iProductID, T const *item, key_type itemKey, C const *)
Constructor for use in the various X::fillView(...) functions.
edm::RefVector< Container > RefVector
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
T const & operator*() const
Dereference operator.
key_type key() const
Accessor for product key.