Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:35

0001 #ifndef PLUGINSYSTEM_REGISTRATION_MACROS_H
0002 #define PLUGINSYSTEM_REGISTRATION_MACROS_H
0003 // -*- C++ -*-
0004 //
0005 // Package:     ESSources
0006 // Class  :     registration_macros
0007 //
0008 /**\class registration_macros registration_macros.h TestCondDB/ESSources/interface/registration_macros.h
0009 
0010  Description: CPP macros used to simplify registration of plugins
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Mon Jul 25 06:47:37 EDT 2005
0019 //
0020 
0021 // system include files
0022 
0023 // user include files
0024 #include "CondCore/ESSources/interface/ProxyFactory.h"
0025 #include "CondCore/ESSources/interface/DataProxy.h"
0026 
0027 // forward declarations
0028 
0029 // macros
0030 #define INSTANTIATE_PROXY(record_, type_) template class DataProxyWrapper<record_, type_>;
0031 
0032 #define ONLY_REGISTER_PLUGIN(record_, type_)                                \
0033   typedef DataProxyWrapper<record_, type_> EDM_PLUGIN_SYM(Proxy, __LINE__); \
0034   DEFINE_EDM_PLUGIN(cond::ProxyFactory, EDM_PLUGIN_SYM(Proxy, __LINE__), #record_ "@NewProxy")
0035 
0036 #define REGISTER_PLUGIN(record_, type_) \
0037   INSTANTIATE_PROXY(record_, type_)     \
0038   ONLY_REGISTER_PLUGIN(record_, type_)
0039 
0040 #define INSTANTIATE_PROXY_INIT(record_, type_, initializer_) \
0041   template class DataProxyWrapper<record_, type_, initializer_>;
0042 
0043 #define ONLY_REGISTER_PLUGIN_INIT(record_, type_, initializer_)                           \
0044   typedef DataProxyWrapper<record_, type_, initializer_> EDM_PLUGIN_SYM(Proxy, __LINE__); \
0045   DEFINE_EDM_PLUGIN(cond::ProxyFactory, EDM_PLUGIN_SYM(Proxy, __LINE__), #record_ "@NewProxy")
0046 
0047 #define REGISTER_PLUGIN_INIT(record_, type_, initializer_) \
0048   INSTANTIATE_PROXY_INIT(record_, type_, initializer_)     \
0049   ONLY_REGISTER_PLUGIN_INIT(record_, type_, initializer_)
0050 
0051 // source_ is the record name of the keyed objects
0052 #define REGISTER_KEYLIST_PLUGIN(record_, type_, source_)                             \
0053   template class DataProxyWrapper<record_, type_>;                                   \
0054   struct EDM_PLUGIN_SYM(Proxy, record_) : public DataProxyWrapper<record_, type_> {  \
0055     EDM_PLUGIN_SYM(Proxy, record_)() : DataProxyWrapper<record_, type_>(#source_){}; \
0056   };                                                                                 \
0057   DEFINE_EDM_PLUGIN(cond::ProxyFactory, EDM_PLUGIN_SYM(Proxy, record_), #record_ "@NewProxy")
0058 
0059 #endif /* PLUGINSYSTEM_REGISTRATION_MACROS_H */