1 #ifndef DataFormats_Common_Ref_h 2 #define DataFormats_Common_Ref_h 115 #include "boost/functional.hpp" 116 #include "boost/call_traits.hpp" 117 #include "boost/type_traits.hpp" 118 #include "boost/mpl/has_xxx.hpp" 121 #include <type_traits> 123 BOOST_MPL_HAS_XXX_TRAIT_DEF(key_compare)
127 typedef typename C::key_compare comparison_functor;
128 return comparison_functor()(lhs, rhs);
131 template <
typename C,
typename K>
139 template <
typename C,
typename T,
typename F>
142 template <
typename T>
145 template <
typename C,
163 typedef typename boost::binary_traits<F>::second_argument_type
argument_type;
184 Ref(
C const* product, key_type itemKey,
bool setNow =
true);
285 #define REF_FOR_VECTOR_ARGS \ 286 std::vector<E>, typename refhelper::ValueTrait<std::vector<E> >::value, \ 287 typename refhelper::FindTrait<std::vector<E>, typename refhelper::ValueTrait<std::vector<E> >::value>::value 289 template <
typename E>
300 friend class
RefVector<RefVector<std::vector<E>, T, F>, T, VF>;
301 friend class
RefVector<RefVector<std::vector<E>, T, F>, T, VBF>;
310 typedef typename boost::binary_traits<F>::second_argument_type
argument_type;
436 template <
typename C,
typename T,
typename F>
441 refitem::findRefItem<C, T, F, key_type>(
product_, handle.
product(), itemKey);
445 template <
typename E>
450 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
455 template <
typename C,
typename T,
typename F>
460 refitem::findRefItem<C, T, F, key_type>(
product_, handle.
product(), itemKey);
464 template <
typename E>
469 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
480 template <
typename C,
typename T,
typename F>
484 if (iProduct !=
nullptr) {
485 refitem::findRefItem<C, T, F, key_type>(
product_, iProduct, itemKey);
489 template <
typename E>
492 if (iProduct !=
nullptr) {
493 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
product_.toRefCore(), iProduct, itemKey);
499 template <
typename C,
typename T,
typename F>
502 if (itemKey == key_traits<key_type>::value)
504 refitem::findRefItem<C, T, F, key_type>(
product_, handle.
product(), itemKey);
507 template <
typename E>
510 if (itemKey == key_traits<key_type>::value)
512 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
517 template <
typename C,
typename T,
typename F>
521 if (refProd.
refCore().productPtr() !=
nullptr && itemKey != key_traits<key_type>::value) {
522 refitem::findRefItem<C, T, F, key_type>(
527 template <
typename E>
529 :
product_(refProd.id(),
nullptr, refProd.refCore().productGetter(), refProd.refCore().isTransient(), itemKey) {
530 if (refProd.refCore().productPtr() !=
nullptr && itemKey != key_traits<key_type>::value) {
531 refitem::findRefItem<product_type, value_type, finder_type, key_type>(
536 template <
typename C,
typename T,
typename F>
544 template <
typename E>
549 return isThinnedAvailable<std::vector<E> >(
product_.toRefCore(),
key());
553 template <
typename C,
typename T,
typename F>
557 template <
typename E>
559 return *getRefPtr<REF_FOR_VECTOR_ARGS>(
product_.toRefCore(),
key());
563 template <
typename C,
typename T,
typename F>
567 template <
typename E>
569 return getRefPtr<REF_FOR_VECTOR_ARGS>(
product_.toRefCore(),
key());
572 template <
typename C,
typename T,
typename F>
574 return lhs.key() == rhs.key() && lhs.refCore() == rhs.refCore();
577 template <
typename C,
typename T,
typename F>
579 return !(lhs == rhs);
582 template <
typename C,
typename T,
typename F>
583 inline bool operator<(Ref<C, T, F>
const& lhs,
Ref<C, T, F> const& rhs) {
586 return (lhs.refCore() == rhs.refCore() ? compare_key<C>(lhs.key(), rhs.key()) : lhs.refCore() < rhs.refCore());
key_type key() const
Accessor for product key.
ProductID id() const
Accessor for product ID.
T const * product() const
EDProductGetter const * mustBeNonZero(EDProductGetter const *prodGetter, std::string refType, ProductID const &productID)
bool isTransient() const
Checks if this ref is transient (i.e. not persistable).
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 *)
refhelper::FindTrait< std::vector< E >, typename refhelper::ValueTrait< std::vector< E > >::value >::value F
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.
value_type const element_type
RefCore const & refCore() const
refhelper::ValueTrait< std::vector< E > >::value T
refhelper::FindRefVectorUsingAdvance< RefVector< std::vector< E >, T, F > > VF
key_type key() const
Accessor for product key.
#define REF_FOR_VECTOR_ARGS
bool operator!() const
Checks for null.
#define CMS_CLASS_VERSION(_version_)
RefCore const & refCore() const
Ref(ProductID const &iProductID, T const *item, key_type itemKey, product_type const *)
Constructor for use in the various X::fillView(...) functions.
EDProductGetter const * productGetter() const
Accessor for product getter.
Ref(ProductID const &iProductID, T const *item, key_type itemKey, bool transient)
ProductID id() const
Accessor for product ID.
Ref(ProductID const &productID, key_type itemKey, EDProductGetter const *prodGetter)
bool hasProductCache() const
Returns true if container referenced by the Ref has been cached.
RefCoreWithIndex product_
Ref(ProductID const &iId)
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
Ref(ProductID const &productID, key_type itemKey, EDProductGetter const *prodGetter)
Ref()
Default constructor needed for reading from persistent store. Not for direct use. ...
T const * operator->() const
Member dereference operator.
void const * productPtr() const
static key_type invalidKey()
Ref(ProductID const &iProductID, T const *item, key_type itemKey)
RefCore const & refCore() const
def template(fileName, svg, replaceme="REPLACEME")
refhelper::FindRefVectorUsingAdvance< RefToBaseVector< T > > VBF
refhelper::ValueTrait< std::vector< E > >::value value_type
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
bool isNull() const
Checks for null.
refhelper::FindRefVectorUsingAdvance< RefToBaseVector< T > > VBF
refhelper::FindRefVectorUsingAdvance< RefVector< C, T, F > > VF
T const * product() const
T const * product() const
bool isNonnull() const
Checks for non-null.
Ref(ProductID const &iProductID, T const *item, key_type itemKey, bool transient)
Ref(ProductID const &iId)
EDProductGetter const * productGetter() const
bool isNull() const
Checks for null.
bool operator!() const
Checks for null.
Ref()
Default constructor needed for reading from persistent store. Not for direct use. ...
EDProductGetter const * productGetter() const
Accessor for product getter.
Ref(ProductID const &iProductID, T const *item, key_type itemKey)
FindUsingAdvance< C, T > value
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
std::vector< E > product_type
for export
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.
boost::binary_traits< F >::second_argument_type argument_type
std::enable_if< has_key_compare< C >::value, bool >::type compare_key(K const &lhs, K const &rhs)