Commit a364fd37b517eb82bbfdf7d659e1ec9f6b3a4d9b

Authored by Jürgen Knödlseder
1 parent c1df9b3f

Add GApplication::pars() and GApplicationPar::current_value() methods (#1838)

ChangeLog
1   -2016-08-05
  1 +2016-08-06
2 2  
3 3 * Version 1.2.0 released
4 4 =========================
5 5  
  6 + Add GApplication::pars() and GApplicationPar::current_value() methods (#1838)
6 7 Add GLog is_open(), is_empty() and written_size() methods (#1837)
7 8 Fix invalid pointer problem in GLog copies (#1823)
8 9 Fix GSkyMap::publish() bug for empty sky maps (#1835)
... ...
1 1 New Features and Important Changes in GammaLib 1.2.0
2 2  
3   -5 August 2016
  3 +6 August 2016
4 4  
5 5  
6 6 1. Introduction
... ... @@ -27,6 +27,8 @@ The following methods have been added:
27 27 - GApplication::log_header1()
28 28 - GApplication::log_header2()
29 29 - GApplication::log_header3()
  30 +- GApplication::pars()
  31 +- GApplicationPar::current_value()
30 32 - GLog::is_open()
31 33 - GLog::is_empty()
32 34 - GLog::written_size()
... ... @@ -83,6 +85,11 @@ the number of characters on disk.
83 85 The GLog::max_size() method has been renamed to GLog::buffer_size since this
84 86 is more explicit (#1837).
85 87  
  88 +GApplication::pars() methods have been added to allow to retrieve or to set all
  89 +application parameters. The GApplicationPar::current_value() method has been
  90 +added to retrieve the current parameter value without querying for the parameter
  91 +(#1838).
  92 +
86 93  
87 94 5. Base module
88 95 --------------
... ...
README.md
1 1 GammaLib information
2 2 ====================
3   -* Version: 1.2.0.dev1 (5 August 2016)
  3 +* Version: 1.2.0.dev1 (6 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/)
... ...
include/GApplication.hpp
... ... @@ -63,47 +63,49 @@ public:
63 63 const GApplicationPar& operator[](const std::string& name) const;
64 64  
65 65 // Methods
66   - void clear(void);
67   - GApplication* clone(void) const;
68   - std::string classname(void) const;
69   - const std::string& name(void) const;
70   - const std::string& version(void) const;
71   - double telapse(void) const;
72   - double celapse(void) const;
73   - void logFileOpen(const bool& clobber = true);
74   - void logFileClose(void);
75   - bool logTerse(void) const;
76   - bool logNormal(void) const;
77   - bool logExplicit(void) const;
78   - bool logVerbose(void) const;
79   - bool logDebug(void) const;
80   - bool clobber(void) const;
81   - bool has_par(const std::string& name) const;
82   - const std::string& par_filename(void) const;
83   - const std::string& log_filename(void) const;
84   - void log_header(void);
85   - void log_trailer(void);
86   - void log_string(const GChatter& chatter,
87   - const std::string& string,
88   - const bool& linefeed = true);
89   - void log_value(const GChatter& chatter,
90   - const std::string& name,
91   - const std::string& value);
92   - void log_value(const GChatter& chatter,
93   - const std::string& name,
94   - const int& value);
95   - void log_value(const GChatter& chatter,
96   - const std::string& name,
97   - const double& value);
98   - void log_header1(const GChatter& chatter,
99   - const std::string& header);
100   - void log_header2(const GChatter& chatter,
101   - const std::string& header);
102   - void log_header3(const GChatter& chatter,
103   - const std::string& header);
104   - void log_parameters(const GChatter& chatter);
105   - const bool& need_help(void) const;
106   - std::string print(const GChatter& chatter = NORMAL) const;
  66 + void clear(void);
  67 + GApplication* clone(void) const;
  68 + std::string classname(void) const;
  69 + const std::string& name(void) const;
  70 + const std::string& version(void) const;
  71 + double telapse(void) const;
  72 + double celapse(void) const;
  73 + void logFileOpen(const bool& clobber = true);
  74 + void logFileClose(void);
  75 + bool logTerse(void) const;
  76 + bool logNormal(void) const;
  77 + bool logExplicit(void) const;
  78 + bool logVerbose(void) const;
  79 + bool logDebug(void) const;
  80 + bool clobber(void) const;
  81 + bool has_par(const std::string& name) const;
  82 + const std::string& par_filename(void) const;
  83 + const std::string& log_filename(void) const;
  84 + void log_header(void);
  85 + void log_trailer(void);
  86 + void log_string(const GChatter& chatter,
  87 + const std::string& string,
  88 + const bool& linefeed = true);
  89 + void log_value(const GChatter& chatter,
  90 + const std::string& name,
  91 + const std::string& value);
  92 + void log_value(const GChatter& chatter,
  93 + const std::string& name,
  94 + const int& value);
  95 + void log_value(const GChatter& chatter,
  96 + const std::string& name,
  97 + const double& value);
  98 + void log_header1(const GChatter& chatter,
  99 + const std::string& header);
  100 + void log_header2(const GChatter& chatter,
  101 + const std::string& header);
  102 + void log_header3(const GChatter& chatter,
  103 + const std::string& header);
  104 + void log_parameters(const GChatter& chatter);
  105 + const bool& need_help(void) const;
  106 + const GApplicationPars& pars(void) const;
  107 + void pars(const GApplicationPars& pars);
  108 + std::string print(const GChatter& chatter = NORMAL) const;
107 109  
108 110 // Public members
109 111 GLog log; //!< Application logger
... ... @@ -243,4 +245,29 @@ const bool&amp; GApplication::need_help(void) const
243 245 return (m_need_help);
244 246 }
245 247  
  248 +
  249 +/***********************************************************************//**
  250 + * @brief Return application parameters
  251 + *
  252 + * @return Application parameters.
  253 + ***************************************************************************/
  254 +inline
  255 +const GApplicationPars& GApplication::pars(void) const
  256 +{
  257 + return m_pars;
  258 +}
  259 +
  260 +
  261 +/***********************************************************************//**
  262 + * @brief Set application parameters
  263 + *
  264 + * @param[in] pars Application parameters.
  265 + ***************************************************************************/
  266 +inline
  267 +void GApplication::pars(const GApplicationPars& pars)
  268 +{
  269 + m_pars = pars;
  270 + return;
  271 +}
  272 +
246 273 #endif /* GAPPLICATION_HPP */
... ...
include/GApplicationPar.hpp
... ... @@ -78,6 +78,7 @@ public:
78 78 bool boolean(void);
79 79 int integer(void);
80 80 double real(void);
  81 + const std::string& current_value(void) const;
81 82 const std::string& min(void) const;
82 83 const std::string& max(void) const;
83 84 const std::string& prompt(void) const;
... ... @@ -181,6 +182,18 @@ const std::string&amp; GApplicationPar::mode(void) const
181 182  
182 183  
183 184 /***********************************************************************//**
  185 + * @brief Returns current parameter value without querying
  186 + *
  187 + * @return Current parameter value
  188 + ***************************************************************************/
  189 +inline
  190 +const std::string& GApplicationPar::current_value(void) const
  191 +{
  192 + return m_value;
  193 +}
  194 +
  195 +
  196 +/***********************************************************************//**
184 197 * @brief Returns parameter minimum
185 198 *
186 199 * @return Parameter minimum
... ...
pyext/GApplication.i
... ... @@ -60,43 +60,46 @@ public:
60 60  
61 61 // Ignore base class methods and make methods private in Python by
62 62 // prepending an underscore
63   - %ignore clear();
64   - %ignore clone() const;
65   - %ignore classname() const;
66   - %rename(_name) name() const;
67   - %rename(_version) version() const;
68   - %rename(_logTerse) logTerse() const;
69   - %rename(_logNormal) logNormal() const;
70   - %rename(_logExplicit) logExplicit() const;
71   - %rename(_logVerbose) logVerbose() const;
72   - %rename(_logDebug) logDebug() const;
73   - %rename(_clobber) clobber() const;
74   - %rename(_has_par) has_par(const std::string& name) const;
75   - %rename(_par_filename) par_filename() const;
76   - %rename(_log_filename) log_filename() const;
77   - %rename(_log_header) log_header();
78   - %rename(_log_trailer) log_trailer();
79   - %rename(_need_help) need_help() const;
  63 + %ignore clear;
  64 + %ignore clone;
  65 + %ignore classname;
  66 + %rename(_name) name;
  67 + %rename(_version) version;
  68 + %rename(_logTerse) logTerse;
  69 + %rename(_logNormal) logNormal;
  70 + %rename(_logExplicit) logExplicit;
  71 + %rename(_logVerbose) logVerbose;
  72 + %rename(_logDebug) logDebug;
  73 + %rename(_clobber) clobber;
  74 + %rename(_has_par) has_par;
  75 + %rename(_par_filename) par_filename;
  76 + %rename(_log_filename) log_filename;
  77 + %rename(_log_header) log_header;
  78 + %rename(_log_trailer) log_trailer;
  79 + %rename(_need_help) need_help;
80 80 %rename(_log) log;
  81 + %rename(_pars) pars;
81 82  
82 83 // Methods
83   - void clear(void);
84   - GApplication* clone(void) const;
85   - std::string classname(void) const;
86   - const std::string& name(void) const;
87   - const std::string& version(void) const;
88   - bool logTerse(void) const;
89   - bool logNormal(void) const;
90   - bool logExplicit(void) const;
91   - bool logVerbose(void) const;
92   - bool logDebug(void) const;
93   - bool clobber(void) const;
94   - bool has_par(const std::string& name) const;
95   - const std::string& par_filename(void) const;
96   - const std::string& log_filename(void) const;
97   - void log_header(void);
98   - void log_trailer(void);
99   - const bool& need_help(void) const;
  84 + void clear(void);
  85 + GApplication* clone(void) const;
  86 + std::string classname(void) const;
  87 + const std::string& name(void) const;
  88 + const std::string& version(void) const;
  89 + bool logTerse(void) const;
  90 + bool logNormal(void) const;
  91 + bool logExplicit(void) const;
  92 + bool logVerbose(void) const;
  93 + bool logDebug(void) const;
  94 + bool clobber(void) const;
  95 + bool has_par(const std::string& name) const;
  96 + const std::string& par_filename(void) const;
  97 + const std::string& log_filename(void) const;
  98 + void log_header(void);
  99 + void log_trailer(void);
  100 + const bool& need_help(void) const;
  101 + const GApplicationPars& pars(void) const;
  102 + void pars(const GApplicationPars& pars);
100 103  
101 104 // Public members
102 105 GLog log; //!< Application logger
... ...
pyext/GApplicationPar.i
... ... @@ -66,6 +66,7 @@ public:
66 66 bool boolean(void);
67 67 int integer(void);
68 68 double real(void);
  69 + const std::string& current_value(void) const;
69 70 const std::string& min(void) const;
70 71 const std::string& max(void) const;
71 72 const std::string& prompt(void) const;
... ...