Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/b2s 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_b2s
0005 #define tools_b2s
0006 
0007 #include <string>
0008 
0009 namespace tools {
0010 
0011 inline void b2s(bool a_value,std::string& a_s){
0012   a_s = a_value?"true":"false";
0013 }
0014 
0015 inline void bas(bool a_value,std::string& a_s){
0016   a_s += (a_value?"true":"false");
0017 }
0018 
0019 }
0020 
0021 #include <vector>
0022 
0023 namespace tools {
0024 
0025 inline void b2s(const std::vector<bool>& a_vals,std::string& a_s,const std::string& a_sep = "\n",bool a_sep_at_end = false) {
0026   a_s.clear();
0027   size_t number = a_vals.size();
0028   if(number<=0) return;
0029   number--;
0030   std::string stmp;
0031   for(size_t index=0;index<number;index++) {
0032     b2s(a_vals[index],stmp);
0033     a_s += stmp;
0034     a_s += a_sep;
0035   }
0036   b2s(a_vals[number],stmp);
0037   a_s += stmp;
0038   if(a_sep_at_end) a_s += a_sep;
0039 }
0040 
0041 }
0042 
0043 #endif