Commit 28bd01593abc7a641cb4bcfb135e9daf9f4b1ffa

Authored by Jürgen Knödlseder
1 parent 803b997f

Fix loss of application name and version (#1835)

The application name and version were cleared in a call of the GApplication::clear() method, but these properties should be conserved. Now they are, and a call of the GApplication::clear()  will perform the same actions than a call of the name and version constructor.
ChangeLog
1   -2016-08-03
  1 +2016-08-04
2 2  
3 3 * Version 1.2.0 released
4 4 =========================
5 5  
  6 + Fix loss of application name and version (#1835)
6 7 Add methods for logging in applications (#1828)
7 8 Fix removal of Python wrappers after make clean (#1826)
8 9 Add GModelSpectralExpInvPlaw class (#1800)
... ...
1 1 New Features and Important Changes in GammaLib 1.2.0
2 2  
3   -3 August 2016
  3 +4 August 2016
4 4  
5 5  
6 6 1. Introduction
... ... @@ -58,6 +58,10 @@ log_header2(), and log_header3() have been introduced. There are three
58 58 variants of log_value() for strings, integers and double precision values
59 59 (#1828).
60 60  
  61 +The application name and version and now conserved in a GApplication::clear()
  62 +method call and the application is properly initialised like in the call of
  63 +a constructor (#1835).
  64 +
61 65  
62 66 5. Base module
63 67 --------------
... ...
README.md
1 1 GammaLib information
2 2 ====================
3   -* Version: 1.2.0.dev1 (3 August 2016)
  3 +* Version: 1.2.0.dev1 (4 August 2016)
4 4 * Author: Juergen Knoedlseder (jurgen.knodlseder@irap.omp.eu)
5 5  
6 6 [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=gammalib-integrate-os)](https://cta-jenkins.irap.omp.eu/job/gammalib-integrate-os/)
... ...
src/app/GApplication.cpp
... ... @@ -238,12 +238,32 @@ GApplication& GApplication::operator=(const GApplication& app)
238 238 ***************************************************************************/
239 239 void GApplication::clear(void)
240 240 {
  241 + // Save application name and version as we need them to reconstruct
  242 + // the application after freeing and initialising its members
  243 + std::string name = m_name;
  244 + std::string version = m_version;
  245 +
241 246 // Free members
242 247 free_members();
243 248  
244 249 // Initialise members
245 250 init_members();
246 251  
  252 + // Recover saved application name and version
  253 + m_name = name;
  254 + m_version = version;
  255 +
  256 + // Set default parfile and logfile name
  257 + m_parfile = name+".par";
  258 + m_logfile = name+".log";
  259 +
  260 + // Initialise application parameters
  261 + m_pars.load(par_filename());
  262 +
  263 + // Set log filename and chattiness
  264 + set_log_filename();
  265 + set_log_chatter();
  266 +
247 267 // Return
248 268 return;
249 269 }
... ...