Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/S_STRING is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_S_STRING
0005 #define tools_S_STRING
0006 
0007 // a few place in which a cpp macro help the readability.
0008 
0009 #include <string>
0010 
0011 #define TOOLS_CLASS_STRING(a_name)\
0012 static const std::string& s_##a_name() {\
0013   static const std::string s_v(#a_name);\
0014   return s_v;\
0015 }
0016 
0017 #define TOOLS_CLASS_STRING_VALUE(a_name,a_value)\
0018 static const std::string& s_##a_name() {\
0019   static const std::string s_v(#a_value);\
0020   return s_v;\
0021 }
0022 
0023 #define TOOLS_CLASS_STRING_SVALUE(a_name,a_value)\
0024 static const std::string& s_##a_name() {\
0025   static const std::string s_v(a_value);\
0026   return s_v;\
0027 }
0028 
0029 #define TOOLS_GLOBAL_STRING(a_name)\
0030 inline const std::string& s_##a_name() {\
0031   static const std::string s_v(#a_name);\
0032   return s_v;\
0033 }
0034 
0035 #define TOOLS_GLOBAL_STRING_VALUE(a_name,a_value)\
0036 inline const std::string& s_##a_name() {\
0037   static const std::string s_v(#a_value);\
0038   return s_v;\
0039 }
0040 
0041 #define TOOLS_SCLASS(a_name)\
0042 static const std::string& s_class() {\
0043   static const std::string s_v(#a_name);\
0044   return s_v;\
0045 }\
0046 static void check_class_name() {a_name::s_class();}
0047 
0048 #define TOOLS_T_SCLASS(a_T,a_name)\
0049 static const std::string& s_class() {\
0050   static const std::string s_v(#a_name);\
0051   return s_v;\
0052 }\
0053 static void check_class_name() {a_name<a_T>::s_class();}
0054 
0055 #define TOOLS_T2_SCLASS(a_T1,a_T2,a_name)\
0056 static const std::string& s_class() {\
0057   static const std::string s_v(#a_name);\
0058   return s_v;\
0059 }\
0060 static void check_class_name() {a_name<a_T1,a_T2>::s_class();}
0061 
0062 #define TOOLS_T3_SCLASS(a_T1,a_T2,a_T3,a_name)\
0063 static const std::string& s_class() {\
0064   static const std::string s_v(#a_name);\
0065   return s_v;\
0066 }\
0067 static void check_class_name() {a_name<a_T1,a_T2,a_T3>::s_class();}
0068 
0069 // to transform the value of a cpp macro to a string :
0070 #define TOOLS_CPP_TO__STRING(a_cpp) #a_cpp
0071 #define TOOLS_CPP_TO_STRING(a_cpp) std::string(TOOLS_CPP_TO__STRING(a_cpp))
0072 // for example :
0073 // #define FOO foo
0074 //    std::cout << TOOLS_CPP_TO_STRING(FOO) << std::endl;
0075 
0076 #endif