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" 124 #include <type_traits> 126 BOOST_MPL_HAS_XXX_TRAIT_DEF(key_compare)
129 typename
boost::enable_if<has_key_compare<C>,
bool>::
type 131 typedef typename C::key_compare comparison_functor;
132 return comparison_functor()(lhs, rhs);
135 template <
typename C,
typename K>
136 typename boost::disable_if<has_key_compare<C>,
bool>
::type 144 template<
typename C,
typename T,
typename F>
150 template <
typename C,
168 typedef typename boost::binary_traits<F>::second_argument_type
argument_type;
189 Ref(
C const* product, key_type itemKey,
bool setNow=
true);
210 Ref(
ProductID const& iProductID, T
const* item, key_type itemKey,
C const* ) :
218 Ref(
ProductID const& iProductID, T
const* item, key_type itemKey,
bool transient) :
245 T
const*
get()
const {
303 #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 305 template <
typename E>
315 friend class
RefVector<RefVector<std::vector<E>, T, F>, T, VF>;
316 friend class
RefVector<RefVector<std::vector<E>, T, F>, T, VBF>;
325 typedef typename boost::binary_traits<F>::second_argument_type
argument_type;
402 T
const*
get()
const {
463 template <
typename C,
typename T,
typename F>
468 refitem::findRefItem<C, T, F, key_type>(
product_, handle.
product(), itemKey);
472 template <
typename E>
477 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
product_.toRefCore(),
483 template <
typename C,
typename T,
typename F>
488 refitem::findRefItem<C, T, F, key_type>(
product_, handle.
product(), itemKey);
492 template <
typename E>
497 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
product_.toRefCore(),
509 template <
typename C,
typename T,
typename F>
513 if(iProduct !=
nullptr) {
514 refitem::findRefItem<C, T, F, key_type>(
product_, iProduct, itemKey);
518 template <
typename E>
522 if(iProduct !=
nullptr) {
523 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
product_.toRefCore(), iProduct, itemKey);
529 template <
typename C,
typename T,
typename F>
533 if(itemKey == key_traits<key_type>::value)
return;
534 refitem::findRefItem<C, T, F, key_type>(
product_, handle.
product(), itemKey);
537 template <
typename E>
541 if(itemKey == key_traits<key_type>::value)
return;
542 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
product_.toRefCore(),
548 template <
typename C,
typename T,
typename F>
554 if(refProd.
refCore().productPtr() !=
nullptr && itemKey != key_traits<key_type>::value) {
555 refitem::findRefItem<C, T, F, key_type>(
product_,
561 template <
typename E>
564 product_(refProd.id(),
nullptr, refProd.refCore().productGetter(), refProd.refCore().isTransient(), itemKey) {
566 if(refProd.refCore().productPtr() !=
nullptr && itemKey != key_traits<key_type>::value) {
567 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
569 static_cast<product_type const*
>(refProd.refCore().productPtr()),
574 template <
typename C,
typename T,
typename F>
584 template <
typename E>
591 return isThinnedAvailable<std::vector<E> >(
product_.toRefCore(),
key());
595 template <
typename C,
typename T,
typename F>
601 template <
typename E>
605 return *getRefPtr<REF_FOR_VECTOR_ARGS>(
product_.toRefCore(),
key());
609 template <
typename C,
typename T,
typename F>
615 template <
typename E>
619 return getRefPtr<REF_FOR_VECTOR_ARGS>(
product_.toRefCore(),
key());
622 template <
typename C,
typename T,
typename F>
626 return lhs.key() == rhs.key() && lhs.refCore() == rhs.refCore() ;
629 template <
typename C,
typename T,
typename F>
633 return !(lhs == rhs);
636 template <
typename C,
typename T,
typename F>
642 return (lhs.refCore() == rhs.refCore() ? compare_key<C>(lhs.key(), rhs.key()) : lhs.refCore() < rhs.refCore());
T const * product() const
refhelper::ValueTrait< std::vector< E > >::value T
EDProductGetter const * mustBeNonZero(EDProductGetter const *prodGetter, std::string refType, ProductID const &productID)
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
edm::Ref< Container > Ref
bool isNonnull() const
Checks for non-null.
void checkTypeAtCompileTime(C 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
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==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
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.
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 operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
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
T const & operator*() const
Dereference operator.
key_type key() const
Accessor for product key.