From dd94aa23329bb0e326d491f6e446e0e9bef1836e Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Fri, 10 Oct 2014 18:12:46 +0200 Subject: [PATCH] Add support folder and ctool base class --- configure.ac | 3 ++- pyext/ctool.i | 45 +++++++++++++++++++++++++++++++++++++++++++++ pyext/ctools/ctools.i | 1 + pyext/setup.py.in | 1 + src/Makefile.am | 6 ++++-- src/support/Makefile.am | 14 ++++++++++++++ src/support/ctool.cpp | 173 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/support/ctool.hpp | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 301 insertions(+), 3 deletions(-) create mode 100644 pyext/ctool.i create mode 100644 src/support/Makefile.am create mode 100644 src/support/ctool.cpp create mode 100644 src/support/ctool.hpp diff --git a/configure.ac b/configure.ac index 5534ef8..8b2c298 100644 --- a/configure.ac +++ b/configure.ac @@ -886,7 +886,8 @@ AC_CONFIG_FILES([Makefile src/ctpsfcube/Makefile src/ctbkgcube/Makefile src/ctcubemask/Makefile - src/cttsmap/Makefile + src/cttsmap/Makefile + src/support/Makefile src/ctools-setup test/Makefile test/test_cscripts.sh diff --git a/pyext/ctool.i b/pyext/ctool.i new file mode 100644 index 0000000..d68a72f --- /dev/null +++ b/pyext/ctool.i @@ -0,0 +1,45 @@ +/*************************************************************************** + * ctool - ctool base class * + * ----------------------------------------------------------------------- * + * copyright (C) 2014 by Juergen Knoedlseder * + * ----------------------------------------------------------------------- * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + ***************************************************************************/ +/** + * @file ctool.hpp + * @brief ctool base class definition + * @author Juergen Knoedlseder + */ +%{ +/* Put headers and other declarations here that are needed for compilation */ +#include "ctool.hpp" +%} + + +/***********************************************************************//** + * @class ctool + * + * @brief ctool base class + ***************************************************************************/ +class ctool : public GApplication { +public: + // Constructors and destructors + ctool(void); + ctool(const ctool& app); + virtual ~ctool(void); + + // Methods +}; diff --git a/pyext/ctools/ctools.i b/pyext/ctools/ctools.i index dcf60d5..c559bee 100755 --- a/pyext/ctools/ctools.i +++ b/pyext/ctools/ctools.i @@ -45,6 +45,7 @@ %import(module="gammalib.app") "GApplication.i"; /* __ ctools _____________________________________________________________ */ +%include "ctool.i" %include "ctbin.i" %include "ctobssim.i" %include "ctlike.i" diff --git a/pyext/setup.py.in b/pyext/setup.py.in index 6361d04..cafbbf8 100644 --- a/pyext/setup.py.in +++ b/pyext/setup.py.in @@ -79,6 +79,7 @@ for dir in dirs: if len(dir) > 0 and 'ctools' not in dir: path = os.path.abspath(dir) include_dirs.append(path) +include_dirs.append(os.path.abspath('../src/support')) # Add extra libraries extra_libs = ('@PYTHON_EXTRA_LIBS@').split(',') diff --git a/src/Makefile.am b/src/Makefile.am index 0530d66..fbb55ed 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,7 +15,8 @@ SUBDIRS = ctbin \ ctpsfcube \ ctbkgcube \ ctcubemask \ - cttsmap + cttsmap \ + support # Scripts to be distributed scripts = ctools-setup \ @@ -37,7 +38,8 @@ libctools_la_LIBADD = ctbin/libctbin.la \ ctpsfcube/libctpsfcube.la \ ctbkgcube/libctbkgcube.la \ ctcubemask/libctcubemask.la \ - cttsmap/libcttsmap.la + cttsmap/libcttsmap.la \ + support/libsupport.la # Distribute scripts EXTRA_DIST = $(scripts) diff --git a/src/support/Makefile.am b/src/support/Makefile.am new file mode 100644 index 0000000..a7edeea --- /dev/null +++ b/src/support/Makefile.am @@ -0,0 +1,14 @@ +## Process this file with automake to produce Makefile.in + +# Set include directories +#INCLUDES = + +# Define package included headers (to be installed) +#pkginclude_HEADERS = ctool.hpp + +# Define sources for this directory +sources = ctool.cpp + +# Build libtool library +noinst_LTLIBRARIES = libsupport.la +libsupport_la_SOURCES = $(sources) diff --git a/src/support/ctool.cpp b/src/support/ctool.cpp new file mode 100644 index 0000000..c2c02fb --- /dev/null +++ b/src/support/ctool.cpp @@ -0,0 +1,173 @@ +/*************************************************************************** + * ctool - ctool base class * + * ----------------------------------------------------------------------- * + * copyright (C) 2014 by Juergen Knoedlseder * + * ----------------------------------------------------------------------- * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + ***************************************************************************/ +/** + * @file ctool.hpp + * @brief ctool base class implementation + * @author Juergen Knoedlseder + */ + +/* __ Includes ___________________________________________________________ */ +#ifdef HAVE_CONFIG_H +#include +#endif +//#include +#include "ctool.hpp" + +/* __ Method name definitions ____________________________________________ */ + +/* __ Debug definitions __________________________________________________ */ + +/* __ Coding definitions _________________________________________________ */ + + +/*========================================================================== + = = + = Constructors/destructors = + = = + ==========================================================================*/ + +/***********************************************************************//** + * @brief Void constructor + ***************************************************************************/ +ctool::ctool(void) : GApplication() +{ + // Initialise members + init_members(); + + // Return + return; +} + + +/***********************************************************************//** + * @brief Copy constructor + * + * @param[in] app Application. + ***************************************************************************/ +ctool::ctool(const ctool& app) : GApplication(app) +{ + // Initialise members + init_members(); + + // Copy members + copy_members(app); + + // Return + return; +} + + +/***********************************************************************//** + * @brief Destructor + ***************************************************************************/ +ctool::~ctool(void) +{ + // Free members + free_members(); + + // Return + return; +} + + +/*========================================================================== + = = + = Operators = + = = + ==========================================================================*/ + +/***********************************************************************//** + * @brief Assignment operator + * + * @param[in] app Application. + ***************************************************************************/ +ctool& ctool::operator=(const ctool& app) +{ + // Execute only if object is not identical + if (this != &app) { + + // Copy base class members + this->GApplication::operator=(app); + + // Free members + free_members(); + + // Initialise members + init_members(); + + // Copy members + copy_members(app); + + } // endif: object was not identical + + // Return this object + return *this; +} + + +/*========================================================================== + = = + = Public methods = + = = + ==========================================================================*/ + + + +/*========================================================================== + = = + = Private methods = + = = + ==========================================================================*/ + +/***********************************************************************//** + * @brief Initialise class members + ***************************************************************************/ +void ctool::init_members(void) +{ + // Initialise members + + // Return + return; +} + + +/***********************************************************************//** + * @brief Copy class members + * + * @param[in] app Application. + ***************************************************************************/ +void ctool::copy_members(const ctool& app) +{ + // Copy attributes + + // Return + return; +} + + +/***********************************************************************//** + * @brief Delete class members + ***************************************************************************/ +void ctool::free_members(void) +{ + // Return + return; +} diff --git a/src/support/ctool.hpp b/src/support/ctool.hpp new file mode 100644 index 0000000..08b91c0 --- /dev/null +++ b/src/support/ctool.hpp @@ -0,0 +1,61 @@ +/*************************************************************************** + * ctool - ctool base class * + * ----------------------------------------------------------------------- * + * copyright (C) 2014 by Juergen Knoedlseder * + * ----------------------------------------------------------------------- * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + ***************************************************************************/ +/** + * @file ctool.hpp + * @brief ctool base class definition + * @author Juergen Knoedlseder + */ + +#ifndef CTOOL_HPP +#define CTOOL_HPP + +/* __ Includes ___________________________________________________________ */ +#include "GammaLib.hpp" +#include "GCTALib.hpp" + +/* __Definitions _________________________________________________________ */ + + +/***********************************************************************//** + * @class ctool + * + * @brief ctool base class + ***************************************************************************/ +class ctool : public GApplication { +public: + // Constructors and destructors + ctool(void); + ctool(const ctool& app); + virtual ~ctool(void); + + // Operators + ctool& operator=(const ctool& app); + + // Methods + +protected: + // Protected methods + void init_members(void); + void copy_members(const ctool& app); + void free_members(void); +}; + +#endif /* CTOOL_HPP */ -- libgit2 0.21.4