Commit 2e8172ca97e358aec9c1c61cd8bf29221318a5c6

Authored by Jürgen Knödlseder
1 parent fbdb2d6b

Make template files compilable

.gitignore
... ... @@ -74,6 +74,9 @@ src/ctulimit/ctulimit
74 74 src/cterror/cterror
75 75 src/ctprob/ctprob
76 76 src/ctphase/ctphase
  77 +src/template/ctool_base
  78 +src/template/ctool_like
  79 +src/template/ctool_obs
77 80 test/pfiles/
78 81 test/caldb/
79 82 test/prod3
... ...
configure.ac
1 1 #############################################################################
2 2 # Configuration for ctools - tools for science analysis of CTA data #
3 3 # ------------------------------------------------------------------------- #
4   -# Copyright (C) 2011-2017 Juergen Knoedlseder #
  4 +# Copyright (C) 2011-2018 Juergen Knoedlseder #
5 5 # ------------------------------------------------------------------------- #
6 6 # #
7 7 # This program is free software: you can redistribute it and/or modify #
... ... @@ -1038,6 +1038,7 @@ AC_CONFIG_FILES([Makefile
1038 1038 src/ctulimit/Makefile
1039 1039 src/cterror/Makefile
1040 1040 src/support/Makefile
  1041 + src/template/Makefile
1041 1042 src/ctools-setup
1042 1043 test/Makefile
1043 1044 test/test_python_ctools.sh
... ...
dev/codegen.py
... ... @@ -149,8 +149,8 @@ def add_file(infile, outfile, tokens):
149 149 elif n_header == 4:
150 150 line = ' *'+gammalib.left(' '+text,73)+'*\n'
151 151 if is_header_hash:
152   - text = line.strip(' #\n')
153   - line = '# '+gammalib.left(text,74)+'#\n'
  152 + text = line.strip('#\n')
  153 + line = '#'+text[0:75]+'#\n'
154 154  
155 155 # Write out line
156 156 file.write(line)
... ... @@ -165,7 +165,7 @@ def add_file(infile, outfile, tokens):
165 165 # ========== #
166 166 # Set tokens #
167 167 # ========== #
168   -def set_tokens(classname, author, what):
  168 +def set_tokens(classname, author, what, basename):
169 169 """
170 170 Set replacement tokens for a ctool or cscript
171 171 """
... ... @@ -173,7 +173,9 @@ def set_tokens(classname, author, what):
173 173 year = str(date.today().year)
174 174  
175 175 # Set tokens
176   - tokens = [{'pattern': 'xxx', 'string': classname},
  176 + tokens = [{'pattern': 'ctool_%s' % basename, 'string': classname},
  177 + {'pattern': 'CTOOL_%s' % basename.upper(), 'string': classname.upper()},
  178 + {'pattern': 'xxx', 'string': classname},
177 179 {'pattern': 'XXX', 'string': classname.upper()},
178 180 {'pattern': '[WHAT]', 'string': what},
179 181 {'pattern': '[what]', 'string': what.lower()},
... ... @@ -208,18 +210,18 @@ def add_ctool(name, tokens, baseclass):
208 210 inctemp = 'src/template/ctool_%s.hpp' % (baseclass)
209 211 srctemp = 'src/template/ctool_%s.cpp' % (baseclass)
210 212 pytemp = 'src/template/ctool_%s.i' % (baseclass)
  213 + maintemp = 'src/template/main_%s.cpp' % (baseclass)
211 214 partemp = 'src/template/ctool.par'
212   - maintemp = 'src/template/main.cpp'
213 215 maketemp = 'src/template/ctool_Makefile.am'
214 216 testtemp = 'src/template/ctool_test.py'
215 217  
216 218 # Set destination file names
217 219 incfile = 'src/%s/%s.hpp' % (name, name)
218 220 srcfile = 'src/%s/%s.cpp' % (name, name)
219   - parfile = 'src/%s/%s.par' % (name, name)
  221 + pyfile = 'pyext/%s.i' % (name)
220 222 mainfile = 'src/%s/main.cpp' % (name)
  223 + parfile = 'src/%s/%s.par' % (name, name)
221 224 makefile = 'src/%s/Makefile.am' % (name)
222   - pyfile = 'pyext/%s.i' % (name)
223 225 testfile = 'test/test_%s.py' % (name)
224 226  
225 227 # Add files
... ... @@ -325,7 +327,7 @@ def ctool_menu():
325 327 break
326 328  
327 329 # Set tokens
328   - tokens = set_tokens(ctoolname, author, what)
  330 + tokens = set_tokens(ctoolname, author, what, basename)
329 331  
330 332 # Add ctool
331 333 add_ctool(ctoolname, tokens, basename)
... ...
src/Makefile.am
... ... @@ -25,6 +25,7 @@ MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
25 25  
26 26 # Set sub directories
27 27 SUBDIRS = support \
  28 + template \
28 29 ctbin \
29 30 ctlike \
30 31 ctmodel \
... ...
src/template/Makefile.am 0 → 100755
  1 +#############################################################################
  2 +# Makefile.am for template module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2018 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
  21 +
  22 +# Set include directories
  23 +INCLUDES = -I$(top_srcdir)/src/support
  24 +
  25 +# Program name
  26 +bin_PROGRAMS = ctool_base \
  27 + ctool_obs \
  28 + ctool_like
  29 +
  30 +# Program definition
  31 +ctool_base_SOURCES = main_base.cpp ctool_base.cpp
  32 +ctool_base_LDFLAGS = $(LIB_LINK_OPTION) @LDFLAGS@ @OPENMP_LIB_LDFLAGS@
  33 +ctool_base_CPPFLAGS = @CPPFLAGS@
  34 +ctool_base_LDADD = $(top_builddir)/src/support/libsupport.la
  35 +
  36 +# Program definition
  37 +ctool_obs_SOURCES = main_obs.cpp ctool_obs.cpp
  38 +ctool_obs_LDFLAGS = $(LIB_LINK_OPTION) @LDFLAGS@ @OPENMP_LIB_LDFLAGS@
  39 +ctool_obs_CPPFLAGS = @CPPFLAGS@
  40 +ctool_obs_LDADD = $(top_builddir)/src/support/libsupport.la
  41 +
  42 +# Program definition
  43 +ctool_like_SOURCES = main_like.cpp ctool_like.cpp
  44 +ctool_like_LDFLAGS = $(LIB_LINK_OPTION) @LDFLAGS@ @OPENMP_LIB_LDFLAGS@
  45 +ctool_like_CPPFLAGS = @CPPFLAGS@
  46 +ctool_like_LDADD = $(top_builddir)/src/support/libsupport.la
  47 +
  48 +# Extra files to be distributed in the tar file
  49 +EXTRA_DIST = ctool.par \
  50 + ctool_base.cpp \
  51 + ctool_base.hpp \
  52 + ctool_base.i \
  53 + main_base.cpp \
  54 + ctool_like.cpp \
  55 + ctool_like.hpp \
  56 + ctool_like.i \
  57 + main_like.cpp \
  58 + ctool_obs.cpp \
  59 + ctool_obs.hpp \
  60 + ctool_obs.i \
  61 + main_obs.cpp \
  62 + ctool_Makefile.am \
  63 + ctool_test.py
... ...
src/template/ctool_base.cpp
1 1 /***************************************************************************
2   - * xxx - [WHAT] tool *
  2 + * ctool_base - [WHAT] tool *
3 3 * ----------------------------------------------------------------------- *
4 4 * copyright (C) [YEAR] by [AUTHOR] *
5 5 * ----------------------------------------------------------------------- *
... ... @@ -19,7 +19,7 @@
19 19 * *
20 20 ***************************************************************************/
21 21 /**
22   - * @file xxx.cpp
  22 + * @file ctool_base.cpp
23 23 * @brief [WHAT] tool implementation
24 24 * @author [AUTHOR]
25 25 */
... ... @@ -28,7 +28,7 @@
28 28 #ifdef HAVE_CONFIG_H
29 29 #include <config.h>
30 30 #endif
31   -#include "xxx.hpp"
  31 +#include "ctool_base.hpp"
32 32 #include "GammaLib.hpp"
33 33 #include "GCTALib.hpp"
34 34  
... ... @@ -57,7 +57,7 @@
57 57 *
58 58 * Constructs empty [what] tool.
59 59 ***************************************************************************/
60   -xxx::xxx(void) : ctool(XXX_NAME, VERSION)
  60 +ctool_base::ctool_base(void) : ctool(CTOOL_BASE_NAME, VERSION)
61 61 {
62 62 // Initialise members
63 63 init_members();
... ... @@ -76,7 +76,7 @@ xxx::xxx(void) : ctool(XXX_NAME, VERSION)
76 76 * Constructs [what] tool using command line arguments for user
77 77 * parameter setting.
78 78 ***************************************************************************/
79   -xxx::xxx(int argc, char *argv[]) : ctool(XXX_NAME, VERSION, argc, argv)
  79 +ctool_base::ctool_base(int argc, char *argv[]) : ctool(CTOOL_BASE_NAME, VERSION, argc, argv)
80 80 {
81 81 // Initialise members
82 82 init_members();
... ... @@ -93,7 +93,7 @@ xxx::xxx(int argc, char *argv[]) : ctool(XXX_NAME, VERSION, argc, argv)
93 93 *
94 94 * Constructs [what] tool from another [what] tool.
95 95 ***************************************************************************/
96   -xxx::xxx(const xxx& app) : ctool(app)
  96 +ctool_base::ctool_base(const ctool_base& app) : ctool(app)
97 97 {
98 98 // Initialise members
99 99 init_members();
... ... @@ -111,7 +111,7 @@ xxx::xxx(const xxx&amp; app) : ctool(app)
111 111 *
112 112 * Destructs [what] tool.
113 113 ***************************************************************************/
114   -xxx::~xxx(void)
  114 +ctool_base::~ctool_base(void)
115 115 {
116 116 // Free members
117 117 free_members();
... ... @@ -135,7 +135,7 @@ xxx::~xxx(void)
135 135 *
136 136 * Assigns [what] tool.
137 137 ***************************************************************************/
138   -xxx& xxx::operator=(const xxx& app)
  138 +ctool_base& ctool_base::operator=(const ctool_base& app)
139 139 {
140 140 // Execute only if object is not identical
141 141 if (this != &app) {
... ... @@ -170,7 +170,7 @@ xxx&amp; xxx::operator=(const xxx&amp; app)
170 170 *
171 171 * Clears [what] tool.
172 172 ***************************************************************************/
173   -void xxx::clear(void)
  173 +void ctool_base::clear(void)
174 174 {
175 175 // Free members
176 176 free_members();
... ... @@ -194,7 +194,7 @@ void xxx::clear(void)
194 194 /***********************************************************************//**
195 195 * @brief Run [what] tool
196 196 ***************************************************************************/
197   -void xxx::run(void)
  197 +void ctool_base::run(void)
198 198 {
199 199 // If we're in debug mode then all output is also dumped on the screen
200 200 if (logDebug()) {
... ... @@ -216,7 +216,7 @@ void xxx::run(void)
216 216 *
217 217 * Saves something.
218 218 ***************************************************************************/
219   -void xxx::save(void)
  219 +void ctool_base::save(void)
220 220 {
221 221 // Write header
222 222 log_header1(TERSE, "Save something");
... ... @@ -237,7 +237,7 @@ void xxx::save(void)
237 237 /***********************************************************************//**
238 238 * @brief Initialise class members
239 239 ***************************************************************************/
240   -void xxx::init_members(void)
  240 +void ctool_base::init_members(void)
241 241 {
242 242 // Initialise members
243 243 // TODO: Your code goes here
... ... @@ -252,7 +252,7 @@ void xxx::init_members(void)
252 252 *
253 253 * @param[in] app [WHAT] tool.
254 254 ***************************************************************************/
255   -void xxx::copy_members(const xxx& app)
  255 +void ctool_base::copy_members(const ctool_base& app)
256 256 {
257 257 // Copy attributes
258 258 // TODO: Your code goes here
... ... @@ -265,7 +265,7 @@ void xxx::copy_members(const xxx&amp; app)
265 265 /***********************************************************************//**
266 266 * @brief Delete class members
267 267 ***************************************************************************/
268   -void xxx::free_members(void)
  268 +void ctool_base::free_members(void)
269 269 {
270 270 // Return
271 271 return;
... ... @@ -277,7 +277,7 @@ void xxx::free_members(void)
277 277 *
278 278 * @todo Implement method
279 279 ***************************************************************************/
280   -void xxx::get_parameters(void)
  280 +void ctool_base::get_parameters(void)
281 281 {
282 282 // TODO: Your code goes here
283 283  
... ...
src/template/ctool_base.hpp
1 1 /***************************************************************************
2   - * xxx - [WHAT] tool *
  2 + * ctool_base - [WHAT] tool *
3 3 * ----------------------------------------------------------------------- *
4 4 * copyright (C) [YEAR] by [AUTHOR] *
5 5 * ----------------------------------------------------------------------- *
... ... @@ -19,38 +19,38 @@
19 19 * *
20 20 ***************************************************************************/
21 21 /**
22   - * @file xxx.hpp
  22 + * @file ctool_base.hpp
23 23 * @brief [WHAT] tool definition
24 24 * @author [AUTHOR]
25 25 */
26 26  
27   -#ifndef XXX_HPP
28   -#define XXX_HPP
  27 +#ifndef CTOOL_BASE_HPP
  28 +#define CTOOL_BASE_HPP
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include "ctool.hpp"
32 32  
33 33 /* __Definitions _________________________________________________________ */
34   -#define XXX_NAME "xxx"
  34 +#define CTOOL_BASE_NAME "ctool_base"
35 35  
36 36  
37 37 /***********************************************************************//**
38   - * @class xxx
  38 + * @class ctool_base
39 39 *
40 40 * @brief [WHAT] tool
41 41 *
42 42 * @todo Add tool description.
43 43 ***************************************************************************/
44   -class xxx : public ctool {
  44 +class ctool_base : public ctool {
45 45 public:
46 46 // Constructors and destructors
47   - xxx(void);
48   - xxx(int argc, char *argv[]);
49   - xxx(const xxx& app);
50   - virtual ~xxx(void);
  47 + ctool_base(void);
  48 + ctool_base(int argc, char *argv[]);
  49 + ctool_base(const ctool_base& app);
  50 + virtual ~ctool_base(void);
51 51  
52 52 // Operators
53   - xxx& operator=(const xxx& app);
  53 + ctool_base& operator=(const ctool_base& app);
54 54  
55 55 // Methods
56 56 void clear(void);
... ... @@ -60,7 +60,7 @@ public:
60 60 protected:
61 61 // Protected methods
62 62 void init_members(void);
63   - void copy_members(const xxx& app);
  63 + void copy_members(const ctool_base& app);
64 64 void free_members(void);
65 65 void get_parameters(void);
66 66  
... ... @@ -68,4 +68,4 @@ protected:
68 68 // TODO: Add any data members that are necessary
69 69 };
70 70  
71   -#endif /* XXX_HPP */
  71 +#endif /* CTOOL_BASE_HPP */
... ...
src/template/ctool_base.i
1 1 /***************************************************************************
2   - * xxx - [WHAT] tool *
  2 + * ctool_base - [WHAT] tool *
3 3 * ----------------------------------------------------------------------- *
4 4 * copyright (C) [YEAR] by [AUTHOR] *
5 5 * ----------------------------------------------------------------------- *
... ... @@ -19,28 +19,28 @@
19 19 * *
20 20 ***************************************************************************/
21 21 /**
22   - * @file xxx.i
  22 + * @file ctool_base.i
23 23 * @brief [WHAT] tool definition
24 24 * @author [AUTHOR]
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28   -#include "xxx.hpp"
  28 +#include "ctool_base.hpp"
29 29 %}
30 30  
31 31  
32 32 /***********************************************************************//**
33   - * @class xxx
  33 + * @class ctool_base
34 34 *
35 35 * @brief [WHAT] tool
36 36 ***************************************************************************/
37   -class xxx : public ctool {
  37 +class ctool_base : public ctool {
38 38 public:
39 39 // Constructors and destructors
40   - xxx(void);
41   - xxx(int argc, char *argv[]);
42   - xxx(const xxx& app);
43   - virtual ~xxx(void);
  40 + ctool_base(void);
  41 + ctool_base(int argc, char *argv[]);
  42 + ctool_base(const ctool_base& app);
  43 + virtual ~ctool_base(void);
44 44  
45 45 // Methods
46 46 void clear(void);
... ... @@ -52,8 +52,8 @@ public:
52 52 /***********************************************************************//**
53 53 * @brief [WHAT] tool Python extension
54 54 ***************************************************************************/
55   -%extend xxx {
56   - xxx copy() {
  55 +%extend ctool_base {
  56 + ctool_base copy() {
57 57 return (*self);
58 58 }
59 59 }
... ...
src/template/ctool_like.cpp
1 1 /***************************************************************************
2   - * xxx - [WHAT] tool *
  2 + * ctool_like - [WHAT] tool *
3 3 * ----------------------------------------------------------------------- *
4 4 * copyright (C) [YEAR] by [AUTHOR] *
5 5 * ----------------------------------------------------------------------- *
... ... @@ -19,7 +19,7 @@
19 19 * *
20 20 ***************************************************************************/
21 21 /**
22   - * @file xxx.cpp
  22 + * @file ctool_like.cpp
23 23 * @brief [WHAT] tool implementation
24 24 * @author [AUTHOR]
25 25 */
... ... @@ -28,7 +28,7 @@
28 28 #ifdef HAVE_CONFIG_H
29 29 #include <config.h>
30 30 #endif
31   -#include "xxx.hpp"
  31 +#include "ctool_like.hpp"
32 32 #include "GammaLib.hpp"
33 33 #include "GCTALib.hpp"
34 34  
... ... @@ -57,7 +57,7 @@
57 57 *
58 58 * Constructs empty [what] tool.
59 59 ***************************************************************************/
60   -xxx::xxx(void) : ctlikelihood(XXX_NAME, VERSION)
  60 +ctool_like::ctool_like(void) : ctlikelihood(CTOOL_LIKE_NAME, VERSION)
61 61 {
62 62 // Initialise members
63 63 init_members();
... ... @@ -74,7 +74,7 @@ xxx::xxx(void) : ctlikelihood(XXX_NAME, VERSION)
74 74 *
75 75 * Constructs [what] tool from an observation container.
76 76 ***************************************************************************/
77   -xxx::xxx(const GObservations& obs) : ctlikelihood(XXX_NAME, VERSION, obs)
  77 +ctool_like::ctool_like(const GObservations& obs) : ctlikelihood(CTOOL_LIKE_NAME, VERSION, obs)
78 78 {
79 79 // Initialise members
80 80 init_members();
... ... @@ -93,7 +93,7 @@ xxx::xxx(const GObservations&amp; obs) : ctlikelihood(XXX_NAME, VERSION, obs)
93 93 * Constructs [what] tool using command line arguments for user
94 94 * parameter setting.
95 95 ***************************************************************************/
96   -xxx::xxx(int argc, char *argv[]) : ctlikelihood(XXX_NAME, VERSION, argc, argv)
  96 +ctool_like::ctool_like(int argc, char *argv[]) : ctlikelihood(CTOOL_LIKE_NAME, VERSION, argc, argv)
97 97 {
98 98 // Initialise members
99 99 init_members();
... ... @@ -110,7 +110,7 @@ xxx::xxx(int argc, char *argv[]) : ctlikelihood(XXX_NAME, VERSION, argc, argv)
110 110 *
111 111 * Constructs [what] tool from another [what] tool.
112 112 ***************************************************************************/
113   -xxx::xxx(const xxx& app) : ctlikelihood(app)
  113 +ctool_like::ctool_like(const ctool_like& app) : ctlikelihood(app)
114 114 {
115 115 // Initialise members
116 116 init_members();
... ... @@ -128,7 +128,7 @@ xxx::xxx(const xxx&amp; app) : ctlikelihood(app)
128 128 *
129 129 * Destructs [what] tool.
130 130 ***************************************************************************/
131   -xxx::~xxx(void)
  131 +ctool_like::~ctool_like(void)
132 132 {
133 133 // Free members
134 134 free_members();
... ... @@ -152,7 +152,7 @@ xxx::~xxx(void)
152 152 *
153 153 * Assigns [what] tool.
154 154 ***************************************************************************/
155   -xxx& xxx::operator=(const xxx& app)
  155 +ctool_like& ctool_like::operator=(const ctool_like& app)
156 156 {
157 157 // Execute only if object is not identical
158 158 if (this != &app) {
... ... @@ -187,7 +187,7 @@ xxx&amp; xxx::operator=(const xxx&amp; app)
187 187 *
188 188 * Clears [what] tool.
189 189 ***************************************************************************/
190   -void xxx::clear(void)
  190 +void ctool_like::clear(void)
191 191 {
192 192 // Free members
193 193 free_members();
... ... @@ -213,7 +213,7 @@ void xxx::clear(void)
213 213 /***********************************************************************//**
214 214 * @brief Run [what] tool
215 215 ***************************************************************************/
216   -void xxx::run(void)
  216 +void ctool_like::run(void)
217 217 {
218 218 // If we're in debug mode then all output is also dumped on the screen
219 219 if (logDebug()) {
... ... @@ -238,7 +238,7 @@ void xxx::run(void)
238 238 *
239 239 * Saves something.
240 240 ***************************************************************************/
241   -void xxx::save(void)
  241 +void ctool_like::save(void)
242 242 {
243 243 // Write header
244 244 log_header1(TERSE, "Save something");
... ... @@ -259,7 +259,7 @@ void xxx::save(void)
259 259 /***********************************************************************//**
260 260 * @brief Initialise class members
261 261 ***************************************************************************/
262   -void xxx::init_members(void)
  262 +void ctool_like::init_members(void)
263 263 {
264 264 // Initialise members
265 265 // TODO: Your code goes here
... ... @@ -274,7 +274,7 @@ void xxx::init_members(void)
274 274 *
275 275 * @param[in] app [WHAT] tool.
276 276 ***************************************************************************/
277   -void xxx::copy_members(const xxx& app)
  277 +void ctool_like::copy_members(const ctool_like& app)
278 278 {
279 279 // Copy attributes
280 280 // TODO: Your code goes here
... ... @@ -287,7 +287,7 @@ void xxx::copy_members(const xxx&amp; app)
287 287 /***********************************************************************//**
288 288 * @brief Delete class members
289 289 ***************************************************************************/
290   -void xxx::free_members(void)
  290 +void ctool_like::free_members(void)
291 291 {
292 292 // Return
293 293 return;
... ... @@ -299,7 +299,7 @@ void xxx::free_members(void)
299 299 *
300 300 * @todo Implement method
301 301 ***************************************************************************/
302   -void xxx::get_parameters(void)
  302 +void ctool_like::get_parameters(void)
303 303 {
304 304 // TODO: Your code goes here
305 305  
... ...
src/template/ctool_like.hpp
1 1 /***************************************************************************
2   - * xxx - [WHAT] tool *
  2 + * ctool_like - [WHAT] tool *
3 3 * ----------------------------------------------------------------------- *
4 4 * copyright (C) [YEAR] by [AUTHOR] *
5 5 * ----------------------------------------------------------------------- *
... ... @@ -19,39 +19,39 @@
19 19 * *
20 20 ***************************************************************************/
21 21 /**
22   - * @file xxx.hpp
  22 + * @file ctool_like.hpp
23 23 * @brief [WHAT] tool definition
24 24 * @author [AUTHOR]
25 25 */
26 26  
27   -#ifndef XXX_HPP
28   -#define XXX_HPP
  27 +#ifndef CTOOL_LIKE_HPP
  28 +#define CTOOL_LIKE_HPP
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include "ctlikelihood.hpp"
32 32  
33 33 /* __Definitions _________________________________________________________ */
34   -#define XXX_NAME "xxx"
  34 +#define CTOOL_LIKE_NAME "ctool_like"
35 35  
36 36  
37 37 /***********************************************************************//**
38   - * @class xxx
  38 + * @class ctool_like
39 39 *
40 40 * @brief [WHAT] tool
41 41 *
42 42 * @todo Add tool description.
43 43 ***************************************************************************/
44   -class xxx : public ctlikelihood {
  44 +class ctool_like : public ctlikelihood {
45 45 public:
46 46 // Constructors and destructors
47   - xxx(void);
48   - explicit xxx(const GObservations& obs);
49   - xxx(int argc, char *argv[]);
50   - xxx(const xxx& app);
51   - virtual ~xxx(void);
  47 + ctool_like(void);
  48 + explicit ctool_like(const GObservations& obs);
  49 + ctool_like(int argc, char *argv[]);
  50 + ctool_like(const ctool_like& app);
  51 + virtual ~ctool_like(void);
52 52  
53 53 // Operators
54   - xxx& operator=(const xxx& app);
  54 + ctool_like& operator=(const ctool_like& app);
55 55  
56 56 // Methods
57 57 void clear(void);
... ... @@ -61,7 +61,7 @@ public:
61 61 protected:
62 62 // Protected methods
63 63 void init_members(void);
64   - void copy_members(const xxx& app);
  64 + void copy_members(const ctool_like& app);
65 65 void free_members(void);
66 66 void get_parameters(void);
67 67  
... ... @@ -69,4 +69,4 @@ protected:
69 69 // TODO: Add any data members that are necessary
70 70 };
71 71  
72   -#endif /* XXX_HPP */
  72 +#endif /* CTOOL_LIKE_HPP */
... ...
src/template/ctool_like.i
1 1 /***************************************************************************
2   - * xxx - [WHAT] tool *
  2 + * ctool_like - [WHAT] tool *
3 3 * ----------------------------------------------------------------------- *
4 4 * copyright (C) [YEAR] by [AUTHOR] *
5 5 * ----------------------------------------------------------------------- *
... ... @@ -19,29 +19,29 @@
19 19 * *
20 20 ***************************************************************************/
21 21 /**
22   - * @file xxx.i
  22 + * @file ctool_like.i
23 23 * @brief [WHAT] tool definition
24 24 * @author [AUTHOR]
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28   -#include "xxx.hpp"
  28 +#include "ctool_like.hpp"
29 29 %}
30 30  
31 31  
32 32 /***********************************************************************//**
33   - * @class xxx
  33 + * @class ctool_like
34 34 *
35 35 * @brief [WHAT] tool
36 36 ***************************************************************************/
37   -class xxx : public ctlikelihood {
  37 +class ctool_like : public ctlikelihood {
38 38 public:
39 39 // Constructors and destructors
40   - xxx(void);
41   - explicit xxx(const GObservations& obs);
42   - xxx(int argc, char *argv[]);
43   - xxx(const xxx& app);
44   - virtual ~xxx(void);
  40 + ctool_like(void);
  41 + explicit ctool_like(const GObservations& obs);
  42 + ctool_like(int argc, char *argv[]);
  43 + ctool_like(const ctool_like& app);
  44 + virtual ~ctool_like(void);
45 45  
46 46 // Methods
47 47 void clear(void);
... ... @@ -53,8 +53,8 @@ public:
53 53 /***********************************************************************//**
54 54 * @brief [WHAT] tool Python extension
55 55 ***************************************************************************/
56   -%extend xxx {
57   - xxx copy() {
  56 +%extend ctool_like {
  57 + ctool_like copy() {
58 58 return (*self);
59 59 }
60 60 }
... ...
src/template/ctool_obs.cpp
1 1 /***************************************************************************
2   - * xxx - [WHAT] tool *
  2 + * ctool_obs - [WHAT] tool *
3 3 * ----------------------------------------------------------------------- *
4 4 * copyright (C) [YEAR] by [AUTHOR] *
5 5 * ----------------------------------------------------------------------- *
... ... @@ -19,7 +19,7 @@
19 19 * *
20 20 ***************************************************************************/
21 21 /**
22   - * @file xxx.cpp
  22 + * @file ctool_obs.cpp
23 23 * @brief [WHAT] tool implementation
24 24 * @author [AUTHOR]
25 25 */
... ... @@ -28,7 +28,7 @@
28 28 #ifdef HAVE_CONFIG_H
29 29 #include <config.h>
30 30 #endif
31   -#include "xxx.hpp"
  31 +#include "ctool_obs.hpp"
32 32 #include "GammaLib.hpp"
33 33 #include "GCTALib.hpp"
34 34  
... ... @@ -57,7 +57,7 @@
57 57 *
58 58 * Constructs empty [what] tool.
59 59 ***************************************************************************/
60   -xxx::xxx(void) : ctobservation(XXX_NAME, VERSION)
  60 +ctool_obs::ctool_obs(void) : ctobservation(CTOOL_OBS_NAME, VERSION)
61 61 {
62 62 // Initialise members
63 63 init_members();
... ... @@ -74,7 +74,7 @@ xxx::xxx(void) : ctobservation(XXX_NAME, VERSION)
74 74 *
75 75 * Constructs [what] tool from an observation container.
76 76 ***************************************************************************/
77   -xxx::xxx(const GObservations& obs) : ctobservation(XXX_NAME, VERSION, obs)
  77 +ctool_obs::ctool_obs(const GObservations& obs) : ctobservation(CTOOL_OBS_NAME, VERSION, obs)
78 78 {
79 79 // Initialise members
80 80 init_members();
... ... @@ -93,7 +93,7 @@ xxx::xxx(const GObservations&amp; obs) : ctobservation(XXX_NAME, VERSION, obs)
93 93 * Constructs [what] tool using command line arguments for user
94 94 * parameter setting.
95 95 ***************************************************************************/
96   -xxx::xxx(int argc, char *argv[]) : ctobservation(XXX_NAME, VERSION, argc, argv)
  96 +ctool_obs::ctool_obs(int argc, char *argv[]) : ctobservation(CTOOL_OBS_NAME, VERSION, argc, argv)
97 97 {
98 98 // Initialise members
99 99 init_members();
... ... @@ -110,7 +110,7 @@ xxx::xxx(int argc, char *argv[]) : ctobservation(XXX_NAME, VERSION, argc, argv)
110 110 *
111 111 * Constructs [what] tool from another [what] tool.
112 112 ***************************************************************************/
113   -xxx::xxx(const xxx& app) : ctobservation(app)
  113 +ctool_obs::ctool_obs(const ctool_obs& app) : ctobservation(app)
114 114 {
115 115 // Initialise members
116 116 init_members();
... ... @@ -128,7 +128,7 @@ xxx::xxx(const xxx&amp; app) : ctobservation(app)
128 128 *
129 129 * Destructs [what] tool.
130 130 ***************************************************************************/
131   -xxx::~xxx(void)
  131 +ctool_obs::~ctool_obs(void)
132 132 {
133 133 // Free members
134 134 free_members();
... ... @@ -152,7 +152,7 @@ xxx::~xxx(void)
152 152 *
153 153 * Assigns [what] tool.
154 154 ***************************************************************************/
155   -xxx& xxx::operator=(const xxx& app)
  155 +ctool_obs& ctool_obs::operator=(const ctool_obs& app)
156 156 {
157 157 // Execute only if object is not identical
158 158 if (this != &app) {
... ... @@ -187,7 +187,7 @@ xxx&amp; xxx::operator=(const xxx&amp; app)
187 187 *
188 188 * Clears [what] tool.
189 189 ***************************************************************************/
190   -void xxx::clear(void)
  190 +void ctool_obs::clear(void)
191 191 {
192 192 // Free members
193 193 free_members();
... ... @@ -213,7 +213,7 @@ void xxx::clear(void)
213 213 /***********************************************************************//**
214 214 * @brief Run [what] tool
215 215 ***************************************************************************/
216   -void xxx::run(void)
  216 +void ctool_obs::run(void)
217 217 {
218 218 // If we're in debug mode then all output is also dumped on the screen
219 219 if (logDebug()) {
... ... @@ -238,7 +238,7 @@ void xxx::run(void)
238 238 *
239 239 * Saves something.
240 240 ***************************************************************************/
241   -void xxx::save(void)
  241 +void ctool_obs::save(void)
242 242 {
243 243 // Write header
244 244 log_header1(TERSE, "Save something");
... ... @@ -259,7 +259,7 @@ void xxx::save(void)
259 259 /***********************************************************************//**
260 260 * @brief Initialise class members
261 261 ***************************************************************************/
262   -void xxx::init_members(void)
  262 +void ctool_obs::init_members(void)
263 263 {
264 264 // Initialise members
265 265 // TODO: Your code goes here
... ... @@ -274,7 +274,7 @@ void xxx::init_members(void)
274 274 *
275 275 * @param[in] app [WHAT] tool.
276 276 ***************************************************************************/
277   -void xxx::copy_members(const xxx& app)
  277 +void ctool_obs::copy_members(const ctool_obs& app)
278 278 {
279 279 // Copy attributes
280 280 // TODO: Your code goes here
... ... @@ -287,7 +287,7 @@ void xxx::copy_members(const xxx&amp; app)
287 287 /***********************************************************************//**
288 288 * @brief Delete class members
289 289 ***************************************************************************/
290   -void xxx::free_members(void)
  290 +void ctool_obs::free_members(void)
291 291 {
292 292 // Return
293 293 return;
... ... @@ -299,7 +299,7 @@ void xxx::free_members(void)
299 299 *
300 300 * @todo Implement method
301 301 ***************************************************************************/
302   -void xxx::get_parameters(void)
  302 +void ctool_obs::get_parameters(void)
303 303 {
304 304 // TODO: Your code goes here
305 305  
... ...
src/template/ctool_obs.hpp
1 1 /***************************************************************************
2   - * xxx - [WHAT] tool *
  2 + * ctool_obs - [WHAT] tool *
3 3 * ----------------------------------------------------------------------- *
4 4 * copyright (C) [YEAR] by [AUTHOR] *
5 5 * ----------------------------------------------------------------------- *
... ... @@ -19,39 +19,39 @@
19 19 * *
20 20 ***************************************************************************/
21 21 /**
22   - * @file xxx.hpp
  22 + * @file ctool_obs.hpp
23 23 * @brief [WHAT] tool definition
24 24 * @author [AUTHOR]
25 25 */
26 26  
27   -#ifndef XXX_HPP
28   -#define XXX_HPP
  27 +#ifndef CTOOL_OBS_HPP
  28 +#define CTOOL_OBS_HPP
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include "ctobservation.hpp"
32 32  
33 33 /* __Definitions _________________________________________________________ */
34   -#define XXX_NAME "xxx"
  34 +#define CTOOL_OBS_NAME "ctool_obs"
35 35  
36 36  
37 37 /***********************************************************************//**
38   - * @class xxx
  38 + * @class ctool_obs
39 39 *
40 40 * @brief [WHAT] tool
41 41 *
42 42 * @todo Add tool description.
43 43 ***************************************************************************/
44   -class xxx : public ctobservation {
  44 +class ctool_obs : public ctobservation {
45 45 public:
46 46 // Constructors and destructors
47   - xxx(void);
48   - explicit xxx(const GObservations& obs);
49   - xxx(int argc, char *argv[]);
50   - xxx(const xxx& app);
51   - virtual ~xxx(void);
  47 + ctool_obs(void);
  48 + explicit ctool_obs(const GObservations& obs);
  49 + ctool_obs(int argc, char *argv[]);
  50 + ctool_obs(const ctool_obs& app);
  51 + virtual ~ctool_obs(void);
52 52  
53 53 // Operators
54   - xxx& operator=(const xxx& app);
  54 + ctool_obs& operator=(const ctool_obs& app);
55 55  
56 56 // Methods
57 57 void clear(void);
... ... @@ -61,7 +61,7 @@ public:
61 61 protected:
62 62 // Protected methods
63 63 void init_members(void);
64   - void copy_members(const xxx& app);
  64 + void copy_members(const ctool_obs& app);
65 65 void free_members(void);
66 66 void get_parameters(void);
67 67  
... ... @@ -69,4 +69,4 @@ protected:
69 69 // TODO: Add any data members that are necessary
70 70 };
71 71  
72   -#endif /* XXX_HPP */
  72 +#endif /* CTOOL_OBS_HPP */
... ...
src/template/ctool_obs.i
1 1 /***************************************************************************
2   - * xxx - [WHAT] tool *
  2 + * ctool_obs - [WHAT] tool *
3 3 * ----------------------------------------------------------------------- *
4 4 * copyright (C) [YEAR] by [AUTHOR] *
5 5 * ----------------------------------------------------------------------- *
... ... @@ -19,29 +19,29 @@
19 19 * *
20 20 ***************************************************************************/
21 21 /**
22   - * @file xxx.i
  22 + * @file ctool_obs.i
23 23 * @brief [WHAT] tool definition
24 24 * @author [AUTHOR]
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28   -#include "xxx.hpp"
  28 +#include "ctool_obs.hpp"
29 29 %}
30 30  
31 31  
32 32 /***********************************************************************//**
33   - * @class xxx
  33 + * @class ctool_obs
34 34 *
35 35 * @brief [WHAT] tool
36 36 ***************************************************************************/
37   -class xxx : public ctobservation {
  37 +class ctool_obs : public ctobservation {
38 38 public:
39 39 // Constructors and destructors
40   - xxx(void);
41   - explicit xxx(const GObservations& obs);
42   - xxx(int argc, char *argv[]);
43   - xxx(const xxx& app);
44   - virtual ~xxx(void);
  40 + ctool_obs(void);
  41 + explicit ctool_obs(const GObservations& obs);
  42 + ctool_obs(int argc, char *argv[]);
  43 + ctool_obs(const ctool_obs& app);
  44 + virtual ~ctool_obs(void);
45 45  
46 46 // Methods
47 47 void clear(void);
... ... @@ -53,8 +53,8 @@ public:
53 53 /***********************************************************************//**
54 54 * @brief [WHAT] tool Python extension
55 55 ***************************************************************************/
56   -%extend xxx {
57   - xxx copy() {
  56 +%extend ctool_obs {
  57 + ctool_obs copy() {
58 58 return (*self);
59 59 }
60 60 }
... ...
src/template/main.cpp renamed to src/template/main_base.cpp
1 1 /***************************************************************************
2   - * xxx - [WHAT] tool main code *
  2 + * ctool_base - [WHAT] tool main code *
3 3 * ----------------------------------------------------------------------- *
4 4 * copyright (C) [YEAR] by [AUTHOR] *
5 5 * ----------------------------------------------------------------------- *
... ... @@ -19,7 +19,7 @@
19 19 * *
20 20 ***************************************************************************/
21 21 /**
22   - * @file xxx/main.cpp
  22 + * @file ctool_base/main.cpp
23 23 * @brief [WHAT] tool main code
24 24 * @author [AUTHOR]
25 25 */
... ... @@ -29,7 +29,7 @@
29 29 #include <config.h>
30 30 #endif
31 31 #include "support.hpp"
32   -#include "xxx.hpp"
  32 +#include "ctool_base.hpp"
33 33  
34 34  
35 35 /***********************************************************************//**
... ... @@ -38,8 +38,8 @@
38 38 * @param[in] argc Number of command line arguments.
39 39 * @param[in] argv Command line arguments.
40 40 *
41   - * This is the main entry point of the xxx application. It allocates a
42   - * xxx object and executes the application. Any exceptions that occur
  41 + * This is the main entry point of the ctool_base application. It allocates a
  42 + * ctool_base object and executes the application. Any exceptions that occur
43 43 * will be catched and corresponding error messages written in the
44 44 * application logger and into the standard output.
45 45 ***************************************************************************/
... ... @@ -49,13 +49,13 @@ int main (int argc, char *argv[])
49 49 int rc = 1;
50 50  
51 51 // Initialise pointer on application
52   - xxx* application = NULL;
  52 + ctool_base* application = NULL;
53 53  
54 54 // Try creating an instance of the application and executing the instance
55 55 try {
56 56  
57 57 // Create instance of application
58   - application = new xxx(argc, argv);
  58 + application = new ctool_base(argc, argv);
59 59  
60 60 // Execute ctool
61 61 rc = execute_ctool(application);
... ... @@ -65,7 +65,7 @@ int main (int argc, char *argv[])
65 65 catch (std::exception &e) {
66 66  
67 67 // Report exception
68   - report_ctool_failure("xxx", e.what());
  68 + report_ctool_failure("ctool_base", e.what());
69 69  
70 70 }
71 71  
... ...
src/template/main_like.cpp 0 → 100755
  1 +/***************************************************************************
  2 + * ctool_like - [WHAT] tool main code *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) [YEAR] by [AUTHOR] *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software: you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation, either version 3 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + * This program is distributed in the hope that it will be useful, *
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15 + * GNU General Public License for more details. *
  16 + * *
  17 + * You should have received a copy of the GNU General Public License *
  18 + * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  19 + * *
  20 + ***************************************************************************/
  21 +/**
  22 + * @file ctool_like/main.cpp
  23 + * @brief [WHAT] tool main code
  24 + * @author [AUTHOR]
  25 + */
  26 +
  27 +/* __ Includes ___________________________________________________________ */
  28 +#ifdef HAVE_CONFIG_H
  29 +#include <config.h>
  30 +#endif
  31 +#include "support.hpp"
  32 +#include "ctool_like.hpp"
  33 +
  34 +
  35 +/***********************************************************************//**
  36 + * @brief Main entry point of application
  37 + *
  38 + * @param[in] argc Number of command line arguments.
  39 + * @param[in] argv Command line arguments.
  40 + *
  41 + * This is the main entry point of the ctool_like application. It allocates a
  42 + * ctool_like object and executes the application. Any exceptions that occur
  43 + * will be catched and corresponding error messages written in the
  44 + * application logger and into the standard output.
  45 + ***************************************************************************/
  46 +int main (int argc, char *argv[])
  47 +{
  48 + // Initialise return code
  49 + int rc = 1;
  50 +
  51 + // Initialise pointer on application
  52 + ctool_like* application = NULL;
  53 +
  54 + // Try creating an instance of the application and executing the instance
  55 + try {
  56 +
  57 + // Create instance of application
  58 + application = new ctool_like(argc, argv);
  59 +
  60 + // Execute ctool
  61 + rc = execute_ctool(application);
  62 +
  63 + }
  64 +
  65 + catch (std::exception &e) {
  66 +
  67 + // Report exception
  68 + report_ctool_failure("ctool_like", e.what());
  69 +
  70 + }
  71 +
  72 + // Delete application
  73 + delete application;
  74 +
  75 + // Return
  76 + return rc;
  77 +}
... ...
src/template/main_obs.cpp 0 → 100755
  1 +/***************************************************************************
  2 + * ctool_obs - [WHAT] tool main code *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) [YEAR] by [AUTHOR] *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software: you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation, either version 3 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + * This program is distributed in the hope that it will be useful, *
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15 + * GNU General Public License for more details. *
  16 + * *
  17 + * You should have received a copy of the GNU General Public License *
  18 + * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  19 + * *
  20 + ***************************************************************************/
  21 +/**
  22 + * @file ctool_obs/main.cpp
  23 + * @brief [WHAT] tool main code
  24 + * @author [AUTHOR]
  25 + */
  26 +
  27 +/* __ Includes ___________________________________________________________ */
  28 +#ifdef HAVE_CONFIG_H
  29 +#include <config.h>
  30 +#endif
  31 +#include "support.hpp"
  32 +#include "ctool_obs.hpp"
  33 +
  34 +
  35 +/***********************************************************************//**
  36 + * @brief Main entry point of application
  37 + *
  38 + * @param[in] argc Number of command line arguments.
  39 + * @param[in] argv Command line arguments.
  40 + *
  41 + * This is the main entry point of the ctool_obs application. It allocates a
  42 + * ctool_obs object and executes the application. Any exceptions that occur
  43 + * will be catched and corresponding error messages written in the
  44 + * application logger and into the standard output.
  45 + ***************************************************************************/
  46 +int main (int argc, char *argv[])
  47 +{
  48 + // Initialise return code
  49 + int rc = 1;
  50 +
  51 + // Initialise pointer on application
  52 + ctool_obs* application = NULL;
  53 +
  54 + // Try creating an instance of the application and executing the instance
  55 + try {
  56 +
  57 + // Create instance of application
  58 + application = new ctool_obs(argc, argv);
  59 +
  60 + // Execute ctool
  61 + rc = execute_ctool(application);
  62 +
  63 + }
  64 +
  65 + catch (std::exception &e) {
  66 +
  67 + // Report exception
  68 + report_ctool_failure("ctool_obs", e.what());
  69 +
  70 + }
  71 +
  72 + // Delete application
  73 + delete application;
  74 +
  75 + // Return
  76 + return rc;
  77 +}
... ...