#include "DataFormats/Common/interface/CMS_CLASS_VERSION.h"
#include "DataFormats/Common/interface/ConstPtrCache.h"
#include "DataFormats/Common/interface/EDProductfwd.h"
#include "DataFormats/Common/interface/EDProductGetter.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/OrphanHandle.h"
#include "DataFormats/Common/interface/RefCore.h"
#include "DataFormats/Common/interface/RefCoreWithIndex.h"
#include "DataFormats/Common/interface/TestHandle.h"
#include "DataFormats/Common/interface/traits.h"
#include "DataFormats/Provenance/interface/ProductID.h"
#include "boost/functional.hpp"
#include "boost/call_traits.hpp"
#include "boost/type_traits.hpp"
#include "boost/mpl/has_xxx.hpp"
#include "boost/utility/enable_if.hpp"
#include "DataFormats/Common/interface/RefTraits.h"
#include "DataFormats/Common/interface/RefProd.h"
#include "DataFormats/Common/interface/RefCoreGet.h"
#include "DataFormats/Common/interface/RefItemGet.h"
#include "DataFormats/Common/interface/HolderToVectorTrait.h"
#include "DataFormats/Common/interface/Holder.h"
#include "DataFormats/Common/interface/VectorHolder.h"
#include "DataFormats/Common/interface/RefVector.h"
Go to the source code of this file.
Classes | |
struct | edm::reftobase::HolderToVectorTrait< T1, Ref< C, T, F > > |
class | edm::Ref< C, T, F > |
class | edm::Ref< REF_FOR_VECTOR_ARGS > |
struct | edm::reftobase::RefHolderToRefVectorTrait< Ref< C, T, F > > |
struct | edm::reftobase::RefHolderToVector< T, REF > |
struct | edm::reftobase::RefRefHolderToRefVector< REF > |
Namespaces | |
namespace | edm |
A PluginFactory for concrete instances of class KalmanAlignmentMetricsUpdator. | |
namespace | edm::reftobase |
Defines | |
#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 |
Functions | |
template<typename C , typename K > | |
boost::enable_if < has_key_compare< C >, bool > ::type | compare_key (K const &lhs, K const &rhs) |
template<typename C , typename T , typename F > | |
bool | edm::operator!= (Ref< C, T, F > const &lhs, Ref< C, T, F > const &rhs) |
template<typename C , typename T , typename F > | |
bool | edm::operator< (Ref< C, T, F > const &lhs, Ref< C, T, F > const &rhs) |
template<typename C , typename T , typename F > | |
bool | edm::operator== (Ref< C, T, F > const &lhs, Ref< C, T, F > const &rhs) |
#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 |
boost::disable_if< has_key_compare< C >, bool >::type compare_key | ( | K const & | lhs, |
K const & | rhs | ||
) |
Summary
The edm::Ref<> is a storable reference to an item in a stored container. For example, you could use one to hold a reference back to one particular track within an std::vector<> of tracks.
Usage
The edm::Ref<> works just like a pointer
edm::Ref<Foo> fooPtr = ... //set the value functionTakingConstFoo(*fooPtr); //get the Foo object fooPtr->bar(); //call a method of the held Foo object
The main purpose of an edm::Ref<> is it can be used as a member datum for a class that is to be stored in the edm::Event.
Customization
The edm::Ref<> takes three template parameters
1) C: The type of the container which is holding the item
2) T: The type of the item. This defaults to C::value_type
3) F: A helper class (a functor) which knows how to find a particular 'T' within the container given an appropriate key. The type of the key is deduced from F::second_argument. The default for F is refhelper::FindTrait<C, T>::value. If no specialization of FindTrait<> is available for the combination (C, T) then it defaults to getting the iterator to be beginning of the container and using std::advance() to move to the appropriate key in the container.
It is possible to customize the 'lookup' algorithm used.
1) The helper class F should inherit from std::binary_function<const C&, typename IndexT, const T*> (or must provide the typedefs obtained from that inheritance directly).
2) The helper class F must define the function call operator in such a way that the following call is well-formed: f is an instance of type F coll is an instance of type C k is an instance of type F::key_type
result_type r = f(coll, k);
If one wishes to make a specialized lookup the default lookup for the container/type pair then one needs to partially specialize the templated class edm::refhelper::FindTrait<C, T> such that it has a typedef named 'value' which refers to the specialized helper class (i.e., F)
The class template Ref<C, T, F> supports 'null' references.
-- a default-constructed Ref is 'null'; furthermore, it also has an invalid (or 'null') ProductID. -- a Ref constructed through the single-arguement constructor that takes a ProductID is also null.
Definition at line 128 of file Ref.h.
{ typedef typename C::key_compare comparison_functor; return comparison_functor()(lhs, rhs); }