Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
#ifndef Fireworks_Core_register_itemaccessorbase_macro_h
#define Fireworks_Core_register_itemaccessorbase_macro_h
// -*- C++ -*-
//
// Package:     Core
// Class  :     register_itemaccessorbase_macros_h
//
/**

   Description: Adds needed methods to a FWItemAccessorBase 

   Usage:
    <usage>

 */
//
// Original Author:  Giulio Eulisse
//         Created:  Thu Feb 18 11:31:20 EDT 2010
//

// system include files
#include <string>

// user include files
#include "FWCore/Reflection/interface/TypeWithDict.h"
#include "FWCore/Utilities/interface/concatenate.h"

// forward declarations

#define REGISTER_FWITEMACCESSOR_METHODS()                         \
  const std::string& typeName() const { return classTypeName(); } \
  const std::string& purpose() const { return classPurpose(); }   \
  static const std::string& classRegisterTypeName();              \
  static const std::string& classTypeName();                      \
  static const std::string& classPurpose()

#define DEFINE_FWITEMACCESSOR_METHODS(_accessor_, _type_, _purpose_)      \
  const std::string& _accessor_::classTypeName() {                        \
    static std::string s_type = edm::TypeWithDict(typeid(_type_)).name(); \
    return s_type;                                                        \
  }                                                                       \
  const std::string& _accessor_::classRegisterTypeName() {                \
    static std::string s_type(typeid(_type_).name());                     \
    return s_type;                                                        \
  }                                                                       \
  const std::string& _accessor_::classPurpose() {                         \
    static std::string s_purpose(_purpose_);                              \
    return s_purpose;                                                     \
  }                                                                       \
  enum { EDM_CONCATENATE(dummy_itemaccessor_methods_, __LINE__) }

#define DEFINE_TEMPLATE_FWITEMACCESSOR_METHODS(_accessor_, _type_, _purpose_) \
  template <>                                                                 \
  const std::string& _accessor_::classTypeName() {                            \
    static std::string s_type = edm::TypeWithDict(typeid(_type_)).name();     \
    return s_type;                                                            \
  }                                                                           \
  template <>                                                                 \
  const std::string& _accessor_::classRegisterTypeName() {                    \
    static std::string s_type(typeid(_type_).name());                         \
    return s_type;                                                            \
  }                                                                           \
  template <>                                                                 \
  const std::string& _accessor_::classPurpose() {                             \
    static std::string s_purpose(_purpose_);                                  \
    return s_purpose;                                                         \
  }                                                                           \
  enum { EDM_CONCATENATE(dummy_itemaccessor_methods_, __LINE__) }

#endif