Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:33

0001 #ifndef Fireworks_Core_register_itemaccessorbase_macro_h
0002 #define Fireworks_Core_register_itemaccessorbase_macro_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Core
0006 // Class  :     register_itemaccessorbase_macros_h
0007 //
0008 /**
0009 
0010    Description: Adds needed methods to a FWItemAccessorBase 
0011 
0012    Usage:
0013     <usage>
0014 
0015  */
0016 //
0017 // Original Author:  Giulio Eulisse
0018 //         Created:  Thu Feb 18 11:31:20 EDT 2010
0019 //
0020 
0021 // system include files
0022 #include <string>
0023 
0024 // user include files
0025 #include "FWCore/Reflection/interface/TypeWithDict.h"
0026 #include "FWCore/Utilities/interface/concatenate.h"
0027 
0028 // forward declarations
0029 
0030 #define REGISTER_FWITEMACCESSOR_METHODS()                         \
0031   const std::string& typeName() const { return classTypeName(); } \
0032   const std::string& purpose() const { return classPurpose(); }   \
0033   static const std::string& classRegisterTypeName();              \
0034   static const std::string& classTypeName();                      \
0035   static const std::string& classPurpose()
0036 
0037 #define DEFINE_FWITEMACCESSOR_METHODS(_accessor_, _type_, _purpose_)      \
0038   const std::string& _accessor_::classTypeName() {                        \
0039     static std::string s_type = edm::TypeWithDict(typeid(_type_)).name(); \
0040     return s_type;                                                        \
0041   }                                                                       \
0042   const std::string& _accessor_::classRegisterTypeName() {                \
0043     static std::string s_type(typeid(_type_).name());                     \
0044     return s_type;                                                        \
0045   }                                                                       \
0046   const std::string& _accessor_::classPurpose() {                         \
0047     static std::string s_purpose(_purpose_);                              \
0048     return s_purpose;                                                     \
0049   }                                                                       \
0050   enum { EDM_CONCATENATE(dummy_itemaccessor_methods_, __LINE__) }
0051 
0052 #define DEFINE_TEMPLATE_FWITEMACCESSOR_METHODS(_accessor_, _type_, _purpose_) \
0053   template <>                                                                 \
0054   const std::string& _accessor_::classTypeName() {                            \
0055     static std::string s_type = edm::TypeWithDict(typeid(_type_)).name();     \
0056     return s_type;                                                            \
0057   }                                                                           \
0058   template <>                                                                 \
0059   const std::string& _accessor_::classRegisterTypeName() {                    \
0060     static std::string s_type(typeid(_type_).name());                         \
0061     return s_type;                                                            \
0062   }                                                                           \
0063   template <>                                                                 \
0064   const std::string& _accessor_::classPurpose() {                             \
0065     static std::string s_purpose(_purpose_);                                  \
0066     return s_purpose;                                                         \
0067   }                                                                           \
0068   enum { EDM_CONCATENATE(dummy_itemaccessor_methods_, __LINE__) }
0069 
0070 #endif