Warning, /include/Geant4/tools/stype 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_stype
0005 #define tools_stype
0006
0007 //used in rroot leaf template.
0008
0009 #include "typedefs"
0010
0011 #include <string>
0012
0013 namespace tools {
0014
0015 inline const std::string& stype(unsigned char) {
0016 static const std::string s_v("unsigned char");
0017 return s_v;
0018 }
0019
0020 inline const std::string& stype(char) {
0021 static const std::string s_v("char");
0022 return s_v;
0023 }
0024
0025 inline const std::string& stype(unsigned short) {
0026 static const std::string s_v("unsigned short");
0027 return s_v;
0028 }
0029
0030 inline const std::string& stype(short) {
0031 static const std::string s_v("short");
0032 return s_v;
0033 }
0034
0035 inline const std::string& stype(int) {
0036 static const std::string s_v("int");
0037 return s_v;
0038 }
0039
0040 inline const std::string& stype(unsigned int) {
0041 static const std::string s_v("unsigned int");
0042 return s_v;
0043 }
0044
0045 inline const std::string& stype(float) {
0046 static const std::string s_v("float");
0047 return s_v;
0048 }
0049
0050 inline const std::string& stype(double) {
0051 static const std::string s_v("double");
0052 return s_v;
0053 }
0054
0055 inline const std::string& stype(bool) {
0056 static const std::string s_v("bool");
0057 return s_v;
0058 }
0059
0060 // for tools::mcol<T> :
0061 inline const std::string& stype(int64) {
0062 static const std::string s_v("tools::int64");
0063 return s_v;
0064 }
0065 inline const std::string& stype(uint64) {
0066 static const std::string s_v("tools::uint64");
0067 return s_v;
0068 }
0069 inline const std::string& stype(const std::string&) {
0070 static const std::string s_v("std::string");
0071 return s_v;
0072 }
0073
0074 // for introspection templated fields or class methods :
0075 template <class T>
0076 inline const std::string& stype(const T&) {return T::s_class();}
0077
0078 inline bool stemplate(const std::string& a_s,std::string& a_inc) {
0079 // If a_s is of the form "xxx<yyy>zzz<ttt>uuuu", at end a_inc contains "yyy".
0080 // It returns true if something had been found, else false.
0081 a_inc = a_s;
0082 std::string::size_type pos = a_inc.find('<');
0083 if(pos==std::string::npos) {a_inc.clear();return false;}
0084 a_inc = a_inc.substr((pos+1),a_inc.size()-(pos+1));
0085 std::string::size_type _pos = a_inc.find('>');
0086 if(_pos==std::string::npos) {a_inc.clear();return false;}
0087 a_inc = a_inc.substr(0,_pos);
0088 return true;
0089 }
0090
0091 }
0092
0093 #include <vector>
0094
0095 namespace tools {
0096
0097 // for sg::entries mf_vec< std::vector<std::string> ,std::string> opts;
0098 inline const std::string& stype(const std::vector<std::string>&) {
0099 static const std::string s_v("std::vector<std::string>");
0100 return s_v;
0101 }
0102
0103 }
0104
0105 #endif