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5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.
  3 
  4 #ifndef tools_stype
  5 #define tools_stype
  6 
  7 //used in rroot leaf template.
  8 
  9 #include "typedefs"
 10 
 11 #include <string>
 12 
 13 namespace tools {
 14 
 15 inline const std::string& stype(unsigned char) {
 16   static const std::string s_v("unsigned char");
 17   return s_v;
 18 }
 19 
 20 inline const std::string& stype(char) {
 21   static const std::string s_v("char");
 22   return s_v;
 23 }
 24 
 25 inline const std::string& stype(unsigned short) {
 26   static const std::string s_v("unsigned short");
 27   return s_v;
 28 }
 29 
 30 inline const std::string& stype(short) {
 31   static const std::string s_v("short");
 32   return s_v;
 33 }
 34 
 35 inline const std::string& stype(int) {
 36   static const std::string s_v("int");
 37   return s_v;
 38 }
 39 
 40 inline const std::string& stype(unsigned int) {
 41   static const std::string s_v("unsigned int");
 42   return s_v;
 43 }
 44 
 45 inline const std::string& stype(float) {
 46   static const std::string s_v("float");
 47   return s_v;
 48 }
 49 
 50 inline const std::string& stype(double) {
 51   static const std::string s_v("double");
 52   return s_v;
 53 }
 54 
 55 inline const std::string& stype(bool) {
 56   static const std::string s_v("bool");
 57   return s_v;
 58 }
 59 
 60 // for tools::mcol<T> :
 61 inline const std::string& stype(int64) {
 62   static const std::string s_v("tools::int64");
 63   return s_v;
 64 }
 65 inline const std::string& stype(uint64) {
 66   static const std::string s_v("tools::uint64");
 67   return s_v;
 68 }
 69 inline const std::string& stype(const std::string&) {
 70   static const std::string s_v("std::string");
 71   return s_v;
 72 }
 73 
 74 // for introspection templated fields or class methods :
 75 template <class T>
 76 inline const std::string& stype(const T&) {return T::s_class();}
 77 
 78 inline bool stemplate(const std::string& a_s,std::string& a_inc) {
 79   // If a_s is of the form "xxx<yyy>zzz<ttt>uuuu", at end a_inc contains "yyy".
 80   // It returns true if something had been found, else false.
 81   a_inc = a_s;
 82   std::string::size_type pos = a_inc.find('<');
 83   if(pos==std::string::npos) {a_inc.clear();return false;}
 84   a_inc = a_inc.substr((pos+1),a_inc.size()-(pos+1));
 85   std::string::size_type _pos = a_inc.find('>');
 86   if(_pos==std::string::npos) {a_inc.clear();return false;}
 87   a_inc = a_inc.substr(0,_pos);
 88   return true;
 89 }
 90 
 91 }
 92 
 93 #include <vector>
 94 
 95 namespace tools {
 96 
 97 // for sg::entries mf_vec< std::vector<std::string> ,std::string> opts;
 98 inline const std::string& stype(const std::vector<std::string>&) {
 99   static const std::string s_v("std::vector<std::string>");
100   return s_v;
101 }
102 
103 }
104 
105 #endif