CMS 3D CMS Logo

typelookup Class Reference

#include <FWCore/Utilities/interface/typelookup.h>

Detailed Description

Description: Allow looking up a c++ type_info via its name

Usage: This group of functions allow one to associate a string to a std::type_info. In particular one can lookup an edm::TypeIDBase given a string.

The system works by using the macros TYPELOOKUP_METHODS and DEFINE_TYPELOOKUP_REGISTRATION. TYPELOOKUP_METHODS(Tname): explicitly instantiates the template functions className classTypeInfo using the Tname value as both the C++ class and transforming it into the string name.

DEFINE_TYPELOOKUP_REGISTRATION: registers the string name with the C++ class type.

TYPELOOKUP_DATA_REG : sets both TYPELOOKUP_METHODS and DEFINE_TYPELOOKUP_REGISTRATION

Example: You have a new data class called 'DummyData'. Then to register that class with the system you place the lines

include "<where ever my class decleration lives>/interface/DummyData.h"

TYPELOOKUP_DATA_REG(DummyData);

into the file <where ever="" my="" class="" decleration="" lives>="">/src/T_EventSetup_DummyData.cc

The actual name of the file that uses the 'TYPELOOKUP_DATA_REG' macro is not important. The only important point the file that uses the 'TYPELOOKUP_DATA_REG' macro must be in the same library as the data class it is registering.