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 }
0016 
0017 #include <vector>
0018 
0019 namespace tools {
0020 
0021 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) {
0022   a_s.clear();
0023   size_t number = a_vals.size();
0024   if(number<=0) return;
0025   number--;
0026   std::string stmp;
0027   for(size_t index=0;index<number;index++) {
0028     b2s(a_vals[index],stmp);
0029     a_s += stmp;
0030     a_s += a_sep;
0031   }
0032   b2s(a_vals[number],stmp);
0033   a_s += stmp;
0034   if(a_sep_at_end) a_s += a_sep;
0035 }
0036 
0037 }
0038 
0039 #endif