Commit fa383a4f9021c56a60302de08c158920ae544784

Authored by knodlseder
1 parent cd8d1f59

initial default implementation of GImage class

include/GImage.hpp 0 → 100644
  1 +/***************************************************************************
  2 + * GImage.hpp - Image abstract base class *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright : (C) 2008 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GImage.hpp
  15 + * @brief GImage abstract base class definition.
  16 + * @author J. Knodlseder
  17 + */
  18 +
  19 +#ifndef GIMAGE_HPP
  20 +#define GIMAGE_HPP
  21 +
  22 +/* __ Includes ___________________________________________________________ */
  23 +
  24 +/* __ Namespaces _________________________________________________________ */
  25 +
  26 +
  27 +/***********************************************************************//**
  28 + * @class GImage
  29 + *
  30 + * @brief Abstract GImage class interface defintion
  31 + ***************************************************************************/
  32 +class GImage {
  33 +
  34 +public:
  35 + // Constructors and destructors
  36 + GImage();
  37 + GImage(const GImage& image);
  38 + virtual ~GImage();
  39 +
  40 + // Operators
  41 + GImage& operator= (const GImage& image);
  42 +
  43 + // Methods
  44 +
  45 +protected:
  46 + // Protected methods
  47 + void init_members(void);
  48 + void copy_members(const GImage& image);
  49 + void free_members(void);
  50 + virtual GImage* clone(void) const = 0;
  51 +
  52 + // Protected data area
  53 +private:
  54 +};
  55 +
  56 +#endif /* GIMAGE_HPP */
... ...
include/GammaLib.hpp
... ... @@ -28,6 +28,8 @@
28 28  
29 29 #include "GData.hpp"
30 30  
  31 +#include "GImage.hpp"
  32 +
31 33 #include "GFits.hpp"
32 34 #include "GFitsHDU.hpp"
33 35 #include "GFitsHeader.hpp"
... ...
include/Makefile.am
... ... @@ -2,6 +2,7 @@
2 2 pkginclude_HEADERS = GammaLib.hpp \
3 3 GException.hpp \
4 4 GSkyDir.hpp \
  5 + GImage.hpp \
5 6 GData.hpp \
6 7 GResponse.hpp \
7 8 GLATResponse.hpp \
... ...
include/Makefile.in
... ... @@ -108,6 +108,7 @@ pythondir = @pythondir@
108 108 pkginclude_HEADERS = GammaLib.hpp \
109 109 GException.hpp \
110 110 GSkyDir.hpp \
  111 + GImage.hpp \
111 112 GData.hpp \
112 113 GResponse.hpp \
113 114 GLATResponse.hpp \
... ...
src/GImage.cpp 0 → 100644
  1 +/***************************************************************************
  2 + * GImage.cpp - Image abstract base class *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright : (C) 2008 by Jurgen Knodlseder *
  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 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + * ----------------------------------------------------------------------- *
  13 + ***************************************************************************/
  14 +/**
  15 + * @file GImage.cpp
  16 + * @brief GImage abstract base class implementation.
  17 + * @author J. Knodlseder
  18 + */
  19 +
  20 +/* __ Includes ___________________________________________________________ */
  21 +#include "GException.hpp"
  22 +#include "GImage.hpp"
  23 +
  24 +/* __ Namespaces _________________________________________________________ */
  25 +
  26 +/* __ Method name definitions ____________________________________________ */
  27 +
  28 +/* __ Macros _____________________________________________________________ */
  29 +
  30 +/* __ Coding definitions _________________________________________________ */
  31 +
  32 +/* __ Debug definitions __________________________________________________ */
  33 +
  34 +
  35 +
  36 +/*==========================================================================
  37 + = =
  38 + = GImage constructors/destructors =
  39 + = =
  40 + ==========================================================================*/
  41 +
  42 +/***********************************************************************//**
  43 + * @brief Constructor
  44 + ***************************************************************************/
  45 +GImage::GImage()
  46 +{
  47 + // Initialise class members for clean destruction
  48 + init_members();
  49 +
  50 + // Return
  51 + return;
  52 +}
  53 +
  54 +
  55 +/***********************************************************************//**
  56 + * @brief Copy constructor
  57 + *
  58 + * @param data GImage instance which should be used for construction
  59 + ***************************************************************************/
  60 +GImage::GImage(const GImage& image)
  61 +{
  62 + // Initialise class members for clean destruction
  63 + init_members();
  64 +
  65 + // Copy members
  66 + copy_members(image);
  67 +
  68 + // Return
  69 + return;
  70 +}
  71 +
  72 +
  73 +/***********************************************************************//**
  74 + * @brief Destructor
  75 + ***************************************************************************/
  76 +GImage::~GImage()
  77 +{
  78 + // Free members
  79 + free_members();
  80 +
  81 + // Return
  82 + return;
  83 +}
  84 +
  85 +
  86 +/*==========================================================================
  87 + = =
  88 + = GImage operators =
  89 + = =
  90 + ==========================================================================*/
  91 +
  92 +/***********************************************************************//**
  93 + * @brief Assignment operator
  94 + *
  95 + * @param[in] image GImage instance to be assigned
  96 + ***************************************************************************/
  97 +GImage& GImage::operator= (const GImage& image)
  98 +{
  99 + // Execute only if object is not identical
  100 + if (this != &image) {
  101 +
  102 + // Free members
  103 + free_members();
  104 +
  105 + // Initialise private members for clean destruction
  106 + init_members();
  107 +
  108 + // Copy members
  109 + copy_members(image);
  110 +
  111 + } // endif: object was not identical
  112 +
  113 + // Return this object
  114 + return *this;
  115 +}
  116 +
  117 +
  118 +/*==========================================================================
  119 + = =
  120 + = GImage public methods =
  121 + = =
  122 + ==========================================================================*/
  123 +
  124 +
  125 +/*==========================================================================
  126 + = =
  127 + = GImage private methods =
  128 + = =
  129 + ==========================================================================*/
  130 +
  131 +/***********************************************************************//**
  132 + * @brief Initialise class members
  133 + ***************************************************************************/
  134 +void GImage::init_members(void)
  135 +{
  136 + // Initialise members
  137 +
  138 + // Return
  139 + return;
  140 +}
  141 +
  142 +
  143 +/***********************************************************************//**
  144 + * @brief Copy class members
  145 + *
  146 + * @param[in] image GImage instance from which members should be copied
  147 + ***************************************************************************/
  148 +void GImage::copy_members(const GImage& image)
  149 +{
  150 + // Copy attributes
  151 +
  152 + // Return
  153 + return;
  154 +}
  155 +
  156 +
  157 +/***********************************************************************//**
  158 + * @brief Delete class members
  159 + ***************************************************************************/
  160 +void GImage::free_members(void)
  161 +{
  162 + // Free memory
  163 +
  164 + // Mark memory as free
  165 +
  166 + // Return
  167 + return;
  168 +}
  169 +
  170 +
  171 +/*==========================================================================
  172 + = =
  173 + = GImage friends =
  174 + = =
  175 + ==========================================================================*/
  176 +
  177 +
  178 +/*==========================================================================
  179 + = =
  180 + = Other functions used by GImage =
  181 + = =
  182 + ==========================================================================*/
... ...
src/Makefile.am
... ... @@ -12,6 +12,7 @@ files = GException.cpp \
12 12 GTools.cpp \
13 13 GSkyDir.cpp \
14 14 GNodeArray.cpp \
  15 + GImage.cpp \
15 16 data/GData.cpp \
16 17 rsp/GResponse.cpp \
17 18 rsp/GLATResponse.cpp \
... ...
src/Makefile.in
... ... @@ -117,6 +117,7 @@ files = GException.cpp \
117 117 GTools.cpp \
118 118 GSkyDir.cpp \
119 119 GNodeArray.cpp \
  120 + GImage.cpp \
120 121 data/GData.cpp \
121 122 rsp/GResponse.cpp \
122 123 rsp/GLATResponse.cpp \
... ... @@ -165,16 +166,16 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
165 166  
166 167 libgamma_la_LIBADD =
167 168 am__objects_1 = GException.lo GTools.lo GSkyDir.lo GNodeArray.lo \
168   - GData.lo GResponse.lo GLATResponse.lo GLATResponseTable.lo \
169   - GLATAeff.lo GLATPsf.lo GLATEdisp.lo GObservation.lo \
170   - GLATObservation.lo GFitsHeaderCard.lo GFitsHeader.lo \
171   - GFitsData.lo GFitsImage.lo GFitsDblImage.lo GFitsTable.lo \
172   - GFitsAsciiTable.lo GFitsBinTable.lo GFitsTableCol.lo \
173   - GFitsTableLogCol.lo GFitsTableStrCol.lo GFitsTableShtCol.lo \
174   - GFitsTableLngCol.lo GFitsTableFltCol.lo GFitsTableDblCol.lo \
175   - GFitsHDU.lo GFits.lo GFitPar.lo GVector.lo GMatrixBase.lo \
176   - GMatrix.lo GSymMatrix.lo GSparseMatrix.lo GSparseSymbolic.lo \
177   - GSparseNumeric.lo
  169 + GImage.lo GData.lo GResponse.lo GLATResponse.lo \
  170 + GLATResponseTable.lo GLATAeff.lo GLATPsf.lo GLATEdisp.lo \
  171 + GObservation.lo GLATObservation.lo GFitsHeaderCard.lo \
  172 + GFitsHeader.lo GFitsData.lo GFitsImage.lo GFitsDblImage.lo \
  173 + GFitsTable.lo GFitsAsciiTable.lo GFitsBinTable.lo \
  174 + GFitsTableCol.lo GFitsTableLogCol.lo GFitsTableStrCol.lo \
  175 + GFitsTableShtCol.lo GFitsTableLngCol.lo GFitsTableFltCol.lo \
  176 + GFitsTableDblCol.lo GFitsHDU.lo GFits.lo GFitPar.lo GVector.lo \
  177 + GMatrixBase.lo GMatrix.lo GSymMatrix.lo GSparseMatrix.lo \
  178 + GSparseSymbolic.lo GSparseNumeric.lo
178 179 am_libgamma_la_OBJECTS = $(am__objects_1)
179 180 libgamma_la_OBJECTS = $(am_libgamma_la_OBJECTS)
180 181  
... ...