Commit 363d3700165819bfc4251c1c925622a6c4a73c08
1 parent
e0b3f4fa
Issue warning if output observation definition file has no .xml suffix.
Output observation definition files are XML files, hence they should have a .xml suffix to avoid confusion with FITS files.
Showing
4 changed files
with
49 additions
and
1 deletions
src/ctbin/ctbin.cpp
| ... | ... | @@ -819,6 +819,18 @@ void ctbin::save_xml(void) |
| 819 | 819 | m_outfile = (*this)["outfile"].filename(); |
| 820 | 820 | m_prefix = (*this)["prefix"].string(); |
| 821 | 821 | |
| 822 | + // Issue warning if output filename has no .xml suffix | |
| 823 | + std::string suffix = gammalib::tolower(m_outfile.substr(m_outfile.length()-4,4)); | |
| 824 | + if (suffix != ".xml") { | |
| 825 | + log << "*** WARNING: Name of observation definition output file \""+ | |
| 826 | + m_outfile+"\"" << std::endl; | |
| 827 | + log << "*** WARNING: does not terminate with \".xml\"." << std::endl; | |
| 828 | + log << "*** WARNING: This is not an error, but might be misleading." | |
| 829 | + " It is recommended" << std::endl; | |
| 830 | + log << "*** WARNING: to use the suffix \".xml\" for observation" | |
| 831 | + " definition files." << std::endl; | |
| 832 | + } | |
| 833 | + | |
| 822 | 834 | // Loop over all observation in the container |
| 823 | 835 | for (int i = 0; i < m_obs.size(); ++i) { |
| 824 | 836 | ... | ... |
src/ctmodel/ctmodel.cpp
| ... | ... | @@ -821,6 +821,18 @@ void ctmodel::save_xml(void) |
| 821 | 821 | m_outfile = (*this)["outfile"].filename(); |
| 822 | 822 | m_prefix = (*this)["prefix"].string(); |
| 823 | 823 | |
| 824 | + // Issue warning if output filename has no .xml suffix | |
| 825 | + std::string suffix = gammalib::tolower(m_outfile.substr(m_outfile.length()-4,4)); | |
| 826 | + if (suffix != ".xml") { | |
| 827 | + log << "*** WARNING: Name of observation definition output file \""+ | |
| 828 | + m_outfile+"\"" << std::endl; | |
| 829 | + log << "*** WARNING: does not terminate with \".xml\"." << std::endl; | |
| 830 | + log << "*** WARNING: This is not an error, but might be misleading." | |
| 831 | + " It is recommended" << std::endl; | |
| 832 | + log << "*** WARNING: to use the suffix \".xml\" for observation" | |
| 833 | + " definition files." << std::endl; | |
| 834 | + } | |
| 835 | + | |
| 824 | 836 | // Loop over all observation in the container |
| 825 | 837 | for (int i = 0; i < m_obs.size(); ++i) { |
| 826 | 838 | ... | ... |
src/ctobssim/ctobssim.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * ctobssim - CTA observation simulator tool * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2013 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2011-2014 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -1100,6 +1100,18 @@ void ctobssim::save_xml(void) |
| 1100 | 1100 | m_outfile = (*this)["outfile"].filename(); |
| 1101 | 1101 | m_prefix = (*this)["prefix"].string(); |
| 1102 | 1102 | |
| 1103 | + // Issue warning if output filename has no .xml suffix | |
| 1104 | + std::string suffix = gammalib::tolower(m_outfile.substr(m_outfile.length()-4,4)); | |
| 1105 | + if (suffix != ".xml") { | |
| 1106 | + log << "*** WARNING: Name of observation definition output file \""+ | |
| 1107 | + m_outfile+"\"" << std::endl; | |
| 1108 | + log << "*** WARNING: does not terminate with \".xml\"." << std::endl; | |
| 1109 | + log << "*** WARNING: This is not an error, but might be misleading." | |
| 1110 | + " It is recommended" << std::endl; | |
| 1111 | + log << "*** WARNING: to use the suffix \".xml\" for observation" | |
| 1112 | + " definition files." << std::endl; | |
| 1113 | + } | |
| 1114 | + | |
| 1103 | 1115 | // Initialise file number |
| 1104 | 1116 | int file_num = 0; |
| 1105 | 1117 | ... | ... |
src/ctselect/ctselect.cpp
| ... | ... | @@ -905,6 +905,18 @@ void ctselect::save_xml(void) |
| 905 | 905 | m_outfile = (*this)["outfile"].filename(); |
| 906 | 906 | m_prefix = (*this)["prefix"].string(); |
| 907 | 907 | |
| 908 | + // Issue warning if output filename has no .xml suffix | |
| 909 | + std::string suffix = gammalib::tolower(m_outfile.substr(m_outfile.length()-4,4)); | |
| 910 | + if (suffix != ".xml") { | |
| 911 | + log << "*** WARNING: Name of observation definition output file \""+ | |
| 912 | + m_outfile+"\"" << std::endl; | |
| 913 | + log << "*** WARNING: does not terminate with \".xml\"." << std::endl; | |
| 914 | + log << "*** WARNING: This is not an error, but might be misleading." | |
| 915 | + " It is recommended" << std::endl; | |
| 916 | + log << "*** WARNING: to use the suffix \".xml\" for observation" | |
| 917 | + " definition files." << std::endl; | |
| 918 | + } | |
| 919 | + | |
| 908 | 920 | // Loop over all observation in the container |
| 909 | 921 | for (int i = 0; i < m_obs.size(); ++i) { |
| 910 | 922 | ... | ... |