ctools  2.0.0
 All Classes Namespaces Files Functions Variables Macros Pages
ctool_base.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * ctool_base - [WHAT] tool *
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_base.cpp
23  * @brief [WHAT] tool implementation
24  * @author [AUTHOR]
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include "ctool_base.hpp"
32 #include "GammaLib.hpp"
33 #include "GCTALib.hpp"
34 
35 /* __ OpenMP section _____________________________________________________ */
36 //#ifdef _OPENMP
37 //#include <omp.h>
38 //#endif
39 
40 /* __ Method name definitions ____________________________________________ */
41 
42 /* __ Debug definitions __________________________________________________ */
43 
44 /* __ Coding definitions _________________________________________________ */
45 
46 /* __ Constants __________________________________________________________ */
47 
48 
49 /*==========================================================================
50  = =
51  = Constructors/destructors =
52  = =
53  ==========================================================================*/
54 
55 /***********************************************************************//**
56  * @brief Void constructor
57  *
58  * Constructs empty [what] tool.
59  ***************************************************************************/
61 {
62  // Initialise members
63  init_members();
64 
65  // Return
66  return;
67 }
68 
69 
70 /***********************************************************************//**
71  * @brief Command line constructor
72  *
73  * @param[in] argc Number of arguments in command line.
74  * @param[in] argv Array of command line arguments.
75  *
76  * Constructs [what] tool using command line arguments for user
77  * parameter setting.
78  ***************************************************************************/
79 ctool_base::ctool_base(int argc, char *argv[]) : ctool(CTOOL_BASE_NAME, VERSION, argc, argv)
80 {
81  // Initialise members
82  init_members();
83 
84  // Return
85  return;
86 }
87 
88 
89 /***********************************************************************//**
90  * @brief Copy constructor
91  *
92  * @param[in] app [WHAT] tool.
93  *
94  * Constructs [what] tool from another [what] tool.
95  ***************************************************************************/
97 {
98  // Initialise members
99  init_members();
100 
101  // Copy members
102  copy_members(app);
103 
104  // Return
105  return;
106 }
107 
108 
109 /***********************************************************************//**
110  * @brief Destructor
111  *
112  * Destructs [what] tool.
113  ***************************************************************************/
115 {
116  // Free members
117  free_members();
118 
119  // Return
120  return;
121 }
122 
123 
124 /*==========================================================================
125  = =
126  = Operators =
127  = =
128  ==========================================================================*/
129 
130 /***********************************************************************//**
131  * @brief Assignment operator
132  *
133  * @param[in] app [WHAT] tool.
134  * @return [WHAT] tool.
135  *
136  * Assigns [what] tool.
137  ***************************************************************************/
139 {
140  // Execute only if object is not identical
141  if (this != &app) {
142 
143  // Copy base class members
144  this->ctool::operator=(app);
145 
146  // Free members
147  free_members();
148 
149  // Initialise members
150  init_members();
151 
152  // Copy members
153  copy_members(app);
154 
155  } // endif: object was not identical
156 
157  // Return this object
158  return *this;
159 }
160 
161 
162 /*==========================================================================
163  = =
164  = Public methods =
165  = =
166  ==========================================================================*/
167 
168 /***********************************************************************//**
169  * @brief Clear [WHAT] tool
170  *
171  * Clears [what] tool.
172  ***************************************************************************/
174 {
175  // Free members
176  free_members();
177  this->ctool::free_members();
178 
179  // Clear base class (needed to conserve tool name and version)
180  this->GApplication::clear();
181 
182  // Initialise members
183  this->ctool::init_members();
184  init_members();
185 
186  // Write header into logger
187  log_header();
188 
189  // Return
190  return;
191 }
192 
193 
194 /***********************************************************************//**
195  * @brief Process [what] tool
196  ***************************************************************************/
198 {
199  // Get task parameters
200  get_parameters();
201 
202  // TODO: Your code goes here
203 
204  // Return
205  return;
206 }
207 
208 
209 /***********************************************************************//**
210  * @brief Save something
211  *
212  * Saves something.
213  ***************************************************************************/
215 {
216  // Write header
217  log_header1(TERSE, "Save something");
218 
219  // TODO: Your code goes here
220 
221  // Return
222  return;
223 }
224 
225 
226 /*==========================================================================
227  = =
228  = Private methods =
229  = =
230  ==========================================================================*/
231 
232 /***********************************************************************//**
233  * @brief Initialise class members
234  ***************************************************************************/
236 {
237  // Initialise members
238  // TODO: Your code goes here
239 
240  // Return
241  return;
242 }
243 
244 
245 /***********************************************************************//**
246  * @brief Copy class members
247  *
248  * @param[in] app [WHAT] tool.
249  ***************************************************************************/
251 {
252  // Copy attributes
253  // TODO: Your code goes here
254 
255  // Return
256  return;
257 }
258 
259 
260 /***********************************************************************//**
261  * @brief Delete class members
262  ***************************************************************************/
264 {
265  // Return
266  return;
267 }
268 
269 
270 /***********************************************************************//**
271  * @brief Get application parameters
272  *
273  * @todo Implement method
274  ***************************************************************************/
276 {
277  // TODO: Your code goes here
278 
279  // Write parameters into logger
280  log_parameters(TERSE);
281 
282  // Return
283  return;
284 }
ctool_base & operator=(const ctool_base &app)
Assignment operator.
Definition: ctool_base.cpp:138
void save(void)
Save something.
Definition: ctool_base.cpp:214
[WHAT] tool definition
void init_members(void)
Initialise class members.
Definition: ctool.cpp:321
Base class for ctools.
Definition: ctool.hpp:50
void process(void)
Process [what] tool.
Definition: ctool_base.cpp:197
virtual ~ctool_base(void)
Destructor.
Definition: ctool_base.cpp:114
#define CTOOL_BASE_NAME
Definition: ctool_base.hpp:34
void clear(void)
Clear [WHAT] tool.
Definition: ctool_base.cpp:173
void log_parameters(const GChatter &chatter)
Log application parameters.
Definition: ctool.cpp:1208
void free_members(void)
Delete class members.
Definition: ctool_base.cpp:263
void free_members(void)
Delete class members.
Definition: ctool.cpp:357
void copy_members(const ctool_base &app)
Copy class members.
Definition: ctool_base.cpp:250
ctool_base(void)
Void constructor.
Definition: ctool_base.cpp:60
ctool & operator=(const ctool &app)
Assignment operator.
Definition: ctool.cpp:221
void get_parameters(void)
Get application parameters.
Definition: ctool_base.cpp:275
void init_members(void)
Initialise class members.
Definition: ctool_base.cpp:235
[WHAT] tool
Definition: ctool_base.hpp:44