Commit 46d3467f0273135de2fb67883ad9ea22ffeec280
1 parent
8ebb4df8
Avoid mangling of log files after application pickling (#2421)
Showing
9 changed files
with
167 additions
and
178 deletions
pyext/ctlikelihood.i
| @@ -45,19 +45,19 @@ public: | @@ -45,19 +45,19 @@ public: | ||
| 45 | cslikelihood(const std::string& name, | 45 | cslikelihood(const std::string& name, |
| 46 | const std::string& version) : | 46 | const std::string& version) : |
| 47 | ctlikelihood(name, version) {} | 47 | ctlikelihood(name, version) {} |
| 48 | - cslikelihood(const std::string& name, | ||
| 49 | - const std::string& version, | ||
| 50 | - const GObservations& obs) : | ||
| 51 | - ctlikelihood(name, version, obs) {} | ||
| 52 | - cslikelihood(const std::string& name, | ||
| 53 | - const std::string& version, | ||
| 54 | - const std::vector<std::string>& args) : | ||
| 55 | - ctlikelihood(name, version, args) {} | 48 | + cslikelihood(const std::string& name, |
| 49 | + const std::string& version, | ||
| 50 | + const GApplicationPars& pars) : | ||
| 51 | + ctlikelihood(name, version, pars) {} | ||
| 56 | cslikelihood(const std::string& name, | 52 | cslikelihood(const std::string& name, |
| 57 | const std::string& version, | 53 | const std::string& version, |
| 58 | int argc, | 54 | int argc, |
| 59 | char* argv[]) : | 55 | char* argv[]) : |
| 60 | ctlikelihood(name, version, argc, argv) {} | 56 | ctlikelihood(name, version, argc, argv) {} |
| 57 | + cslikelihood(const std::string& name, | ||
| 58 | + const std::string& version, | ||
| 59 | + const GObservations& obs) : | ||
| 60 | + ctlikelihood(name, version, obs) {} | ||
| 61 | cslikelihood(const cslikelihood& app) : ctlikelihood(app) {} | 61 | cslikelihood(const cslikelihood& app) : ctlikelihood(app) {} |
| 62 | virtual ~cslikelihood(void) {} | 62 | virtual ~cslikelihood(void) {} |
| 63 | 63 | ||
| @@ -84,16 +84,16 @@ public: | @@ -84,16 +84,16 @@ public: | ||
| 84 | // Constructors and destructors | 84 | // Constructors and destructors |
| 85 | ctlikelihood(const std::string& name, | 85 | ctlikelihood(const std::string& name, |
| 86 | const std::string& version); | 86 | const std::string& version); |
| 87 | - ctlikelihood(const std::string& name, | ||
| 88 | - const std::string& version, | ||
| 89 | - const GObservations& obs); | ||
| 90 | - ctlikelihood(const std::string& name, | ||
| 91 | - const std::string& version, | ||
| 92 | - const std::vector<std::string>& args); | 87 | + ctlikelihood(const std::string& name, |
| 88 | + const std::string& version, | ||
| 89 | + const GApplicationPars& pars); | ||
| 93 | ctlikelihood(const std::string& name, | 90 | ctlikelihood(const std::string& name, |
| 94 | const std::string& version, | 91 | const std::string& version, |
| 95 | int argc, | 92 | int argc, |
| 96 | char* argv[]); | 93 | char* argv[]); |
| 94 | + ctlikelihood(const std::string& name, | ||
| 95 | + const std::string& version, | ||
| 96 | + const GObservations& obs); | ||
| 97 | ctlikelihood(const ctlikelihood& app); | 97 | ctlikelihood(const ctlikelihood& app); |
| 98 | virtual ~ctlikelihood(void); | 98 | virtual ~ctlikelihood(void); |
| 99 | 99 | ||
| @@ -125,16 +125,16 @@ public: | @@ -125,16 +125,16 @@ public: | ||
| 125 | // Constructors and destructors | 125 | // Constructors and destructors |
| 126 | cslikelihood(const std::string& name, | 126 | cslikelihood(const std::string& name, |
| 127 | const std::string& version); | 127 | const std::string& version); |
| 128 | - cslikelihood(const std::string& name, | ||
| 129 | - const std::string& version, | ||
| 130 | - const GObservations& obs); | ||
| 131 | - cslikelihood(const std::string& name, | ||
| 132 | - const std::string& version, | ||
| 133 | - const std::vector<std::string>& args); | 128 | + cslikelihood(const std::string& name, |
| 129 | + const std::string& version, | ||
| 130 | + const GApplicationPars& pars); | ||
| 134 | cslikelihood(const std::string& name, | 131 | cslikelihood(const std::string& name, |
| 135 | const std::string& version, | 132 | const std::string& version, |
| 136 | int ARGC, | 133 | int ARGC, |
| 137 | char **ARGV); | 134 | char **ARGV); |
| 135 | + cslikelihood(const std::string& name, | ||
| 136 | + const std::string& version, | ||
| 137 | + const GObservations& obs); | ||
| 138 | cslikelihood(const cslikelihood& app); | 138 | cslikelihood(const cslikelihood& app); |
| 139 | virtual ~cslikelihood(void); | 139 | virtual ~cslikelihood(void); |
| 140 | 140 |
pyext/ctobservation.i
| @@ -45,19 +45,19 @@ public: | @@ -45,19 +45,19 @@ public: | ||
| 45 | csobservation(const std::string& name, | 45 | csobservation(const std::string& name, |
| 46 | const std::string& version) : | 46 | const std::string& version) : |
| 47 | ctobservation(name, version) {} | 47 | ctobservation(name, version) {} |
| 48 | - csobservation(const std::string& name, | ||
| 49 | - const std::string& version, | ||
| 50 | - const GObservations& obs) : | ||
| 51 | - ctobservation(name, version, obs) {} | ||
| 52 | - csobservation(const std::string& name, | ||
| 53 | - const std::string& version, | ||
| 54 | - const std::vector<std::string>& args) : | ||
| 55 | - ctobservation(name, version, args) {} | 48 | + csobservation(const std::string& name, |
| 49 | + const std::string& version, | ||
| 50 | + const GApplicationPars& pars) : | ||
| 51 | + ctobservation(name, version, pars) {} | ||
| 56 | csobservation(const std::string& name, | 52 | csobservation(const std::string& name, |
| 57 | const std::string& version, | 53 | const std::string& version, |
| 58 | int argc, | 54 | int argc, |
| 59 | char* argv[]) : | 55 | char* argv[]) : |
| 60 | ctobservation(name, version, argc, argv) {} | 56 | ctobservation(name, version, argc, argv) {} |
| 57 | + csobservation(const std::string& name, | ||
| 58 | + const std::string& version, | ||
| 59 | + const GObservations& obs) : | ||
| 60 | + ctobservation(name, version, obs) {} | ||
| 61 | csobservation(const csobservation& app) : ctobservation(app) {} | 61 | csobservation(const csobservation& app) : ctobservation(app) {} |
| 62 | virtual ~csobservation(void) {} | 62 | virtual ~csobservation(void) {} |
| 63 | 63 | ||
| @@ -84,16 +84,16 @@ public: | @@ -84,16 +84,16 @@ public: | ||
| 84 | // Constructors and destructors | 84 | // Constructors and destructors |
| 85 | ctobservation(const std::string& name, | 85 | ctobservation(const std::string& name, |
| 86 | const std::string& version); | 86 | const std::string& version); |
| 87 | - ctobservation(const std::string& name, | ||
| 88 | - const std::string& version, | ||
| 89 | - const GObservations& obs); | ||
| 90 | - ctobservation(const std::string& name, | ||
| 91 | - const std::string& version, | ||
| 92 | - const std::vector<std::string>& args); | 87 | + ctobservation(const std::string& name, |
| 88 | + const std::string& version, | ||
| 89 | + const GApplicationPars& pars); | ||
| 93 | ctobservation(const std::string& name, | 90 | ctobservation(const std::string& name, |
| 94 | const std::string& version, | 91 | const std::string& version, |
| 95 | int ARGC, | 92 | int ARGC, |
| 96 | char **ARGV); | 93 | char **ARGV); |
| 94 | + ctobservation(const std::string& name, | ||
| 95 | + const std::string& version, | ||
| 96 | + const GObservations& obs); | ||
| 97 | ctobservation(const ctobservation& app); | 97 | ctobservation(const ctobservation& app); |
| 98 | virtual ~ctobservation(void); | 98 | virtual ~ctobservation(void); |
| 99 | 99 | ||
| @@ -137,16 +137,16 @@ public: | @@ -137,16 +137,16 @@ public: | ||
| 137 | // Constructors and destructors | 137 | // Constructors and destructors |
| 138 | csobservation(const std::string& name, | 138 | csobservation(const std::string& name, |
| 139 | const std::string& version); | 139 | const std::string& version); |
| 140 | - csobservation(const std::string& name, | ||
| 141 | - const std::string& version, | ||
| 142 | - const GObservations& obs); | ||
| 143 | - csobservation(const std::string& name, | ||
| 144 | - const std::string& version, | ||
| 145 | - const std::vector<std::string>& args); | 140 | + csobservation(const std::string& name, |
| 141 | + const std::string& version, | ||
| 142 | + const GApplicationPars& pars); | ||
| 146 | csobservation(const std::string& name, | 143 | csobservation(const std::string& name, |
| 147 | const std::string& version, | 144 | const std::string& version, |
| 148 | int ARGC, | 145 | int ARGC, |
| 149 | char **ARGV); | 146 | char **ARGV); |
| 147 | + csobservation(const std::string& name, | ||
| 148 | + const std::string& version, | ||
| 149 | + const GObservations& obs); | ||
| 150 | csobservation(const csobservation& app); | 150 | csobservation(const csobservation& app); |
| 151 | virtual ~csobservation(void); | 151 | virtual ~csobservation(void); |
| 152 | 152 |
pyext/ctool.i
| @@ -38,9 +38,9 @@ public: | @@ -38,9 +38,9 @@ public: | ||
| 38 | // Constructors and destructors | 38 | // Constructors and destructors |
| 39 | cscript(const std::string& name, | 39 | cscript(const std::string& name, |
| 40 | const std::string& version) : ctool(name, version) {} | 40 | const std::string& version) : ctool(name, version) {} |
| 41 | - cscript(const std::string& name, | ||
| 42 | - const std::string& version, | ||
| 43 | - const std::vector<std::string>& args) : ctool(name, version, args) {} | 41 | + cscript(const std::string& name, |
| 42 | + const std::string& version, | ||
| 43 | + const GApplicationPars& pars) : ctool(name, version, pars) {} | ||
| 44 | cscript(const std::string& name, | 44 | cscript(const std::string& name, |
| 45 | const std::string& version, | 45 | const std::string& version, |
| 46 | int argc, | 46 | int argc, |
| @@ -75,9 +75,9 @@ public: | @@ -75,9 +75,9 @@ public: | ||
| 75 | // Constructors and destructors | 75 | // Constructors and destructors |
| 76 | ctool(const std::string& name, | 76 | ctool(const std::string& name, |
| 77 | const std::string& version); | 77 | const std::string& version); |
| 78 | - ctool(const std::string& name, | ||
| 79 | - const std::string& version, | ||
| 80 | - const std::vector<std::string>& args); | 78 | + ctool(const std::string& name, |
| 79 | + const std::string& version, | ||
| 80 | + const GApplicationPars& pars); | ||
| 81 | ctool(const std::string& name, | 81 | ctool(const std::string& name, |
| 82 | const std::string& version, | 82 | const std::string& version, |
| 83 | int ARGC, | 83 | int ARGC, |
| @@ -200,9 +200,15 @@ public: | @@ -200,9 +200,15 @@ public: | ||
| 200 | class cscript : public ctool { | 200 | class cscript : public ctool { |
| 201 | public: | 201 | public: |
| 202 | // Constructors and destructors | 202 | // Constructors and destructors |
| 203 | - cscript(const std::string& name, const std::string& version); | ||
| 204 | - cscript(const std::string& name, const std::string& version, | ||
| 205 | - int ARGC, char **ARGV); | 203 | + cscript(const std::string& name, |
| 204 | + const std::string& version); | ||
| 205 | + cscript(const std::string& name, | ||
| 206 | + const std::string& version, | ||
| 207 | + const GApplicationPars& pars); | ||
| 208 | + cscript(const std::string& name, | ||
| 209 | + const std::string& version, | ||
| 210 | + int ARGC, | ||
| 211 | + char **ARGV); | ||
| 206 | cscript(const ctool& app); | 212 | cscript(const ctool& app); |
| 207 | virtual ~cscript(void); | 213 | virtual ~cscript(void); |
| 208 | 214 |
src/support/ctlikelihood.cpp
| @@ -55,7 +55,7 @@ | @@ -55,7 +55,7 @@ | ||
| 55 | ***************************************************************************/ | 55 | ***************************************************************************/ |
| 56 | ctlikelihood::ctlikelihood(const std::string& name, | 56 | ctlikelihood::ctlikelihood(const std::string& name, |
| 57 | const std::string& version) : | 57 | const std::string& version) : |
| 58 | - ctobservation(name, version) | 58 | + ctobservation(name, version) |
| 59 | { | 59 | { |
| 60 | // Initialise members | 60 | // Initialise members |
| 61 | init_members(); | 61 | init_members(); |
| @@ -66,19 +66,20 @@ ctlikelihood::ctlikelihood(const std::string& name, | @@ -66,19 +66,20 @@ ctlikelihood::ctlikelihood(const std::string& name, | ||
| 66 | 66 | ||
| 67 | 67 | ||
| 68 | /***********************************************************************//** | 68 | /***********************************************************************//** |
| 69 | - * @brief Observations constructor | 69 | + * @brief Application parameters constructor |
| 70 | * | 70 | * |
| 71 | - * @param[in] name Likelihood tool name. | ||
| 72 | - * @param[in] version Likelihood tool version. | ||
| 73 | - * param[in] obs Observation container. | 71 | + * @param[in] name Observation tool name. |
| 72 | + * @param[in] version Observation tool version. | ||
| 73 | + * @param[in] pars Application parameters. | ||
| 74 | * | 74 | * |
| 75 | - * Constructs a likelihood tool from the @p name, @p version and an | ||
| 76 | - * observation container. | 75 | + * Constructs a likelihood tool from the @p name, @p version and the |
| 76 | + * application parameters @p pars. See the equivalent ctool constructor | ||
| 77 | + * for details. | ||
| 77 | ***************************************************************************/ | 78 | ***************************************************************************/ |
| 78 | -ctlikelihood::ctlikelihood(const std::string& name, | ||
| 79 | - const std::string& version, | ||
| 80 | - const GObservations& obs) : | ||
| 81 | - ctobservation(name, version, obs) | 79 | +ctlikelihood::ctlikelihood(const std::string& name, |
| 80 | + const std::string& version, | ||
| 81 | + const GApplicationPars& pars) : | ||
| 82 | + ctobservation(name, version, pars) | ||
| 82 | { | 83 | { |
| 83 | // Initialise members | 84 | // Initialise members |
| 84 | init_members(); | 85 | init_members(); |
| @@ -93,15 +94,17 @@ ctlikelihood::ctlikelihood(const std::string& name, | @@ -93,15 +94,17 @@ ctlikelihood::ctlikelihood(const std::string& name, | ||
| 93 | * | 94 | * |
| 94 | * @param[in] name Likelihood tool name. | 95 | * @param[in] name Likelihood tool name. |
| 95 | * @param[in] version Likelihood tool version. | 96 | * @param[in] version Likelihood tool version. |
| 96 | - * @param[in] args Arguments vector. | 97 | + * @param[in] argc Number of arguments in command line. |
| 98 | + * @param[in] argv Array of command line arguments. | ||
| 97 | * | 99 | * |
| 98 | * Constructs a likelihood tool from the @p name, @p version and command | 100 | * Constructs a likelihood tool from the @p name, @p version and command |
| 99 | * line arguments. See the equivalent ctool constructor for details. | 101 | * line arguments. See the equivalent ctool constructor for details. |
| 100 | ***************************************************************************/ | 102 | ***************************************************************************/ |
| 101 | -ctlikelihood::ctlikelihood(const std::string& name, | ||
| 102 | - const std::string& version, | ||
| 103 | - const std::vector<std::string>& args) : | ||
| 104 | - ctobservation(name, version, args) | 103 | +ctlikelihood::ctlikelihood(const std::string& name, |
| 104 | + const std::string& version, | ||
| 105 | + int argc, | ||
| 106 | + char *argv[]) : | ||
| 107 | + ctobservation(name, version, argc, argv) | ||
| 105 | { | 108 | { |
| 106 | // Initialise members | 109 | // Initialise members |
| 107 | init_members(); | 110 | init_members(); |
| @@ -112,21 +115,19 @@ ctlikelihood::ctlikelihood(const std::string& name, | @@ -112,21 +115,19 @@ ctlikelihood::ctlikelihood(const std::string& name, | ||
| 112 | 115 | ||
| 113 | 116 | ||
| 114 | /***********************************************************************//** | 117 | /***********************************************************************//** |
| 115 | - * @brief Command line constructor | 118 | + * @brief Observations constructor |
| 116 | * | 119 | * |
| 117 | * @param[in] name Likelihood tool name. | 120 | * @param[in] name Likelihood tool name. |
| 118 | * @param[in] version Likelihood tool version. | 121 | * @param[in] version Likelihood tool version. |
| 119 | - * @param[in] argc Number of arguments in command line. | ||
| 120 | - * @param[in] argv Array of command line arguments. | 122 | + * param[in] obs Observation container. |
| 121 | * | 123 | * |
| 122 | - * Constructs a likelihood tool from the @p name, @p version and command | ||
| 123 | - * line arguments. See the equivalent ctool constructor for details. | 124 | + * Constructs a likelihood tool from the @p name, @p version and an |
| 125 | + * observation container. | ||
| 124 | ***************************************************************************/ | 126 | ***************************************************************************/ |
| 125 | -ctlikelihood::ctlikelihood(const std::string& name, | ||
| 126 | - const std::string& version, | ||
| 127 | - int argc, | ||
| 128 | - char *argv[]) : | ||
| 129 | - ctobservation(name, version, argc, argv) | 127 | +ctlikelihood::ctlikelihood(const std::string& name, |
| 128 | + const std::string& version, | ||
| 129 | + const GObservations& obs) : | ||
| 130 | + ctobservation(name, version, obs) | ||
| 130 | { | 131 | { |
| 131 | // Initialise members | 132 | // Initialise members |
| 132 | init_members(); | 133 | init_members(); |
src/support/ctlikelihood.hpp
| @@ -44,16 +44,16 @@ public: | @@ -44,16 +44,16 @@ public: | ||
| 44 | // Constructors and destructors | 44 | // Constructors and destructors |
| 45 | ctlikelihood(const std::string& name, | 45 | ctlikelihood(const std::string& name, |
| 46 | const std::string& version); | 46 | const std::string& version); |
| 47 | - ctlikelihood(const std::string& name, | ||
| 48 | - const std::string& version, | ||
| 49 | - const GObservations& obs); | ||
| 50 | - ctlikelihood(const std::string& name, | ||
| 51 | - const std::string& version, | ||
| 52 | - const std::vector<std::string>& args); | 47 | + ctlikelihood(const std::string& name, |
| 48 | + const std::string& version, | ||
| 49 | + const GApplicationPars& pars); | ||
| 53 | ctlikelihood(const std::string& name, | 50 | ctlikelihood(const std::string& name, |
| 54 | const std::string& version, | 51 | const std::string& version, |
| 55 | int argc, | 52 | int argc, |
| 56 | char* argv[]); | 53 | char* argv[]); |
| 54 | + ctlikelihood(const std::string& name, | ||
| 55 | + const std::string& version, | ||
| 56 | + const GObservations& obs); | ||
| 57 | ctlikelihood(const ctlikelihood& app); | 57 | ctlikelihood(const ctlikelihood& app); |
| 58 | virtual ~ctlikelihood(void); | 58 | virtual ~ctlikelihood(void); |
| 59 | 59 |
src/support/ctobservation.cpp
| @@ -64,25 +64,24 @@ ctobservation::ctobservation(const std::string& name, | @@ -64,25 +64,24 @@ ctobservation::ctobservation(const std::string& name, | ||
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | /***********************************************************************//** | 66 | /***********************************************************************//** |
| 67 | - * @brief Observations constructor | 67 | + * @brief Application parameters constructor |
| 68 | * | 68 | * |
| 69 | * @param[in] name Observation tool name. | 69 | * @param[in] name Observation tool name. |
| 70 | * @param[in] version Observation tool version. | 70 | * @param[in] version Observation tool version. |
| 71 | - * param[in] obs Observation container. | 71 | + * @param[in] pars Application parameters. |
| 72 | * | 72 | * |
| 73 | - * Constructs a observation tool from the @p name, @p version and an | ||
| 74 | - * observation container. | 73 | + * Constructs a observation tool from the @p name, @p version and the |
| 74 | + * application parameters @p pars. See the equivalent ctool constructor | ||
| 75 | + * for details. | ||
| 75 | ***************************************************************************/ | 76 | ***************************************************************************/ |
| 76 | -ctobservation::ctobservation(const std::string& name, | ||
| 77 | - const std::string& version, | ||
| 78 | - const GObservations& obs) : ctool(name, version) | 77 | +ctobservation::ctobservation(const std::string& name, |
| 78 | + const std::string& version, | ||
| 79 | + const GApplicationPars& pars) : | ||
| 80 | + ctool(name, version, pars) | ||
| 79 | { | 81 | { |
| 80 | // Initialise members | 82 | // Initialise members |
| 81 | init_members(); | 83 | init_members(); |
| 82 | 84 | ||
| 83 | - // Set observations | ||
| 84 | - m_obs = obs; | ||
| 85 | - | ||
| 86 | // Return | 85 | // Return |
| 87 | return; | 86 | return; |
| 88 | } | 87 | } |
| @@ -93,15 +92,16 @@ ctobservation::ctobservation(const std::string& name, | @@ -93,15 +92,16 @@ ctobservation::ctobservation(const std::string& name, | ||
| 93 | * | 92 | * |
| 94 | * @param[in] name Observation tool name. | 93 | * @param[in] name Observation tool name. |
| 95 | * @param[in] version Observation tool version. | 94 | * @param[in] version Observation tool version. |
| 96 | - * @param[in] args Arguments vector. | 95 | + * @param[in] argc Number of arguments in command line. |
| 96 | + * @param[in] argv Array of command line arguments. | ||
| 97 | * | 97 | * |
| 98 | * Constructs a observation tool from the @p name, @p version and command | 98 | * Constructs a observation tool from the @p name, @p version and command |
| 99 | * line arguments. See the equivalent ctool constructor for details. | 99 | * line arguments. See the equivalent ctool constructor for details. |
| 100 | ***************************************************************************/ | 100 | ***************************************************************************/ |
| 101 | -ctobservation::ctobservation(const std::string& name, | ||
| 102 | - const std::string& version, | ||
| 103 | - const std::vector<std::string>& args) : | ||
| 104 | - ctool(name, version, args) | 101 | +ctobservation::ctobservation(const std::string& name, |
| 102 | + const std::string& version, | ||
| 103 | + int argc, | ||
| 104 | + char *argv[]) : ctool(name, version, argc, argv) | ||
| 105 | { | 105 | { |
| 106 | // Initialise members | 106 | // Initialise members |
| 107 | init_members(); | 107 | init_members(); |
| @@ -112,24 +112,25 @@ ctobservation::ctobservation(const std::string& name, | @@ -112,24 +112,25 @@ ctobservation::ctobservation(const std::string& name, | ||
| 112 | 112 | ||
| 113 | 113 | ||
| 114 | /***********************************************************************//** | 114 | /***********************************************************************//** |
| 115 | - * @brief Command line constructor | 115 | + * @brief Observations constructor |
| 116 | * | 116 | * |
| 117 | * @param[in] name Observation tool name. | 117 | * @param[in] name Observation tool name. |
| 118 | * @param[in] version Observation tool version. | 118 | * @param[in] version Observation tool version. |
| 119 | - * @param[in] argc Number of arguments in command line. | ||
| 120 | - * @param[in] argv Array of command line arguments. | 119 | + * param[in] obs Observation container. |
| 121 | * | 120 | * |
| 122 | - * Constructs a observation tool from the @p name, @p version and command | ||
| 123 | - * line arguments. See the equivalent ctool constructor for details. | 121 | + * Constructs a observation tool from the @p name, @p version and an |
| 122 | + * observation container. | ||
| 124 | ***************************************************************************/ | 123 | ***************************************************************************/ |
| 125 | -ctobservation::ctobservation(const std::string& name, | ||
| 126 | - const std::string& version, | ||
| 127 | - int argc, | ||
| 128 | - char *argv[]) : ctool(name, version, argc, argv) | 124 | +ctobservation::ctobservation(const std::string& name, |
| 125 | + const std::string& version, | ||
| 126 | + const GObservations& obs) : ctool(name, version) | ||
| 129 | { | 127 | { |
| 130 | // Initialise members | 128 | // Initialise members |
| 131 | init_members(); | 129 | init_members(); |
| 132 | 130 | ||
| 131 | + // Set observations | ||
| 132 | + m_obs = obs; | ||
| 133 | + | ||
| 133 | // Return | 134 | // Return |
| 134 | return; | 135 | return; |
| 135 | } | 136 | } |
src/support/ctobservation.hpp
| @@ -47,16 +47,16 @@ public: | @@ -47,16 +47,16 @@ public: | ||
| 47 | // Constructors and destructors | 47 | // Constructors and destructors |
| 48 | ctobservation(const std::string& name, | 48 | ctobservation(const std::string& name, |
| 49 | const std::string& version); | 49 | const std::string& version); |
| 50 | - ctobservation(const std::string& name, | ||
| 51 | - const std::string& version, | ||
| 52 | - const GObservations& obs); | ||
| 53 | - ctobservation(const std::string& name, | ||
| 54 | - const std::string& version, | ||
| 55 | - const std::vector<std::string>& args); | 50 | + ctobservation(const std::string& name, |
| 51 | + const std::string& version, | ||
| 52 | + const GApplicationPars& pars); | ||
| 56 | ctobservation(const std::string& name, | 53 | ctobservation(const std::string& name, |
| 57 | const std::string& version, | 54 | const std::string& version, |
| 58 | int argc, | 55 | int argc, |
| 59 | char* argv[]); | 56 | char* argv[]); |
| 57 | + ctobservation(const std::string& name, | ||
| 58 | + const std::string& version, | ||
| 59 | + const GObservations& obs); | ||
| 60 | ctobservation(const ctobservation& app); | 60 | ctobservation(const ctobservation& app); |
| 61 | virtual ~ctobservation(void); | 61 | virtual ~ctobservation(void); |
| 62 | 62 |
src/support/ctool.cpp
| @@ -92,19 +92,8 @@ ctool::ctool(const std::string& name, | @@ -92,19 +92,8 @@ ctool::ctool(const std::string& name, | ||
| 92 | // Initialise members | 92 | // Initialise members |
| 93 | init_members(); | 93 | init_members(); |
| 94 | 94 | ||
| 95 | - // If CTOOLS environment variable is set and if a parameter exists in | ||
| 96 | - // the syspfiles folder then set syspfiles folder and reload parameter | ||
| 97 | - // file | ||
| 98 | - char* ptr = std::getenv("CTOOLS"); | ||
| 99 | - if (ptr != NULL) { | ||
| 100 | - std::string path = std::string(ptr) + "/syspfiles"; | ||
| 101 | - std::string filename = path + "/" + par_filename(); | ||
| 102 | - if (access(filename.c_str(), R_OK) == 0) { | ||
| 103 | - m_pars.clear(); | ||
| 104 | - m_pars.syspfiles(path); | ||
| 105 | - m_pars.load(par_filename()); | ||
| 106 | - } | ||
| 107 | - } | 95 | + // Synchronise parameter files |
| 96 | + sync_pfiles(); | ||
| 108 | 97 | ||
| 109 | // Return | 98 | // Return |
| 110 | return; | 99 | return; |
| @@ -112,49 +101,24 @@ ctool::ctool(const std::string& name, | @@ -112,49 +101,24 @@ ctool::ctool(const std::string& name, | ||
| 112 | 101 | ||
| 113 | 102 | ||
| 114 | /***********************************************************************//** | 103 | /***********************************************************************//** |
| 115 | - * @brief Command line constructor | 104 | + * @brief Application parameter constructor |
| 116 | * | 105 | * |
| 117 | * @param[in] name Application name. | 106 | * @param[in] name Application name. |
| 118 | * @param[in] version Application version. | 107 | * @param[in] version Application version. |
| 119 | - * @param[in] args Arguments vector. | 108 | + * @param[in] pars Application parameters. |
| 120 | * | 109 | * |
| 121 | - * Constructs a ctool from the @p name, @p version and command line | ||
| 122 | - * arguments. The constructor uses the equivalent GApplication constructor | 110 | + * Constructs a ctool from the @p name, @p version and application parameters |
| 111 | + * @p pars. The constructor uses the equivalent GApplication constructor | ||
| 123 | * to set the parameter filename to "<name>.par" and the log filename to | 112 | * to set the parameter filename to "<name>.par" and the log filename to |
| 124 | - * "<name>".log. The parameters will be loaded from the parameter file. | ||
| 125 | - * In addition, the constructor opens the log file. | ||
| 126 | - * | ||
| 127 | - * If the "--help" option is provided as command line argument a help text | ||
| 128 | - * about the usage of the ctool will be shown in the console and the ctool | ||
| 129 | - * will exit. No log file will be opened in that case. | 113 | + * "<name>".log. The constructor opens the log file. |
| 130 | ***************************************************************************/ | 114 | ***************************************************************************/ |
| 131 | -ctool::ctool(const std::string& name, | ||
| 132 | - const std::string& version, | ||
| 133 | - const std::vector<std::string>& args) : GApplication(name, version, args) | 115 | +ctool::ctool(const std::string& name, |
| 116 | + const std::string& version, | ||
| 117 | + const GApplicationPars& pars) : GApplication(name, version, pars) | ||
| 134 | { | 118 | { |
| 135 | - // Catch --help option before doing anything else | ||
| 136 | - if (need_help()) { | ||
| 137 | - provide_help(); | ||
| 138 | - exit(0); | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | // Initialise members | 119 | // Initialise members |
| 142 | init_members(); | 120 | init_members(); |
| 143 | 121 | ||
| 144 | - // If CTOOLS environment variable is set and if a parameter exists in | ||
| 145 | - // the syspfiles folder then set syspfiles folder and reload parameter | ||
| 146 | - // file | ||
| 147 | - char* ptr = std::getenv("CTOOLS"); | ||
| 148 | - if (ptr != NULL) { | ||
| 149 | - std::string path = std::string(ptr) + "/syspfiles"; | ||
| 150 | - std::string filename = path + "/" + par_filename(); | ||
| 151 | - if (access(filename.c_str(), R_OK) == 0) { | ||
| 152 | - m_pars.clear(); | ||
| 153 | - m_pars.syspfiles(path); | ||
| 154 | - m_pars.load(par_filename(), m_args); | ||
| 155 | - } | ||
| 156 | - } | ||
| 157 | - | ||
| 158 | // Open the log file | 122 | // Open the log file |
| 159 | logFileOpen(); | 123 | logFileOpen(); |
| 160 | 124 | ||
| @@ -195,19 +159,8 @@ ctool::ctool(const std::string& name, | @@ -195,19 +159,8 @@ ctool::ctool(const std::string& name, | ||
| 195 | // Initialise members | 159 | // Initialise members |
| 196 | init_members(); | 160 | init_members(); |
| 197 | 161 | ||
| 198 | - // If CTOOLS environment variable is set and if a parameter exists in | ||
| 199 | - // the syspfiles folder then set syspfiles folder and reload parameter | ||
| 200 | - // file | ||
| 201 | - char* ptr = std::getenv("CTOOLS"); | ||
| 202 | - if (ptr != NULL) { | ||
| 203 | - std::string path = std::string(ptr) + "/syspfiles"; | ||
| 204 | - std::string filename = path + "/" + par_filename(); | ||
| 205 | - if (access(filename.c_str(), R_OK) == 0) { | ||
| 206 | - m_pars.clear(); | ||
| 207 | - m_pars.syspfiles(path); | ||
| 208 | - m_pars.load(par_filename(), m_args); | ||
| 209 | - } | ||
| 210 | - } | 162 | + // Synchronise parameter files |
| 163 | + sync_pfiles(); | ||
| 211 | 164 | ||
| 212 | // Open the log file | 165 | // Open the log file |
| 213 | logFileOpen(); | 166 | logFileOpen(); |
| @@ -370,6 +323,33 @@ void ctool::free_members(void) | @@ -370,6 +323,33 @@ void ctool::free_members(void) | ||
| 370 | 323 | ||
| 371 | 324 | ||
| 372 | /***********************************************************************//** | 325 | /***********************************************************************//** |
| 326 | + * @brief Synchronise parameter files | ||
| 327 | + * | ||
| 328 | + * Make sure that the structure of the parameter files in the syspfiles | ||
| 329 | + * folder is used as a reference. | ||
| 330 | + ***************************************************************************/ | ||
| 331 | +void ctool::sync_pfiles(void) | ||
| 332 | +{ | ||
| 333 | + // If CTOOLS environment variable is set and if a parameter file exists | ||
| 334 | + // in the syspfiles folder then set syspfiles folder and reload | ||
| 335 | + // parameter file | ||
| 336 | + char* ptr = std::getenv("CTOOLS"); | ||
| 337 | + if (ptr != NULL) { | ||
| 338 | + std::string path = std::string(ptr) + "/syspfiles"; | ||
| 339 | + std::string filename = path + "/" + par_filename(); | ||
| 340 | + if (access(filename.c_str(), R_OK) == 0) { | ||
| 341 | + m_pars.clear(); | ||
| 342 | + m_pars.syspfiles(path); | ||
| 343 | + m_pars.load(par_filename(), m_args); | ||
| 344 | + } | ||
| 345 | + } | ||
| 346 | + | ||
| 347 | + // Return | ||
| 348 | + return; | ||
| 349 | +} | ||
| 350 | + | ||
| 351 | + | ||
| 352 | +/***********************************************************************//** | ||
| 373 | * @brief Setup observation container | 353 | * @brief Setup observation container |
| 374 | * | 354 | * |
| 375 | * @param[in] obs Observation container | 355 | * @param[in] obs Observation container |
src/support/ctool.hpp
| @@ -52,9 +52,9 @@ public: | @@ -52,9 +52,9 @@ public: | ||
| 52 | // Constructors and destructors | 52 | // Constructors and destructors |
| 53 | ctool(const std::string& name, | 53 | ctool(const std::string& name, |
| 54 | const std::string& version); | 54 | const std::string& version); |
| 55 | - ctool(const std::string& name, | ||
| 56 | - const std::string& version, | ||
| 57 | - const std::vector<std::string>& args); | 55 | + ctool(const std::string& name, |
| 56 | + const std::string& version, | ||
| 57 | + const GApplicationPars& pars); | ||
| 58 | ctool(const std::string& name, | 58 | ctool(const std::string& name, |
| 59 | const std::string& version, | 59 | const std::string& version, |
| 60 | int argc, | 60 | int argc, |
| @@ -79,10 +79,11 @@ public: | @@ -79,10 +79,11 @@ public: | ||
| 79 | protected: | 79 | protected: |
| 80 | #endif | 80 | #endif |
| 81 | // Protected methods | 81 | // Protected methods |
| 82 | - void init_members(void); | ||
| 83 | - void copy_members(const ctool& app); | ||
| 84 | - void free_members(void); | ||
| 85 | - const bool& read_ahead(void) const; | 82 | + void init_members(void); |
| 83 | + void copy_members(const ctool& app); | ||
| 84 | + void free_members(void); | ||
| 85 | + void sync_pfiles(void); | ||
| 86 | + const bool& read_ahead(void) const; | ||
| 86 | 87 | ||
| 87 | // Protected high-level setup methods | 88 | // Protected high-level setup methods |
| 88 | void setup_observations(GObservations& obs, const bool& response = true, | 89 | void setup_observations(GObservations& obs, const bool& response = true, |
| @@ -154,7 +155,7 @@ protected: | @@ -154,7 +155,7 @@ protected: | ||
| 154 | protected: | 155 | protected: |
| 155 | // Protected methods | 156 | // Protected methods |
| 156 | void provide_help(void) const; | 157 | void provide_help(void) const; |
| 157 | - | 158 | + |
| 158 | // Protected members | 159 | // Protected members |
| 159 | bool m_use_xml; //!< Use XML file instead of FITS file for observations | 160 | bool m_use_xml; //!< Use XML file instead of FITS file for observations |
| 160 | }; | 161 | }; |