CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ClassID.h
Go to the documentation of this file.
1 #ifndef CondCoreDBCommon_ClassID_H
2 #define CondCoreDBCommon_ClassID_H
3 #include <typeinfo>
4 #include<vector>
5 #include<string>
6 
7 namespace cond {
8 
9  namespace idCategories {
10  std::string const pythonIDCategory("CondPythonID");
11  }
12 
13 
14 
15  char const * className(const std::type_info& t);
16 
17 
18  class ClassInfo {
19  public:
20  virtual ~ClassInfo(){}
21  inline ClassInfo(const std::type_info& t) : tinfo(t) {}
22  //inline ClassInfo(const std::type_info& t, int);
23  inline const std::type_info& type() const { return tinfo;}
25  virtual std::string resource() const=0;
26  private:
27  //ClassIDRegistry * registry;
28  //const char * registerMe(const std::type_info& t);
29  const std::type_info& tinfo;
30  };
31 
32 
48  template<typename T>
49  struct ClassID : public ClassInfo {
50  ClassID() : ClassInfo(typeid(T)) {}
51  ClassID(char const * res ) : ClassInfo(typeid(T)), m_res(res) {}
52 // ClassID(int i) : ClassInfo(typeid(T),i) {}
53  virtual std::string resource() const { return m_res;}
54  private:
56  };
57 
58 
59 }
60 
68 namespace cond{
70 }
71 
72 #define PYTHON_ID(type_, plugName_, uname_) \
73  namespace pythonID { struct EDM_PLUGIN_SYM(plugName_, uname_) : public cond::ClassID<type_> { EDM_PLUGIN_SYM(plugName_ , uname_) () : cond::ClassID<type_>(::plugName_){}};} \
74  DEFINE_EDM_PLUGIN(cond::ClassInfoFactory, EDM_PLUGIN_SYM(pythonID::plugName_, uname_) , EDM_PLUGIN_SYM(pythonID::plugName_, uname_)().pluginName(cond::idCategories::pythonIDCategory).c_str() )
75 
76 
77 #endif // CondCoreDBCommon_ClassID_H
tuple t
Definition: tree.py:139
std::string const pythonIDCategory("CondPythonID")
const std::type_info & tinfo
Definition: ClassID.h:29
virtual ~ClassInfo()
Definition: ClassID.h:20
virtual std::string resource() const
Definition: ClassID.h:53
ClassInfo(const std::type_info &t)
Definition: ClassID.h:21
const std::type_info & type() const
Definition: ClassID.h:23
ClassID(char const *res)
Definition: ClassID.h:51
virtual std::string resource() const =0
std::string m_res
Definition: ClassID.h:55
edmplugin::PluginFactory< ClassInfo *() > ClassInfoFactory
Definition: ClassID.h:69
std::string pluginName(std::string const &prefix) const
Definition: ClassID.cc:57
char const * className(const std::type_info &t)
Definition: ClassID.cc:8
long double T