CMS 3D CMS Logo

TypeToGet.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_TypeToGet_h
2 #define FWCore_Utilities_TypeToGet_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Utilities
6 // Class : TypeToGet
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Sat, 06 Apr 2013 14:45:01 GMT
19 //
20 
21 // system include files
22 
23 // user include files
26 
27 // forward declarations
28 namespace edm {
29  template <typename T>
30  class View;
31 
32  class TypeToGet {
33  public:
38  TypeToGet(TypeID const& iID, KindOfType iKind) : m_type(iID), m_kind(iKind) {}
39 
40  // ---------- const member functions ---------------------
41  TypeID const& type() const { return m_type; }
42  KindOfType kind() const { return m_kind; }
43 
44  // ---------- static member functions --------------------
45  template <typename T>
46  static TypeToGet make() {
47  return TypeToGet(edm::TypeID(typeIdFor(static_cast<T*>(nullptr))), kindOfTypeFor(static_cast<T*>(nullptr)));
48  }
49 
50  private:
51  template <typename T>
52  static std::type_info const& typeIdFor(T*) {
53  return typeid(T);
54  }
55 
56  template <typename T>
57  static std::type_info const& typeIdFor(edm::View<T>*) {
58  return typeid(T);
59  }
60 
61  template <typename T>
63  return PRODUCT_TYPE;
64  }
65 
66  template <typename T>
68  return ELEMENT_TYPE;
69  }
70 
71  TypeToGet() = delete;
72 
73  // ---------- member data --------------------------------
76  };
77 } // namespace edm
78 
79 #endif
KindOfType kind() const
Definition: TypeToGet.h:42
TypeToGet()=delete
static std::type_info const & typeIdFor(T *)
Definition: TypeToGet.h:52
TypeToGet(TypeID const &iID, KindOfType iKind)
Definition: TypeToGet.h:38
static KindOfType kindOfTypeFor(T *)
Definition: TypeToGet.h:62
KindOfType m_kind
Definition: TypeToGet.h:75
static std::type_info const & typeIdFor(edm::View< T > *)
Definition: TypeToGet.h:57
static TypeToGet make()
Definition: TypeToGet.h:46
static KindOfType kindOfTypeFor(edm::View< T > *)
Definition: TypeToGet.h:67
HLT enums.
TypeID const & type() const
Definition: TypeToGet.h:41
TypeID m_type
Definition: TypeToGet.h:74
long double T