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 // $Id: produce_helpers.h,v 1.6 2006/08/16 13:51:18 chrjones Exp $
20 //
21 
22 // system include files
23 #include <memory>
24 // user include files
25 #include "boost/shared_ptr.hpp"
26 
27 // forward declarations
28 namespace edm {
29  namespace eventsetup {
30 
31  namespace produce { struct Null;}
32 
33  template<typename FromT, typename ToT> void copyFromTo(FromT& iFrom,
34  ToT & iTo) {
35  iTo = iFrom;
36  }
37 
38  namespace produce {
39  struct Null {};
40  template <typename T> struct EndList {
41  typedef T tail_type;
42  typedef Null head_type;
43  };
44  template <typename T> struct product_traits {
45  typedef T type;
46  };
47  template< typename T> struct product_traits<T*> {
48  typedef EndList<T*> type;
49  };
50  template< typename T> struct product_traits<std::auto_ptr<T> > {
52  };
53  template< typename T> struct product_traits<boost::shared_ptr<T> > {
55  };
56 
57 
58  template<typename T> struct size {
59  typedef typename product_traits<T>::type type;
61  };
62  template<> struct size<Null> {
63  enum { value = 0 };
64  };
65 
66  template<typename T> struct smart_pointer_traits {
67  typedef typename T::element_type type;
68  };
69 
70  template<typename T> struct smart_pointer_traits<T*> {
71  typedef T type;
72  };
73  template<typename T> struct smart_pointer_traits< T const *> {
74  typedef T type;
75  };
76 
77  template<typename FromT, typename ToT> void copyFromTo(FromT& iFrom,
78  ToT & iTo) {
79  iTo = iFrom;
80  }
81 
82 
83 
84  template<typename ContainerT, typename EntryT, typename FindT> struct find_index_impl {
87  };
88  template<typename ContainerT, typename T> struct find_index_impl<ContainerT, T,T> {
89  enum { value = 0 };
90  };
91 
92  template<typename T, typename FindT> struct find_index {
95  };
96  namespace test {
97  template<typename T> const char* name(const T*);
98  }
99 
100  }
101  }
102 }
103 
104 #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