test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
produce_helpers.h
Go to the documentation of this file.
1 #ifndef Framework_produce_helpers_h
2 #define Framework_produce_helpers_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class : produce_helpers
7 //
16 //
17 // Author: Chris Jones
18 // Created: Fri Apr 15 10:25:20 EDT 2005
19 //
20 
21 // system include files
22 #include <memory>
23 // user include files
24 #include "boost/shared_ptr.hpp"
25 
26 // forward declarations
27 namespace edm {
28  namespace eventsetup {
29 
30  namespace produce { struct Null;}
31 
32  template<typename FromT, typename ToT> void copyFromTo(FromT& iFrom,
33  ToT & iTo) {
34  iTo = iFrom;
35  }
36 
37  namespace produce {
38  struct Null {};
39  template <typename T> struct EndList {
40  typedef T tail_type;
41  typedef Null head_type;
42  };
43  template <typename T> struct product_traits {
44  typedef T type;
45  };
46  template< typename T> struct product_traits<T*> {
47  typedef EndList<T*> type;
48  };
49  template< typename T> struct product_traits<std::auto_ptr<T> > {
51  };
52  template< typename T> struct product_traits<boost::shared_ptr<T> > {
54  };
55 
56 
57  template<typename T> struct size {
58  typedef typename product_traits<T>::type type;
60  };
61  template<> struct size<Null> {
62  enum { value = 0 };
63  };
64 
65  template<typename T> struct smart_pointer_traits {
66  typedef typename T::element_type type;
67  };
68 
69  template<typename T> struct smart_pointer_traits<T*> {
70  typedef T type;
71  };
72  template<typename T> struct smart_pointer_traits< T const *> {
73  typedef T type;
74  };
75 
76  template<typename FromT, typename ToT> void copyFromTo(FromT& iFrom,
77  ToT & iTo) {
78  iTo = iFrom;
79  }
80 
81 
82 
83  template<typename ContainerT, typename EntryT, typename FindT> struct find_index_impl {
86  };
87  template<typename ContainerT, typename T> struct find_index_impl<ContainerT, T,T> {
88  enum { value = 0 };
89  };
90 
91  template<typename T, typename FindT> struct find_index {
94  };
95  namespace test {
96  template<typename T> const char* name(const T*);
97  }
98 
99  }
100  }
101 }
102 
103 #endif
const char * name(const T *)
void copyFromTo(FromT &iFrom, ToT &iTo)
product_traits< T >::type container_type
string const
Definition: compareJSON.py:14
void copyFromTo(FromT &iFrom, ToT &iTo)
product_traits< T >::type type
long double T
product_traits< ContainerT >::type container_type