CMS 3D CMS Logo

RefTraits.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_RefTraits_h
2 #define DataFormats_Common_RefTraits_h
3 
4 #include <algorithm>
5 
6 namespace edm {
7  template <typename C, typename T, typename F>
8  class RefVector;
9  template <typename T>
10  class RefToBaseVector;
11 
12  namespace refhelper {
13  template <typename C, typename T>
15  typedef C const& first_argument_type;
16  typedef unsigned int second_argument_type;
17  typedef T const* result_type;
18 
20  typename C::const_iterator it = iContainer.begin();
21  std::advance(it, static_cast<typename C::size_type>(iIndex));
22  return it.operator->();
23  }
24  };
25 
26  template <typename REFV>
28  using first_argument_type = REFV const&;
29  using second_argument_type = typename REFV::key_type;
30  using result_type = typename REFV::member_type const*;
31 
33  typename REFV::const_iterator it = iContainer.begin();
34  std::advance(it, iIndex);
35  return it.operator->()->get();
36  }
37  };
38 
39  //Used in edm::Ref to set the default 'find' method to use based on the Container and 'contained' type
40  template <typename C, typename T>
41  struct FindTrait {
43  };
44 
45  template <typename C, typename T, typename F>
46  struct FindTrait<RefVector<C, T, F>, T> {
48  };
49 
50  template <typename T>
53  };
54 
55  template <typename C>
56  struct ValueTrait {
57  typedef typename C::value_type value;
58  };
59 
60  template <typename C, typename T, typename F>
61  struct ValueTrait<RefVector<C, T, F> > {
62  typedef T value;
63  };
64 
65  template <typename T>
67  typedef T value;
68  };
69 
70  } // namespace refhelper
71 
72 } // namespace edm
73 #endif
edm::refhelper::FindTrait< RefToBaseVector< T >, T >::value
FindRefVectorUsingAdvance< RefToBaseVector< T > > value
Definition: RefTraits.h:52
edm::refhelper::FindRefVectorUsingAdvance
Definition: RefTraits.h:27
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::refhelper::FindRefVectorUsingAdvance::first_argument_type
REFV const & first_argument_type
Definition: RefTraits.h:28
edm::refhelper::FindRefVectorUsingAdvance::result_type
typename REFV::member_type const * result_type
Definition: RefTraits.h:30
edm::refhelper::FindUsingAdvance::first_argument_type
C const & first_argument_type
Definition: RefTraits.h:15
edm::RefVector
Definition: EDProductfwd.h:27
reco::JetExtendedAssociation::RefVector
edm::RefVector< Container > RefVector
Definition: JetExtendedAssociation.h:34
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
edm::refhelper::ValueTrait< RefVector< C, T, F > >::value
T value
Definition: RefTraits.h:62
edm::refhelper::ValueTrait< RefToBaseVector< T > >::value
T value
Definition: RefTraits.h:67
RefToBaseVector
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::RefToBaseVector
Definition: EDProductfwd.h:29
edm::refhelper::FindUsingAdvance::operator()
result_type operator()(first_argument_type iContainer, second_argument_type iIndex)
Definition: RefTraits.h:19
edm::refhelper::ValueTrait
Definition: RefTraits.h:56
gen::C
C
Definition: PomwigHadronizer.cc:76
T
long double T
Definition: Basic3DVectorLD.h:48
edm::refhelper::FindTrait
Definition: RefTraits.h:41
edm::refhelper::FindTrait< RefVector< C, T, F >, T >::value
FindRefVectorUsingAdvance< RefVector< C, T, F > > value
Definition: RefTraits.h:47
edm::refhelper::FindUsingAdvance::second_argument_type
unsigned int second_argument_type
Definition: RefTraits.h:16
edm::refhelper::FindTrait::value
FindUsingAdvance< C, T > value
Definition: RefTraits.h:42
edm::refhelper::FindUsingAdvance::result_type
T const * result_type
Definition: RefTraits.h:17
edm::refhelper::FindRefVectorUsingAdvance::operator()
result_type operator()(first_argument_type iContainer, second_argument_type iIndex)
Definition: RefTraits.h:32
edm::refhelper::ValueTrait::value
C::value_type value
Definition: RefTraits.h:57
edm::refhelper::FindUsingAdvance
Definition: RefTraits.h:14
edm::refhelper::FindRefVectorUsingAdvance::second_argument_type
typename REFV::key_type second_argument_type
Definition: RefTraits.h:29