Commit dd94aa23329bb0e326d491f6e446e0e9bef1836e

Authored by Jürgen Knödlseder
1 parent 27c25c3f

Add support folder and ctool base class

configure.ac
@@ -886,7 +886,8 @@ AC_CONFIG_FILES([Makefile @@ -886,7 +886,8 @@ AC_CONFIG_FILES([Makefile
886 src/ctpsfcube/Makefile 886 src/ctpsfcube/Makefile
887 src/ctbkgcube/Makefile 887 src/ctbkgcube/Makefile
888 src/ctcubemask/Makefile 888 src/ctcubemask/Makefile
889 - src/cttsmap/Makefile 889 + src/cttsmap/Makefile
  890 + src/support/Makefile
890 src/ctools-setup 891 src/ctools-setup
891 test/Makefile 892 test/Makefile
892 test/test_cscripts.sh 893 test/test_cscripts.sh
pyext/ctool.i 0 → 100644
  1 +/***************************************************************************
  2 + * ctool - ctool base class *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2014 by 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 + * @file ctool.hpp
  23 + * @brief ctool base class definition
  24 + * @author Juergen Knoedlseder
  25 + */
  26 +%{
  27 +/* Put headers and other declarations here that are needed for compilation */
  28 +#include "ctool.hpp"
  29 +%}
  30 +
  31 +
  32 +/***********************************************************************//**
  33 + * @class ctool
  34 + *
  35 + * @brief ctool base class
  36 + ***************************************************************************/
  37 +class ctool : public GApplication {
  38 +public:
  39 + // Constructors and destructors
  40 + ctool(void);
  41 + ctool(const ctool& app);
  42 + virtual ~ctool(void);
  43 +
  44 + // Methods
  45 +};
pyext/ctools/ctools.i
@@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
45 %import(module="gammalib.app") "GApplication.i"; 45 %import(module="gammalib.app") "GApplication.i";
46 46
47 /* __ ctools _____________________________________________________________ */ 47 /* __ ctools _____________________________________________________________ */
  48 +%include "ctool.i"
48 %include "ctbin.i" 49 %include "ctbin.i"
49 %include "ctobssim.i" 50 %include "ctobssim.i"
50 %include "ctlike.i" 51 %include "ctlike.i"
pyext/setup.py.in
@@ -79,6 +79,7 @@ for dir in dirs: @@ -79,6 +79,7 @@ for dir in dirs:
79 if len(dir) > 0 and 'ctools' not in dir: 79 if len(dir) > 0 and 'ctools' not in dir:
80 path = os.path.abspath(dir) 80 path = os.path.abspath(dir)
81 include_dirs.append(path) 81 include_dirs.append(path)
  82 +include_dirs.append(os.path.abspath('../src/support'))
82 83
83 # Add extra libraries 84 # Add extra libraries
84 extra_libs = ('@PYTHON_EXTRA_LIBS@').split(',') 85 extra_libs = ('@PYTHON_EXTRA_LIBS@').split(',')
src/Makefile.am
@@ -15,7 +15,8 @@ SUBDIRS = ctbin \ @@ -15,7 +15,8 @@ SUBDIRS = ctbin \
15 ctpsfcube \ 15 ctpsfcube \
16 ctbkgcube \ 16 ctbkgcube \
17 ctcubemask \ 17 ctcubemask \
18 - cttsmap 18 + cttsmap \
  19 + support
19 20
20 # Scripts to be distributed 21 # Scripts to be distributed
21 scripts = ctools-setup \ 22 scripts = ctools-setup \
@@ -37,7 +38,8 @@ libctools_la_LIBADD = ctbin/libctbin.la \ @@ -37,7 +38,8 @@ libctools_la_LIBADD = ctbin/libctbin.la \
37 ctpsfcube/libctpsfcube.la \ 38 ctpsfcube/libctpsfcube.la \
38 ctbkgcube/libctbkgcube.la \ 39 ctbkgcube/libctbkgcube.la \
39 ctcubemask/libctcubemask.la \ 40 ctcubemask/libctcubemask.la \
40 - cttsmap/libcttsmap.la 41 + cttsmap/libcttsmap.la \
  42 + support/libsupport.la
41 43
42 # Distribute scripts 44 # Distribute scripts
43 EXTRA_DIST = $(scripts) 45 EXTRA_DIST = $(scripts)
src/support/Makefile.am 0 → 100644
  1 +## Process this file with automake to produce Makefile.in
  2 +
  3 +# Set include directories
  4 +#INCLUDES =
  5 +
  6 +# Define package included headers (to be installed)
  7 +#pkginclude_HEADERS = ctool.hpp
  8 +
  9 +# Define sources for this directory
  10 +sources = ctool.cpp
  11 +
  12 +# Build libtool library
  13 +noinst_LTLIBRARIES = libsupport.la
  14 +libsupport_la_SOURCES = $(sources)
src/support/ctool.cpp 0 → 100644
  1 +/***************************************************************************
  2 + * ctool - ctool base class *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2014 by 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 + * @file ctool.hpp
  23 + * @brief ctool base class implementation
  24 + * @author Juergen Knoedlseder
  25 + */
  26 +
  27 +/* __ Includes ___________________________________________________________ */
  28 +#ifdef HAVE_CONFIG_H
  29 +#include <config.h>
  30 +#endif
  31 +//#include <cstdio>
  32 +#include "ctool.hpp"
  33 +
  34 +/* __ Method name definitions ____________________________________________ */
  35 +
  36 +/* __ Debug definitions __________________________________________________ */
  37 +
  38 +/* __ Coding definitions _________________________________________________ */
  39 +
  40 +
  41 +/*==========================================================================
  42 + = =
  43 + = Constructors/destructors =
  44 + = =
  45 + ==========================================================================*/
  46 +
  47 +/***********************************************************************//**
  48 + * @brief Void constructor
  49 + ***************************************************************************/
  50 +ctool::ctool(void) : GApplication()
  51 +{
  52 + // Initialise members
  53 + init_members();
  54 +
  55 + // Return
  56 + return;
  57 +}
  58 +
  59 +
  60 +/***********************************************************************//**
  61 + * @brief Copy constructor
  62 + *
  63 + * @param[in] app Application.
  64 + ***************************************************************************/
  65 +ctool::ctool(const ctool& app) : GApplication(app)
  66 +{
  67 + // Initialise members
  68 + init_members();
  69 +
  70 + // Copy members
  71 + copy_members(app);
  72 +
  73 + // Return
  74 + return;
  75 +}
  76 +
  77 +
  78 +/***********************************************************************//**
  79 + * @brief Destructor
  80 + ***************************************************************************/
  81 +ctool::~ctool(void)
  82 +{
  83 + // Free members
  84 + free_members();
  85 +
  86 + // Return
  87 + return;
  88 +}
  89 +
  90 +
  91 +/*==========================================================================
  92 + = =
  93 + = Operators =
  94 + = =
  95 + ==========================================================================*/
  96 +
  97 +/***********************************************************************//**
  98 + * @brief Assignment operator
  99 + *
  100 + * @param[in] app Application.
  101 + ***************************************************************************/
  102 +ctool& ctool::operator=(const ctool& app)
  103 +{
  104 + // Execute only if object is not identical
  105 + if (this != &app) {
  106 +
  107 + // Copy base class members
  108 + this->GApplication::operator=(app);
  109 +
  110 + // Free members
  111 + free_members();
  112 +
  113 + // Initialise members
  114 + init_members();
  115 +
  116 + // Copy members
  117 + copy_members(app);
  118 +
  119 + } // endif: object was not identical
  120 +
  121 + // Return this object
  122 + return *this;
  123 +}
  124 +
  125 +
  126 +/*==========================================================================
  127 + = =
  128 + = Public methods =
  129 + = =
  130 + ==========================================================================*/
  131 +
  132 +
  133 +
  134 +/*==========================================================================
  135 + = =
  136 + = Private methods =
  137 + = =
  138 + ==========================================================================*/
  139 +
  140 +/***********************************************************************//**
  141 + * @brief Initialise class members
  142 + ***************************************************************************/
  143 +void ctool::init_members(void)
  144 +{
  145 + // Initialise members
  146 +
  147 + // Return
  148 + return;
  149 +}
  150 +
  151 +
  152 +/***********************************************************************//**
  153 + * @brief Copy class members
  154 + *
  155 + * @param[in] app Application.
  156 + ***************************************************************************/
  157 +void ctool::copy_members(const ctool& app)
  158 +{
  159 + // Copy attributes
  160 +
  161 + // Return
  162 + return;
  163 +}
  164 +
  165 +
  166 +/***********************************************************************//**
  167 + * @brief Delete class members
  168 + ***************************************************************************/
  169 +void ctool::free_members(void)
  170 +{
  171 + // Return
  172 + return;
  173 +}
src/support/ctool.hpp 0 → 100644
  1 +/***************************************************************************
  2 + * ctool - ctool base class *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2014 by 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 + * @file ctool.hpp
  23 + * @brief ctool base class definition
  24 + * @author Juergen Knoedlseder
  25 + */
  26 +
  27 +#ifndef CTOOL_HPP
  28 +#define CTOOL_HPP
  29 +
  30 +/* __ Includes ___________________________________________________________ */
  31 +#include "GammaLib.hpp"
  32 +#include "GCTALib.hpp"
  33 +
  34 +/* __Definitions _________________________________________________________ */
  35 +
  36 +
  37 +/***********************************************************************//**
  38 + * @class ctool
  39 + *
  40 + * @brief ctool base class
  41 + ***************************************************************************/
  42 +class ctool : public GApplication {
  43 +public:
  44 + // Constructors and destructors
  45 + ctool(void);
  46 + ctool(const ctool& app);
  47 + virtual ~ctool(void);
  48 +
  49 + // Operators
  50 + ctool& operator=(const ctool& app);
  51 +
  52 + // Methods
  53 +
  54 +protected:
  55 + // Protected methods
  56 + void init_members(void);
  57 + void copy_members(const ctool& app);
  58 + void free_members(void);
  59 +};
  60 +
  61 +#endif /* CTOOL_HPP */