diff --git a/include/GImage.hpp b/include/GImage.hpp new file mode 100644 index 0000000..0ec5d99 --- /dev/null +++ b/include/GImage.hpp @@ -0,0 +1,56 @@ +/*************************************************************************** + * GImage.hpp - Image abstract base class * + * ----------------------------------------------------------------------- * + * copyright : (C) 2008 by Jurgen Knodlseder * + * ----------------------------------------------------------------------- * + * * + * 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 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +/** + * @file GImage.hpp + * @brief GImage abstract base class definition. + * @author J. Knodlseder + */ + +#ifndef GIMAGE_HPP +#define GIMAGE_HPP + +/* __ Includes ___________________________________________________________ */ + +/* __ Namespaces _________________________________________________________ */ + + +/***********************************************************************//** + * @class GImage + * + * @brief Abstract GImage class interface defintion + ***************************************************************************/ +class GImage { + +public: + // Constructors and destructors + GImage(); + GImage(const GImage& image); + virtual ~GImage(); + + // Operators + GImage& operator= (const GImage& image); + + // Methods + +protected: + // Protected methods + void init_members(void); + void copy_members(const GImage& image); + void free_members(void); + virtual GImage* clone(void) const = 0; + + // Protected data area +private: +}; + +#endif /* GIMAGE_HPP */ diff --git a/include/GammaLib.hpp b/include/GammaLib.hpp index f90c139..98bca0d 100644 --- a/include/GammaLib.hpp +++ b/include/GammaLib.hpp @@ -28,6 +28,8 @@ #include "GData.hpp" +#include "GImage.hpp" + #include "GFits.hpp" #include "GFitsHDU.hpp" #include "GFitsHeader.hpp" diff --git a/include/Makefile.am b/include/Makefile.am index 192b5e7..56d96c4 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -2,6 +2,7 @@ pkginclude_HEADERS = GammaLib.hpp \ GException.hpp \ GSkyDir.hpp \ + GImage.hpp \ GData.hpp \ GResponse.hpp \ GLATResponse.hpp \ diff --git a/include/Makefile.in b/include/Makefile.in index 023ed14..5516c6a 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -108,6 +108,7 @@ pythondir = @pythondir@ pkginclude_HEADERS = GammaLib.hpp \ GException.hpp \ GSkyDir.hpp \ + GImage.hpp \ GData.hpp \ GResponse.hpp \ GLATResponse.hpp \ diff --git a/src/GImage.cpp b/src/GImage.cpp new file mode 100644 index 0000000..5db4389 --- /dev/null +++ b/src/GImage.cpp @@ -0,0 +1,182 @@ +/*************************************************************************** + * GImage.cpp - Image abstract base class * + * ----------------------------------------------------------------------- * + * copyright : (C) 2008 by Jurgen Knodlseder * + * ----------------------------------------------------------------------- * + * * + * 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 2 of the License, or * + * (at your option) any later version. * + * * + * ----------------------------------------------------------------------- * + ***************************************************************************/ +/** + * @file GImage.cpp + * @brief GImage abstract base class implementation. + * @author J. Knodlseder + */ + +/* __ Includes ___________________________________________________________ */ +#include "GException.hpp" +#include "GImage.hpp" + +/* __ Namespaces _________________________________________________________ */ + +/* __ Method name definitions ____________________________________________ */ + +/* __ Macros _____________________________________________________________ */ + +/* __ Coding definitions _________________________________________________ */ + +/* __ Debug definitions __________________________________________________ */ + + + +/*========================================================================== + = = + = GImage constructors/destructors = + = = + ==========================================================================*/ + +/***********************************************************************//** + * @brief Constructor + ***************************************************************************/ +GImage::GImage() +{ + // Initialise class members for clean destruction + init_members(); + + // Return + return; +} + + +/***********************************************************************//** + * @brief Copy constructor + * + * @param data GImage instance which should be used for construction + ***************************************************************************/ +GImage::GImage(const GImage& image) +{ + // Initialise class members for clean destruction + init_members(); + + // Copy members + copy_members(image); + + // Return + return; +} + + +/***********************************************************************//** + * @brief Destructor + ***************************************************************************/ +GImage::~GImage() +{ + // Free members + free_members(); + + // Return + return; +} + + +/*========================================================================== + = = + = GImage operators = + = = + ==========================================================================*/ + +/***********************************************************************//** + * @brief Assignment operator + * + * @param[in] image GImage instance to be assigned + ***************************************************************************/ +GImage& GImage::operator= (const GImage& image) +{ + // Execute only if object is not identical + if (this != &image) { + + // Free members + free_members(); + + // Initialise private members for clean destruction + init_members(); + + // Copy members + copy_members(image); + + } // endif: object was not identical + + // Return this object + return *this; +} + + +/*========================================================================== + = = + = GImage public methods = + = = + ==========================================================================*/ + + +/*========================================================================== + = = + = GImage private methods = + = = + ==========================================================================*/ + +/***********************************************************************//** + * @brief Initialise class members + ***************************************************************************/ +void GImage::init_members(void) +{ + // Initialise members + + // Return + return; +} + + +/***********************************************************************//** + * @brief Copy class members + * + * @param[in] image GImage instance from which members should be copied + ***************************************************************************/ +void GImage::copy_members(const GImage& image) +{ + // Copy attributes + + // Return + return; +} + + +/***********************************************************************//** + * @brief Delete class members + ***************************************************************************/ +void GImage::free_members(void) +{ + // Free memory + + // Mark memory as free + + // Return + return; +} + + +/*========================================================================== + = = + = GImage friends = + = = + ==========================================================================*/ + + +/*========================================================================== + = = + = Other functions used by GImage = + = = + ==========================================================================*/ diff --git a/src/Makefile.am b/src/Makefile.am index be3e35a..68b4cef 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,6 +12,7 @@ files = GException.cpp \ GTools.cpp \ GSkyDir.cpp \ GNodeArray.cpp \ + GImage.cpp \ data/GData.cpp \ rsp/GResponse.cpp \ rsp/GLATResponse.cpp \ diff --git a/src/Makefile.in b/src/Makefile.in index b0d7e01..2d89fb1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -117,6 +117,7 @@ files = GException.cpp \ GTools.cpp \ GSkyDir.cpp \ GNodeArray.cpp \ + GImage.cpp \ data/GData.cpp \ rsp/GResponse.cpp \ rsp/GLATResponse.cpp \ @@ -165,16 +166,16 @@ LTLIBRARIES = $(lib_LTLIBRARIES) libgamma_la_LIBADD = am__objects_1 = GException.lo GTools.lo GSkyDir.lo GNodeArray.lo \ - GData.lo GResponse.lo GLATResponse.lo GLATResponseTable.lo \ - GLATAeff.lo GLATPsf.lo GLATEdisp.lo GObservation.lo \ - GLATObservation.lo GFitsHeaderCard.lo GFitsHeader.lo \ - GFitsData.lo GFitsImage.lo GFitsDblImage.lo GFitsTable.lo \ - GFitsAsciiTable.lo GFitsBinTable.lo GFitsTableCol.lo \ - GFitsTableLogCol.lo GFitsTableStrCol.lo GFitsTableShtCol.lo \ - GFitsTableLngCol.lo GFitsTableFltCol.lo GFitsTableDblCol.lo \ - GFitsHDU.lo GFits.lo GFitPar.lo GVector.lo GMatrixBase.lo \ - GMatrix.lo GSymMatrix.lo GSparseMatrix.lo GSparseSymbolic.lo \ - GSparseNumeric.lo + GImage.lo GData.lo GResponse.lo GLATResponse.lo \ + GLATResponseTable.lo GLATAeff.lo GLATPsf.lo GLATEdisp.lo \ + GObservation.lo GLATObservation.lo GFitsHeaderCard.lo \ + GFitsHeader.lo GFitsData.lo GFitsImage.lo GFitsDblImage.lo \ + GFitsTable.lo GFitsAsciiTable.lo GFitsBinTable.lo \ + GFitsTableCol.lo GFitsTableLogCol.lo GFitsTableStrCol.lo \ + GFitsTableShtCol.lo GFitsTableLngCol.lo GFitsTableFltCol.lo \ + GFitsTableDblCol.lo GFitsHDU.lo GFits.lo GFitPar.lo GVector.lo \ + GMatrixBase.lo GMatrix.lo GSymMatrix.lo GSparseMatrix.lo \ + GSparseSymbolic.lo GSparseNumeric.lo am_libgamma_la_OBJECTS = $(am__objects_1) libgamma_la_OBJECTS = $(am_libgamma_la_OBJECTS)