/* * VMGData_printKeyNames.hpp * * Created on: 08.08.2012 * Author: heber */ #ifndef VMGDATA_PRINTKEYNAMES_HPP_ #define VMGDATA_PRINTKEYNAMES_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "Fragmentation/Summation/printKeyNames.hpp" //#include #include #include "Fragmentation/Summation/printKeyNames.hpp" #include #include #include #include #include /** this is the boost::preprocessor::sequence of the keys in the boost::fusion::map * * Basically, every key appears here in brackets. If so, then the preprocessor magic * below will create a template specialization of the printName() function in the * namespace printKeyNames. */ #define tokensequence \ (sampled_potential) \ (energy_potential) \ (energy_long) \ (electron_longrange) \ (electron_shortrange) \ (nuclei_longrange) \ (nuclei_shortrange) \ (total_longrange) \ (total_shortrange) /// we take note of the number of keys in tokensequence as (local) loop bounds below #ifndef tokensequence #define MAXTOKENS 0 #else #define MAXTOKENS BOOST_PP_SEQ_SIZE(tokensequence) #endif /** This is the macro function which prints the specialized template function. * * We need make it inline as it is fully specialized and hence multiple instances * are not combined into one anymore. */ #define printName_specializer(z, n, NAMESPACE, TOKENSEQ, NAMESEQ ) \ template<> inline std::string printName< NAMESPACE :: BOOST_PP_SEQ_ELEM( n, TOKENSEQ ) >() { \ return std::string( BOOST_PP_STRINGIZE( BOOST_PP_SEQ_ELEM( n, NAMESEQ ) ) ); \ } /** Specific namespace for all the specialized template functions that print * a useful name for each of the boost::fusion::map key. */ namespace printKeyNames { /* iterate (line-wise) over the sequence and spill out a specialized printName * for each member in the boost::fusion::map. */ #if defined tokensequence && defined MAXTOKENS && defined printName_specializer #define BOOST_PP_LOCAL_MACRO(n) printName_specializer(~, n, VMGDataFused, tokensequence, tokensequence) #define BOOST_PP_LOCAL_LIMITS (0, MAXTOKENS-1) #include BOOST_PP_LOCAL_ITERATE() #endif }; /* namespace printKeyNames */ #undef tokensequence #undef printName_specializer #undef MAXTOKENS #endif /* VMGDATA_PRINTKEYNAMES_HPP_ */