Commit 5cf248beb6496e2c63b15469f371c33231a9b3ff

Authored by knodlseder
1 parent 33dd0030

update after reorganisation of GFits classes layout

include/GEbounds.hpp
... ... @@ -22,7 +22,7 @@
22 22 /* __ Includes ___________________________________________________________ */
23 23 #include <iostream>
24 24 #include "GFits.hpp"
25   -#include "GFitsHDU.hpp"
  25 +#include "GFitsBinTable.hpp"
26 26 #include "GEnergy.hpp"
27 27  
28 28  
... ... @@ -43,7 +43,7 @@ public:
43 43 // Constructors and destructors
44 44 GEbounds(void);
45 45 GEbounds(const GEbounds& ebds);
46   - ~GEbounds(void);
  46 + virtual ~GEbounds(void);
47 47  
48 48 // Operators
49 49 GEbounds& operator= (const GEbounds& ebds);
... ... @@ -58,7 +58,7 @@ public:
58 58 const std::string& extname = "EBOUNDS");
59 59 void save(const std::string& filename, bool clobber,
60 60 const std::string& extname = "EBOUNDS");
61   - void read(GFitsHDU* hdu);
  61 + void read(GFitsBinTable* hdu);
62 62 void write(GFits* file, const std::string& extname = "EBOUNDS");
63 63 int index(const GEnergy& eng) const;
64 64 int size(void) const { return m_num; }
... ...
include/Makefile.am
... ... @@ -47,8 +47,8 @@ pkginclude_HEADERS = GammaLib.hpp \
47 47 GXmlPI.hpp \
48 48 GFitsHeaderCard.hpp \
49 49 GFitsHeader.hpp \
50   - GFitsData.hpp \
51 50 GFitsImage.hpp \
  51 + GFitsByteImage.hpp \
52 52 GFitsImageFlt.hpp \
53 53 GFitsImageDbl.hpp \
54 54 GFitsTable.hpp \
... ...
pyext/GFits.i
... ... @@ -46,7 +46,7 @@ public:
46 46 void close(void);
47 47 void save(void);
48 48 void saveto(const std::string& filename, bool clobber = false);
49   - void append(const GFitsHDU& hdu);
  49 + void append(GFitsHDU* hdu);
50 50 GFitsHDU* hdu(const std::string& extname) const;
51 51 GFitsHDU* hdu(int extno) const;
52 52 };
... ...
pyext/GFitsHDU.i
... ... @@ -19,8 +19,8 @@
19 19 /* Put headers and other declarations here that are needed for compilation */
20 20 #include "GFitsHDU.hpp"
21 21 %}
22   -
23 22 %include stl.i
  23 +//%feature("notabstract") GFitsHDU;
24 24  
25 25  
26 26 /***********************************************************************//**
... ... @@ -37,30 +37,39 @@ class GFitsHDU {
37 37 public:
38 38 // Constructors and destructors
39 39 GFitsHDU(void);
40   - GFitsHDU(const GFitsImage& image);
41   - GFitsHDU(const GFitsAsciiTable& table);
42   - GFitsHDU(const GFitsBinTable& table);
43 40 GFitsHDU(const GFitsHDU& hdu);
44 41 virtual ~GFitsHDU(void);
45 42  
46   - // Methods
47   - std::string extname(void) const;
48   - void extname(const std::string& extname);
49   - int extno(void) const;
50   - int exttype(void) const;
51   - GFitsHeader* header(void) const;
52   - GFitsData* data(void) const;
53   - GFitsHeaderCard* card(const std::string& keyname) const;
54   - GFitsHeaderCard* card(const int& cardno) const;
55   - void card(const std::string& keyname, const std::string& value,
56   - const std::string& comment);
57   - void card(const std::string& keyname, const double& value,
58   - const std::string& comment);
59   - void card(const std::string& keyname, const int& value,
60   - const std::string& comment);
61   - GFitsTableCol* column(const std::string& colname) const;
62   - GFitsTableCol* column(const int& colnum) const;
63   - void primary(void);
  43 + // Public enumerators
  44 + enum HDUType {
  45 + HT_IMAGE = 0,
  46 + HT_ASCII_TABLE = 1,
  47 + HT_BIN_TABLE = 2
  48 + };
  49 +
  50 + // Pure virtual methods
  51 + virtual HDUType exttype(void) const = 0;
  52 + virtual GFitsHDU* clone(void) const = 0;
  53 +
  54 + // Implemented methods
  55 + virtual std::string extname(void) const { return m_name; }
  56 + virtual void extname(const std::string& extname);
  57 + virtual int extno(void) const { return m_hdunum; }
  58 + virtual void extno(int num) { m_hdunum=num; }
  59 + virtual GFitsHeader* header(void) { return &m_header; }
  60 + virtual GFitsHeaderCard* card(const std::string& keyname);
  61 + virtual GFitsHeaderCard* card(const int& cardno);
  62 + virtual int cards(void) const { return m_header.size(); }
  63 + virtual std::string string(const std::string& keyname) const;
  64 + virtual double real(const std::string& keyname) const;
  65 + virtual int integer(const std::string& keyname) const;
  66 + virtual void card(const std::string& keyname, const std::string& value,
  67 + const std::string& comment);
  68 + virtual void card(const std::string& keyname, const double& value,
  69 + const std::string& comment);
  70 + virtual void card(const std::string& keyname, const int& value,
  71 + const std::string& comment);
  72 + virtual GFitsHDU* primary(void);
64 73 };
65 74  
66 75  
... ... @@ -77,7 +86,4 @@ public:
77 86 str_buffer[100000] = '\0';
78 87 return str_buffer;
79 88 }
80   - GFitsHDU copy() {
81   - return (*self);
82   - }
83   -}
  89 +};
... ...
pyext/GFitsHeader.i
... ... @@ -45,6 +45,9 @@ public:
45 45 void clear(void);
46 46 int size(void) const;
47 47 void update(const GFitsHeaderCard& card);
  48 + void open(void* vptr);
  49 + void save(void* vptr);
  50 + void close(void);
48 51 GFitsHeaderCard* card(const std::string& keyname);
49 52 GFitsHeaderCard* card(const int& cardno);
50 53 std::string string(const std::string& keyname);
... ...
pyext/GFitsImage.i
... ... @@ -25,12 +25,24 @@
25 25 *
26 26 * @brief Abstract SWIG interface for the FITS image classes.
27 27 ***************************************************************************/
28   -class GFitsImage : public GFitsData {
  28 +class GFitsImage : public GFitsHDU {
29 29 public:
30   - int bitpix(void) const;
31   - int naxis(void) const;
32   - int naxes(int axis) const;
33   - int num_pixels(void) const;
34   -protected:
  30 + // Constructors and destructors
  31 + GFitsImage(void);
  32 + GFitsImage(int bitpix, int naxis, const int* naxes);
  33 + GFitsImage(const GFitsImage& image);
  34 + virtual ~GFitsImage(void);
  35 +
  36 + // Pure virtual methods
  37 + virtual void* pixels(void) = 0;
35 38 virtual GFitsImage* clone(void) const = 0;
  39 +
  40 + // Implemented pure virtual methods
  41 + HDUType exttype(void) const { return HT_IMAGE; }
  42 +
  43 + // Methods
  44 + virtual int bitpix(void) const;
  45 + virtual int naxis(void) const;
  46 + virtual int naxes(int axis) const;
  47 + virtual int num_pixels(void) const;
36 48 };
... ...
pyext/GFitsImageDbl.i
... ... @@ -31,13 +31,16 @@ class GFitsImageDbl : public GFitsImage {
31 31 public:
32 32 // Constructors and destructors
33 33 GFitsImageDbl(void);
  34 + GFitsImageDbl(int naxis, const int* naxes);
  35 + GFitsImageDbl(int naxis, const int* naxes, const double* pixels);
34 36 GFitsImageDbl(const GFitsImageDbl& image);
35 37 virtual ~GFitsImageDbl(void);
36 38  
37 39 // Methods
38   - void link(double* pixels);
39   - void set_nullval(const double* value);
40   - double* pixels(void);
  40 + void link(double* pixels);
  41 + void nulval(const double* value);
  42 + void* pixels(void);
  43 + GFitsImageDbl* clone(void) const;
41 44 };
42 45  
43 46  
... ...
pyext/GFitsTable.i
... ... @@ -26,7 +26,7 @@
26 26 *
27 27 * @brief Abstract SWIG interface for the FITS table classes.
28 28 ***************************************************************************/
29   -class GFitsTable : public GFitsData {
  29 +class GFitsTable : public GFitsHDU {
30 30 public:
31 31 // Constructors and destructors
32 32 GFitsTable(void);
... ... @@ -34,18 +34,18 @@ public:
34 34 GFitsTable(const GFitsTable& table);
35 35 virtual ~GFitsTable(void);
36 36  
37   - // Methods
38   - void append_column(GFitsTableCol& column);
39   - void insert_column(int colnum, GFitsTableCol& column);
40   - void append_rows(const int& nrows);
41   - void insert_rows(const int& rownum, const int& nrows);
42   - GFitsTableCol* column(const std::string& colname);
43   - GFitsTableCol* column(const int& colnum);
44   - int nrows(void) const;
45   - int ncols(void) const;
  37 + // Pure virtual methods
  38 + virtual GFitsTable* clone(void) const = 0;
46 39  
47   -protected:
48   - GFitsTable* clone(void) const = 0;
  40 + // Implemented Methods
  41 + virtual void append_column(GFitsTableCol& column);
  42 + virtual void insert_column(int colnum, GFitsTableCol& column);
  43 + virtual void append_rows(const int& nrows);
  44 + virtual void insert_rows(const int& rownum, const int& nrows);
  45 + virtual GFitsTableCol* column(const std::string& colname);
  46 + virtual GFitsTableCol* column(const int& colnum);
  47 + virtual int nrows(void) const;
  48 + virtual int ncols(void) const;
49 49 };
50 50  
51 51  
... ... @@ -62,4 +62,4 @@ protected:
62 62 str_buffer[100000] = '\0';
63 63 return str_buffer;
64 64 }
65   -};
66 65 \ No newline at end of file
  66 +};
... ...