Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:36:35

0001 #ifndef CONDCORE_ESSOURCES_REGISTRATION_MACROS_H
0002 #define CONDCORE_ESSOURCES_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/ProductResolverFactory.h"
0025 #include "CondCore/ESSources/interface/ProductResolver.h"
0026 #include "CondFormats/SerializationHelper/interface/SerializationHelperFactory.h"
0027 
0028 // forward declarations
0029 
0030 // macros
0031 #define INSTANTIATE_RESOLVER(record_, type_) template class ProductResolverWrapper<record_, type_>;
0032 
0033 #define ONLY_REGISTER_PLUGIN(record_, type_)                                                \
0034   typedef ProductResolverWrapper<record_, type_> EDM_PLUGIN_SYM(ProductResolver, __LINE__); \
0035   DEFINE_EDM_PLUGIN2(cond::ProductResolverFactory, EDM_PLUGIN_SYM(ProductResolver, __LINE__), #record_ "@NewProxy")
0036 
0037 #define REGISTER_PLUGIN(record_, type_)      \
0038   INSTANTIATE_RESOLVER(record_, type_)       \
0039   DEFINE_COND_SERIAL_REGISTER_PLUGIN(type_); \
0040   ONLY_REGISTER_PLUGIN(record_, type_)
0041 
0042 #define REGISTER_PLUGIN_NO_SERIAL(record_, type_) \
0043   INSTANTIATE_RESOLVER(record_, type_)            \
0044   ONLY_REGISTER_PLUGIN(record_, type_)
0045 
0046 #define INSTANTIATE_RESOLVER_INIT(record_, type_, initializer_) \
0047   template class ProductResolverWrapper<record_, type_, initializer_>;
0048 
0049 #define ONLY_REGISTER_PLUGIN_INIT(record_, type_, initializer_)                                           \
0050   typedef ProductResolverWrapper<record_, type_, initializer_> EDM_PLUGIN_SYM(ProductResolver, __LINE__); \
0051   DEFINE_EDM_PLUGIN2(cond::ProductResolverFactory, EDM_PLUGIN_SYM(ProductResolver, __LINE__), #record_ "@NewProxy")
0052 
0053 #define REGISTER_PLUGIN_INIT(record_, type_, initializer_)      \
0054   INSTANTIATE_RESOLVER_INIT(record_, type_, initializer_)       \
0055   DEFINE_COND_SERIAL_REGISTER_PLUGIN_INIT(type_, initializer_); \
0056   ONLY_REGISTER_PLUGIN_INIT(record_, type_, initializer_)
0057 
0058 #define REGISTER_PLUGIN_NO_SERIAL_INIT(record_, type_, initializer_) \
0059   INSTANTIATE_RESOLVER_INIT(record_, type_, initializer_)            \
0060   ONLY_REGISTER_PLUGIN_INIT(record_, type_, initializer_)
0061 
0062 // source_ is the record name of the keyed objects
0063 #define REGISTER_KEYLIST_PLUGIN(record_, type_, source_)                                             \
0064   template class ProductResolverWrapper<record_, type_>;                                             \
0065   struct EDM_PLUGIN_SYM(ProductResolver, record_) : public ProductResolverWrapper<record_, type_> {  \
0066     EDM_PLUGIN_SYM(ProductResolver, record_)() : ProductResolverWrapper<record_, type_>(#source_){}; \
0067   };                                                                                                 \
0068   DEFINE_EDM_PLUGIN(cond::ProductResolverFactory, EDM_PLUGIN_SYM(ProductResolver, record_), #record_ "@NewProxy")
0069 
0070 #endif /* CONDCORE_ESSOURCES_REGISTRATION_MACROS_H */