Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/file_format 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_file_format
0005 #define tools_file_format
0006 
0007 #include "S_STRING"
0008 
0009 #include <string>
0010 #include <vector>
0011 
0012 namespace tools {
0013 namespace file {
0014 
0015 TOOLS_GLOBAL_STRING(format_guessed)
0016 TOOLS_GLOBAL_STRING(format_hdf5)
0017 TOOLS_GLOBAL_STRING(format_fits)
0018 TOOLS_GLOBAL_STRING(format_fog)
0019 TOOLS_GLOBAL_STRING(format_dot)
0020 TOOLS_GLOBAL_STRING(format_dcm)
0021 TOOLS_GLOBAL_STRING(format_iv)
0022 TOOLS_GLOBAL_STRING(format_wrl)
0023 TOOLS_GLOBAL_STRING(format_jpeg)
0024 TOOLS_GLOBAL_STRING(format_png)
0025 TOOLS_GLOBAL_STRING(format_root)
0026 TOOLS_GLOBAL_STRING(format_dst)  //pmx,agora.
0027 TOOLS_GLOBAL_STRING(format_csv)
0028 TOOLS_GLOBAL_STRING(format_hippo)
0029 TOOLS_GLOBAL_STRING(format_scenarios)
0030 TOOLS_GLOBAL_STRING(format_slides)
0031 TOOLS_GLOBAL_STRING(format_zvid)
0032 TOOLS_GLOBAL_STRING(format_exsg)
0033 TOOLS_GLOBAL_STRING(format_gdml)
0034 TOOLS_GLOBAL_STRING(format_mac)
0035 TOOLS_GLOBAL_STRING(format_cmnd)
0036 TOOLS_GLOBAL_STRING(format_aida)
0037 TOOLS_GLOBAL_STRING(format_bsg)
0038 TOOLS_GLOBAL_STRING(format_jive)
0039 TOOLS_GLOBAL_STRING(format_heprep)
0040 TOOLS_GLOBAL_STRING(format_zheprep)
0041 TOOLS_GLOBAL_STRING(format_lua)
0042 TOOLS_GLOBAL_STRING(format_py)
0043 TOOLS_GLOBAL_STRING(format_kumac)
0044 TOOLS_GLOBAL_STRING(format_insh)
0045 TOOLS_GLOBAL_STRING(format_shp)
0046 TOOLS_GLOBAL_STRING(format_simbad)
0047 
0048 #define TOOLS_GLOBAL_EXT(a_name)\
0049 inline const std::string& s_ext_##a_name() {\
0050   static const std::string s_v("."+std::string(#a_name));\
0051   return s_v;\
0052 }
0053 
0054 TOOLS_GLOBAL_EXT(hdf5)
0055 TOOLS_GLOBAL_EXT(fits)
0056 TOOLS_GLOBAL_EXT(fog)
0057 TOOLS_GLOBAL_EXT(dot)
0058 TOOLS_GLOBAL_EXT(dcm)
0059 TOOLS_GLOBAL_EXT(iv)
0060 TOOLS_GLOBAL_EXT(hiv)
0061 TOOLS_GLOBAL_EXT(wrl)
0062 TOOLS_GLOBAL_EXT(jpeg)
0063 TOOLS_GLOBAL_EXT(jpg)
0064 TOOLS_GLOBAL_EXT(png)
0065 TOOLS_GLOBAL_EXT(root)
0066 TOOLS_GLOBAL_EXT(dst)
0067 TOOLS_GLOBAL_EXT(csv)
0068 TOOLS_GLOBAL_EXT(hiptxt)
0069 TOOLS_GLOBAL_EXT(tnt)
0070 TOOLS_GLOBAL_EXT(scenarios)
0071 TOOLS_GLOBAL_EXT(slides)
0072 TOOLS_GLOBAL_EXT(zvid)
0073 TOOLS_GLOBAL_EXT(exsg)
0074 TOOLS_GLOBAL_EXT(gdml)
0075 TOOLS_GLOBAL_EXT(mac)
0076 TOOLS_GLOBAL_EXT(cmnd)
0077 TOOLS_GLOBAL_EXT(aida)
0078 TOOLS_GLOBAL_EXT(bsg)
0079 TOOLS_GLOBAL_EXT(jive)
0080 TOOLS_GLOBAL_EXT(heprep)
0081 TOOLS_GLOBAL_EXT(zheprep)
0082 TOOLS_GLOBAL_EXT(lua)
0083 TOOLS_GLOBAL_EXT(py)
0084 TOOLS_GLOBAL_EXT(kumac)
0085 TOOLS_GLOBAL_EXT(insh)
0086 TOOLS_GLOBAL_EXT(shp)
0087 TOOLS_GLOBAL_EXT(simbad)
0088 
0089 #undef TOOLS_GLOBAL_EXT
0090 
0091 inline void formats(std::vector<std::string>& a_v) {
0092   a_v.clear();
0093   a_v.push_back(s_format_guessed());
0094   a_v.push_back(s_format_hdf5());
0095   a_v.push_back(s_format_fits());
0096   a_v.push_back(s_format_fog());
0097   a_v.push_back(s_format_dot());
0098   a_v.push_back(s_format_dcm());
0099   a_v.push_back(s_format_iv());
0100   a_v.push_back(s_format_wrl());
0101   a_v.push_back(s_format_jpeg());
0102   a_v.push_back(s_format_png());
0103   a_v.push_back(s_format_root());
0104   a_v.push_back(s_format_dst());
0105   a_v.push_back(s_format_csv());
0106   a_v.push_back(s_format_hippo());
0107   a_v.push_back(s_format_scenarios());
0108   a_v.push_back(s_format_slides());
0109   a_v.push_back(s_format_zvid());
0110   a_v.push_back(s_format_exsg());
0111   a_v.push_back(s_format_bsg());
0112   a_v.push_back(s_format_gdml());
0113   a_v.push_back(s_format_mac());
0114   a_v.push_back(s_format_cmnd());
0115   a_v.push_back(s_format_aida());
0116   a_v.push_back(s_format_jive());
0117   a_v.push_back(s_format_heprep());
0118   a_v.push_back(s_format_zheprep());
0119   a_v.push_back(s_format_lua());
0120   a_v.push_back(s_format_py());
0121   a_v.push_back(s_format_kumac());
0122   a_v.push_back(s_format_insh());
0123   a_v.push_back(s_format_shp());
0124   a_v.push_back(s_format_simbad());
0125 }
0126 
0127 inline std::string ext_fmt(const std::string& a_ext) {
0128   if(a_ext==s_ext_fits()) return s_format_fits();
0129   if(a_ext==s_ext_aida()) return s_format_aida();
0130   if(a_ext==s_ext_root()) return s_format_root();
0131   if(a_ext==s_ext_dst())  return s_format_dst();
0132   if(a_ext==s_ext_csv())  return s_format_csv();
0133   if(a_ext==s_ext_tnt())  return s_format_hippo();
0134   if(a_ext==s_ext_hiptxt()) return s_format_hippo();
0135   if(a_ext==s_ext_hdf5()) return s_format_hdf5();
0136   if(a_ext==s_ext_jpeg()) return s_format_jpeg();
0137   if(a_ext==s_ext_jpg()) return s_format_jpeg();
0138   if(a_ext==s_ext_png()) return s_format_png();
0139   if(a_ext==s_ext_fog()) return s_format_fog();
0140   if(a_ext==s_ext_dot()) return s_format_dot();
0141   if(a_ext==s_ext_dcm()) return s_format_dcm();
0142   if(a_ext==s_ext_iv()) return s_format_iv();
0143   if(a_ext==s_ext_hiv()) return s_format_iv();
0144   if(a_ext==s_ext_wrl()) return s_format_wrl();
0145   if(a_ext==s_ext_exsg()) return s_format_exsg();
0146   if(a_ext==s_ext_bsg()) return s_format_bsg();
0147   if(a_ext==s_ext_scenarios()) return s_format_scenarios();
0148   if(a_ext==s_ext_slides()) return s_format_slides();
0149   if(a_ext==s_ext_zvid()) return s_format_zvid();
0150   if(a_ext==s_ext_gdml()) return s_format_gdml();
0151   if(a_ext==s_ext_mac()) return s_format_mac();
0152   if(a_ext==s_ext_cmnd()) return s_format_cmnd();
0153   if(a_ext==s_ext_jive()) return s_format_jive();
0154   if(a_ext==s_ext_heprep()) return s_format_heprep();
0155   if(a_ext==s_ext_zheprep()) return s_format_zheprep();
0156   if(a_ext==s_ext_lua()) return s_format_lua();
0157   if(a_ext==s_ext_py()) return s_format_py();
0158   if(a_ext==s_ext_kumac()) return s_format_kumac();
0159   if(a_ext==s_ext_insh()) return s_format_insh();
0160   if(a_ext==s_ext_shp()) return s_format_shp();
0161   if(a_ext==s_ext_simbad()) return s_format_simbad();
0162   return s_format_guessed();
0163 }
0164 
0165 inline bool need_placement(const std::string& a_format) {
0166   if(a_format==s_format_guessed()) return true;
0167 //if(a_format==s_format_hdf5()) return true;
0168 //if(a_format==s_format_fits()) return true;
0169 //if(a_format==s_format_fog()) return true;  //load in static_sg.
0170 //if(a_format==s_format_dot()) return true;
0171 //if(a_format==s_format_dcm()) return true;
0172 //if(a_format==s_format_iv()) return true;    //load in static_sg.
0173 //if(a_format==s_format_wrl()) return true;   //load in static_sg.
0174 //if(a_format==s_format_jpeg()) return true;
0175 //if(a_format==s_format_png()) return true;
0176 //if(a_format==s_format_root()) return true;
0177 //if(a_format==s_format_dst()) return true;
0178 //if(a_format==s_format_csv()) return true;
0179 //if(a_format==s_format_hippo()) return true;
0180 //if(a_format==s_format_scenarios()) return true;
0181 //if(a_format==s_format_slides()) return true;
0182 //if(a_format==s_format_zvid()) return true;
0183   if(a_format==s_format_exsg()) return true;
0184 //if(a_format==s_format_gdml()) return true;    //load in static_sg.
0185 //if(a_format==s_format_mac()) return true;
0186 //if(a_format==s_format_cmnd()) return true;
0187 //if(a_format==s_format_aida()) return true;
0188   if(a_format==s_format_bsg()) return true;
0189 //if(a_format==s_format_jive()) return true;    //load in dynamic_sg.
0190 //if(a_format==s_format_heprep()) return true;  //load in static_sg.
0191 //if(a_format==s_format_zheprep()) return true; //load in static_sg.
0192 //if(a_format==s_format_lua()) return true;
0193 //if(a_format==s_format_py()) return true;
0194 //if(a_format==s_format_kumac()) return true;
0195 //if(a_format==s_format_insh()) return true;
0196 //if(a_format==s_format_shp()) return true;    //load in static_sg.
0197 //if(a_format==s_format_simbad()) return true; //load in arg sep.
0198   return false;
0199 }
0200 
0201 // related files : sg/write_paper, paper_format.
0202 
0203 inline bool is_paper_format(const std::string& a_format) {
0204   if(a_format=="gl2ps_eps") return true;
0205   if(a_format=="gl2ps_ps") return true;
0206   if(a_format=="gl2ps_pdf") return true;
0207   if(a_format=="gl2ps_svg") return true;
0208   if(a_format=="gl2ps_tex") return true;
0209   if(a_format=="gl2ps_pgf") return true;
0210   if(a_format=="inzb_ps") return true;
0211   if(a_format=="inzb_jpeg") return true;
0212   if(a_format=="inzb_png") return true;
0213   return false;
0214 }
0215 
0216 inline bool is_inzb_format(const std::string& a_format) {
0217   if(a_format=="inzb_ps") return true;
0218   if(a_format=="inzb_jpeg") return true;
0219   if(a_format=="inzb_png") return true;
0220   return false;
0221 }
0222 
0223 inline bool paper_format_extension(const std::string& a_format,std::string& a_ext) {
0224   if(a_format=="gl2ps_eps") {a_ext = "eps";return true;}
0225   if(a_format=="gl2ps_ps")  {a_ext = "ps";return true;}
0226   if(a_format=="gl2ps_pdf") {a_ext = "pdf";return true;}
0227   if(a_format=="gl2ps_svg") {a_ext = "svg";return true;}
0228   if(a_format=="gl2ps_tex") {a_ext = "tex";return true;}
0229   if(a_format=="gl2ps_pgf") {a_ext = "pgf";return true;}
0230   if(a_format=="inzb_ps")   {a_ext = "ps";return true;}
0231   if(a_format=="inzb_jpeg") {a_ext = "jpeg";return true;}
0232   if(a_format=="inzb_png")  {a_ext = "png";return true;}
0233   a_ext.clear();
0234   return false;
0235 }
0236 
0237 }}
0238 
0239 #endif