test
CMS 3D CMS Logo

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