Commit e8755e1cd0b5b6efb5d1c71dc761af2ea7f1967d

Authored by knodlseder
1 parent 08b4792d

add insert and remove methods

include/GFitsTableBitCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableBitCol.hpp - FITS table bit column class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableBitCol.hpp
15   - * @brief GFitsTableBitCol class definition.
  23 + * @brief FITS table bit column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -27,7 +35,7 @@
27 35 /***********************************************************************//**
28 36 * @class GFitsTableBitCol
29 37 *
30   - * @brief Interface for FITS table Bit column
  38 + * @brief FITS table Bit column
31 39 *
32 40 * This class implements a FITS table Bit column. Bits are stored internally
33 41 * in an array of type char and is transferred to the file in junks of
... ... @@ -48,10 +56,14 @@ public:
48 56 bool& operator() (const int& row, const int& inx = 0);
49 57 const bool& operator() (const int& row, const int& inx = 0) const;
50 58  
51   - // Methods
52   - std::string string(const int& row, const int& col = 0);
53   - double real(const int& row, const int& col = 0);
54   - int integer(const int& row, const int& col = 0);
  59 + // Implement virtual methods
  60 + virtual std::string string(const int& row, const int& col = 0);
  61 + virtual double real(const int& row, const int& col = 0);
  62 + virtual int integer(const int& row, const int& col = 0);
  63 + virtual void insert(const int& rownum, const int& nrows);
  64 + virtual void remove(const int& rownum, const int& nrows);
  65 +
  66 + // Other methods
55 67 unsigned char* data(void) { return m_data; }
56 68 void nulval(const unsigned char* value);
57 69 unsigned char* nulval(void) { return m_nulval; }
... ...
include/GFitsTableBoolCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableBoolCol.hpp - FITS table boolean column class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableBoolCol.hpp
15   - * @brief GFitsTableBoolCol class definition.
  23 + * @brief FITS table Boolean column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -27,12 +35,12 @@
27 35 /***********************************************************************//**
28 36 * @class GFitsTableBoolCol
29 37 *
30   - * @brief Interface for FITS table Boolean column
  38 + * @brief FITS table Boolean column
31 39 *
32 40 * This class implements a FITS table Boolean column.
33 41 *
34 42 * @todo Each Bit is actually stored in one Byte. To save memory a more
35   - * compact storage scheme should be implemented.
  43 + * compact storage scheme should be implemented.
36 44 ***************************************************************************/
37 45 class GFitsTableBoolCol : public GFitsTableCol {
38 46  
... ... @@ -49,13 +57,17 @@ public:
49 57 bool& operator() (const int& row, const int& inx = 0);
50 58 const bool& operator() (const int& row, const int& inx = 0) const;
51 59  
52   - // Methods
53   - std::string string(const int& row, const int& col = 0);
54   - double real(const int& row, const int& col = 0);
55   - int integer(const int& row, const int& col = 0);
56   - bool* data(void) { return m_data; }
57   - void nulval(const bool* value);
58   - bool* nulval(void) { return m_nulval; }
  60 + // Implement virtual methods
  61 + virtual std::string string(const int& row, const int& col = 0);
  62 + virtual double real(const int& row, const int& col = 0);
  63 + virtual int integer(const int& row, const int& col = 0);
  64 + virtual void insert(const int& rownum, const int& nrows);
  65 + virtual void remove(const int& rownum, const int& nrows);
  66 +
  67 + // Other methods
  68 + bool* data(void) { return m_data; }
  69 + void nulval(const bool* value);
  70 + bool* nulval(void) { return m_nulval; }
59 71  
60 72 private:
61 73 // Private methods
... ...
include/GFitsTableByteCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableByteCol.hpp - FITS table Byte column class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableByteCol.hpp
15   - * @brief GFitsTableByteCol class definition.
  23 + * @brief FITS table Byte column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -27,7 +35,7 @@
27 35 /***********************************************************************//**
28 36 * @class GFitsTableByteCol
29 37 *
30   - * @brief Interface for FITS table Byte column
  38 + * @brief FITS table Byte column
31 39 *
32 40 * This class implements a FITS table Byte column.
33 41 ***************************************************************************/
... ... @@ -36,7 +44,8 @@ class GFitsTableByteCol : public GFitsTableCol {
36 44 public:
37 45 // Constructors and destructors
38 46 GFitsTableByteCol(void);
39   - GFitsTableByteCol(const std::string& name, const int& length, const int& size = 1);
  47 + GFitsTableByteCol(const std::string& name, const int& length,
  48 + const int& size = 1);
40 49 GFitsTableByteCol(const GFitsTableByteCol& column);
41 50 virtual ~GFitsTableByteCol(void);
42 51  
... ... @@ -45,10 +54,14 @@ public:
45 54 unsigned char& operator() (const int& row, const int& inx = 0);
46 55 const unsigned char& operator() (const int& row, const int& inx = 0) const;
47 56  
48   - // Methods
49   - std::string string(const int& row, const int& col = 0);
50   - double real(const int& row, const int& col = 0);
51   - int integer(const int& row, const int& col = 0);
  57 + // Implement virtual methods
  58 + virtual std::string string(const int& row, const int& col = 0);
  59 + virtual double real(const int& row, const int& col = 0);
  60 + virtual int integer(const int& row, const int& col = 0);
  61 + virtual void insert(const int& rownum, const int& nrows);
  62 + virtual void remove(const int& rownum, const int& nrows);
  63 +
  64 + // Other methods
52 65 unsigned char* data(void) { return m_data; }
53 66 void nulval(const unsigned char* value);
54 67 unsigned char* nulval(void) { return m_nulval; }
... ...
include/GFitsTableCDoubleCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableCDoubleCol.hpp - FITS table double precision complex column *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableCDoubleCol.hpp
15   - * @brief GFitsTableCDoubleCol class definition.
  23 + * @brief FITS table double complex column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -28,9 +36,9 @@
28 36 /***********************************************************************//**
29 37 * @class GFitsTableCDoubleCol
30 38 *
31   - * @brief Interface for FITS table float column
  39 + * @brief FITS table double complex column
32 40 *
33   - * This class implements a FITS table float column.
  41 + * This class implements a FITS table double complex column.
34 42 ***************************************************************************/
35 43 class GFitsTableCDoubleCol : public GFitsTableCol {
36 44  
... ... @@ -47,10 +55,14 @@ public:
47 55 GFits::cdouble& operator() (const int& row, const int& inx = 0);
48 56 const GFits::cdouble& operator() (const int& row, const int& inx = 0) const;
49 57  
50   - // Methods
51   - std::string string(const int& row, const int& col = 0);
52   - double real(const int& row, const int& col = 0);
53   - int integer(const int& row, const int& col = 0);
  58 + // Implement virtual methods
  59 + virtual std::string string(const int& row, const int& col = 0);
  60 + virtual double real(const int& row, const int& col = 0);
  61 + virtual int integer(const int& row, const int& col = 0);
  62 + virtual void insert(const int& rownum, const int& nrows);
  63 + virtual void remove(const int& rownum, const int& nrows);
  64 +
  65 + // Other methods
54 66 GFits::cdouble* data(void) { return m_data; }
55 67 void nulval(const GFits::cdouble* value);
56 68 GFits::cdouble* nulval(void) { return m_nulval; }
... ...
include/GFitsTableCFloatCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableCFloatCol.hpp - FITS table single precision complex column *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableCFloatCol.hpp
15   - * @brief GFitsTableCFloatCol class definition.
  23 + * @brief FITS table float complex column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -28,9 +36,9 @@
28 36 /***********************************************************************//**
29 37 * @class GFitsTableCFloatCol
30 38 *
31   - * @brief Interface for FITS table float column
  39 + * @brief FITS table float complex column
32 40 *
33   - * This class implements a FITS table float column.
  41 + * This class implements a FITS table float complex column.
34 42 ***************************************************************************/
35 43 class GFitsTableCFloatCol : public GFitsTableCol {
36 44  
... ... @@ -47,10 +55,14 @@ public:
47 55 GFits::cfloat& operator() (const int& row, const int& inx = 0);
48 56 const GFits::cfloat& operator() (const int& row, const int& inx = 0) const;
49 57  
50   - // Methods
51   - std::string string(const int& row, const int& col = 0);
52   - double real(const int& row, const int& col = 0);
53   - int integer(const int& row, const int& col = 0);
  58 + // Implement virtual methods
  59 + virtual std::string string(const int& row, const int& col = 0);
  60 + virtual double real(const int& row, const int& col = 0);
  61 + virtual int integer(const int& row, const int& col = 0);
  62 + virtual void insert(const int& rownum, const int& nrows);
  63 + virtual void remove(const int& rownum, const int& nrows);
  64 +
  65 + // Other methods
54 66 GFits::cfloat* data(void) { return m_data; }
55 67 void nulval(const GFits::cfloat* value);
56 68 GFits::cfloat* nulval(void) { return m_nulval; }
... ...
include/GFitsTableCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableCol.hpp - FITS table column abstract base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableCol.hpp
15   - * @brief GFitsTableCol class definition.
  23 + * @brief FITS table column abstract base class definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -56,6 +64,8 @@ public:
56 64 virtual std::string string(const int& row, const int& inx = 0) = 0;
57 65 virtual double real(const int& row, const int& inx = 0) = 0;
58 66 virtual int integer(const int& row, const int& inx = 0) = 0;
  67 + virtual void insert(const int& rownum, const int& nrows) = 0;
  68 + virtual void remove(const int& rownum, const int& nrows) = 0;
59 69  
60 70 // Base class Methods
61 71 void name(const std::string& name);
... ...
include/GFitsTableDoubleCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableDoubleCol.hpp - FITS table double column class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableDoubleCol.hpp
15   - * @brief GFitsTableDoubleCol class definition.
  23 + * @brief FITS table double column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -27,7 +35,7 @@
27 35 /***********************************************************************//**
28 36 * @class GFitsTableDoubleCol
29 37 *
30   - * @brief Interface for FITS table double column
  38 + * @brief FITS table double column
31 39 *
32 40 * This class implements a FITS table double column.
33 41 ***************************************************************************/
... ... @@ -46,13 +54,17 @@ public:
46 54 double& operator() (const int& row, const int& inx = 0);
47 55 const double& operator() (const int& row, const int& inx = 0) const;
48 56  
49   - // Methods
50   - std::string string(const int& row, const int& col = 0);
51   - double real(const int& row, const int& col = 0);
52   - int integer(const int& row, const int& col = 0);
53   - double* data(void) { return m_data; }
54   - void nulval(const double* value);
55   - double* nulval(void) { return m_nulval; }
  57 + // Implement virtual methods
  58 + virtual std::string string(const int& row, const int& col = 0);
  59 + virtual double real(const int& row, const int& col = 0);
  60 + virtual int integer(const int& row, const int& col = 0);
  61 + virtual void insert(const int& rownum, const int& nrows);
  62 + virtual void remove(const int& rownum, const int& nrows);
  63 +
  64 + // Other methods
  65 + double* data(void) { return m_data; }
  66 + void nulval(const double* value);
  67 + double* nulval(void) { return m_nulval; }
56 68  
57 69 private:
58 70 // Private methods
... ...
include/GFitsTableFloatCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableFloatCol.hpp - FITS table float column class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableFloatCol.hpp
15   - * @brief GFitsTableFloatCol class definition.
  23 + * @brief FITS table float column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -27,7 +35,7 @@
27 35 /***********************************************************************//**
28 36 * @class GFitsTableFloatCol
29 37 *
30   - * @brief Interface for FITS table float column
  38 + * @brief FITS table float column
31 39 *
32 40 * This class implements a FITS table float column.
33 41 ***************************************************************************/
... ... @@ -46,13 +54,17 @@ public:
46 54 float& operator() (const int& row, const int& inx = 0);
47 55 const float& operator() (const int& row, const int& inx = 0) const;
48 56  
49   - // Methods
50   - std::string string(const int& row, const int& col = 0);
51   - double real(const int& row, const int& col = 0);
52   - int integer(const int& row, const int& col = 0);
53   - float* data(void) { return m_data; }
54   - void nulval(const float* value);
55   - float* nulval(void) { return m_nulval; }
  57 + // Implement virtual methods
  58 + virtual std::string string(const int& row, const int& col = 0);
  59 + virtual double real(const int& row, const int& col = 0);
  60 + virtual int integer(const int& row, const int& col = 0);
  61 + virtual void insert(const int& rownum, const int& nrows);
  62 + virtual void remove(const int& rownum, const int& nrows);
  63 +
  64 + // Other methods
  65 + float* data(void) { return m_data; }
  66 + void nulval(const float* value);
  67 + float* nulval(void) { return m_nulval; }
56 68  
57 69 private:
58 70 // Private methods
... ...
include/GFitsTableLongCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableLongCol.hpp - FITS table long column class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableLongCol.hpp
15   - * @brief GFitsTableLongCol class definition.
  23 + * @brief FITS table long integer column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -27,7 +35,7 @@
27 35 /***********************************************************************//**
28 36 * @class GFitsTableLongCol
29 37 *
30   - * @brief Interface for FITS table long integer column
  38 + * @brief FITS table long integer column
31 39 *
32 40 * This class implements a FITS table long integer column.
33 41 ***************************************************************************/
... ... @@ -46,13 +54,17 @@ public:
46 54 long& operator() (const int& row, const int& inx = 0);
47 55 const long& operator() (const int& row, const int& inx = 0) const;
48 56  
49   - // Methods
50   - std::string string(const int& row, const int& col = 0);
51   - double real(const int& row, const int& col = 0);
52   - int integer(const int& row, const int& col = 0);
53   - long* data(void) { return m_data; }
54   - void nulval(const long* value);
55   - long* nulval(void) { return m_nulval; }
  57 + // Implement virtual methods
  58 + virtual std::string string(const int& row, const int& col = 0);
  59 + virtual double real(const int& row, const int& col = 0);
  60 + virtual int integer(const int& row, const int& col = 0);
  61 + virtual void insert(const int& rownum, const int& nrows);
  62 + virtual void remove(const int& rownum, const int& nrows);
  63 +
  64 + // Other methods
  65 + long* data(void) { return m_data; }
  66 + void nulval(const long* value);
  67 + long* nulval(void) { return m_nulval; }
56 68  
57 69 private:
58 70 // Private methods
... ...
include/GFitsTableLongLongCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableLongLongCol.hpp - FITS table long long column class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableLongLongCol.hpp
15   - * @brief GFitsTableLongLongCol class definition.
  23 + * @brief FITS table long long integer column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -27,9 +35,9 @@
27 35 /***********************************************************************//**
28 36 * @class GFitsTableLongLongCol
29 37 *
30   - * @brief Interface for FITS table long integer column
  38 + * @brief FITS table long long integer column
31 39 *
32   - * This class implements a FITS table long integer column.
  40 + * This class implements a FITS table long long integer column.
33 41 ***************************************************************************/
34 42 class GFitsTableLongLongCol : public GFitsTableCol {
35 43  
... ... @@ -46,10 +54,14 @@ public:
46 54 long long& operator() (const int& row, const int& inx = 0);
47 55 const long long& operator() (const int& row, const int& inx = 0) const;
48 56  
49   - // Methods
50   - std::string string(const int& row, const int& col = 0);
51   - double real(const int& row, const int& col = 0);
52   - int integer(const int& row, const int& col = 0);
  57 + // Implement virtual methods
  58 + virtual std::string string(const int& row, const int& col = 0);
  59 + virtual double real(const int& row, const int& col = 0);
  60 + virtual int integer(const int& row, const int& col = 0);
  61 + virtual void insert(const int& rownum, const int& nrows);
  62 + virtual void remove(const int& rownum, const int& nrows);
  63 +
  64 + // Other methods
53 65 long long* data(void) { return m_data; }
54 66 void nulval(const long long* value);
55 67 long long* nulval(void) { return m_nulval; }
... ...
include/GFitsTableShortCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableShortCol.hpp - FITS table short column class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableShortCol.hpp
15   - * @brief GFitsTableShortCol class definition.
  23 + * @brief FITS table short integer column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -27,7 +35,7 @@
27 35 /***********************************************************************//**
28 36 * @class GFitsTableShortCol
29 37 *
30   - * @brief Interface for FITS table short integer column
  38 + * @brief FITS table short integer column
31 39 *
32 40 * This class implements a FITS table short integer column.
33 41 ***************************************************************************/
... ... @@ -46,13 +54,17 @@ public:
46 54 short& operator() (const int& row, const int& inx = 0);
47 55 const short& operator() (const int& row, const int& inx = 0) const;
48 56  
49   - // Methods
50   - std::string string(const int& row, const int& col = 0);
51   - double real(const int& row, const int& col = 0);
52   - int integer(const int& row, const int& col = 0);
53   - short* data(void) { return m_data; }
54   - void nulval(const short* value);
55   - short* nulval(void) { return m_nulval; }
  57 + // Implement virtual methods
  58 + virtual std::string string(const int& row, const int& col = 0);
  59 + virtual double real(const int& row, const int& col = 0);
  60 + virtual int integer(const int& row, const int& col = 0);
  61 + virtual void insert(const int& rownum, const int& nrows);
  62 + virtual void remove(const int& rownum, const int& nrows);
  63 +
  64 + // Other methods
  65 + short* data(void) { return m_data; }
  66 + void nulval(const short* value);
  67 + short* nulval(void) { return m_nulval; }
56 68  
57 69 private:
58 70 // Private methods
... ...
include/GFitsTableStringCol.hpp
... ... @@ -4,15 +4,23 @@
4 4 * copyright (C) 2008-2010 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableStringCol.hpp
15   - * @brief GFitsTableStringCol class definition.
  23 + * @brief FITS table string column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -27,7 +35,7 @@
27 35 /***********************************************************************//**
28 36 * @class GFitsTableStringCol
29 37 *
30   - * @brief Interface for FITS table string column
  38 + * @brief FITS table string column
31 39 *
32 40 * This class implements a FITS table string column.
33 41 ***************************************************************************/
... ... @@ -46,10 +54,14 @@ public:
46 54 std::string& operator() (const int& row, const int& inx = 0);
47 55 const std::string& operator() (const int& row, const int& inx = 0) const;
48 56  
49   - // Methods
50   - std::string string(const int& row, const int& col = 0);
51   - double real(const int& row, const int& col = 0);
52   - int integer(const int& row, const int& col = 0);
  57 + // Implement virtual methods
  58 + virtual std::string string(const int& row, const int& col = 0);
  59 + virtual double real(const int& row, const int& col = 0);
  60 + virtual int integer(const int& row, const int& col = 0);
  61 + virtual void insert(const int& rownum, const int& nrows);
  62 + virtual void remove(const int& rownum, const int& nrows);
  63 +
  64 + // Other methods
53 65 std::string* data(void) { return m_data; }
54 66 void nulval(const std::string& value);
55 67 char* nulval(void) { return m_nulval; }
... ...
include/GFitsTableULongCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableULongCol.hpp - FITS table unsigned long column class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableULongCol.hpp
15   - * @brief GFitsTableULongCol class definition.
  23 + * @brief FITS table unsigned long integer column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -27,7 +35,7 @@
27 35 /***********************************************************************//**
28 36 * @class GFitsTableULongCol
29 37 *
30   - * @brief Interface for FITS table unsigned long integer column
  38 + * @brief FITS table unsigned long integer column
31 39 *
32 40 * This class implements a FITS table unsigned long integer column.
33 41 ***************************************************************************/
... ... @@ -46,10 +54,14 @@ public:
46 54 unsigned long& operator() (const int& row, const int& inx = 0);
47 55 const unsigned long& operator() (const int& row, const int& inx = 0) const;
48 56  
49   - // Methods
50   - std::string string(const int& row, const int& col = 0);
51   - double real(const int& row, const int& col = 0);
52   - int integer(const int& row, const int& col = 0);
  57 + // Implement virtual methods
  58 + virtual std::string string(const int& row, const int& col = 0);
  59 + virtual double real(const int& row, const int& col = 0);
  60 + virtual int integer(const int& row, const int& col = 0);
  61 + virtual void insert(const int& rownum, const int& nrows);
  62 + virtual void remove(const int& rownum, const int& nrows);
  63 +
  64 + // Other methods
53 65 unsigned long* data(void) { return m_data; }
54 66 void nulval(const unsigned long* value);
55 67 unsigned long* nulval(void) { return m_nulval; }
... ...
include/GFitsTableUShortCol.hpp
1 1 /***************************************************************************
2 2 * GFitsTableUShortCol.hpp - FITS table unsigned short column class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableUShortCol.hpp
15   - * @brief GFitsTableUShortCol class definition.
  23 + * @brief FITS table unsigned short integer column class interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26  
... ... @@ -27,7 +35,7 @@
27 35 /***********************************************************************//**
28 36 * @class GFitsTableUShortCol
29 37 *
30   - * @brief Interface for FITS table unsigned short integer column
  38 + * @brief FITS table unsigned short integer column
31 39 *
32 40 * This class implements a FITS table unsigned short integer column.
33 41 ***************************************************************************/
... ... @@ -46,10 +54,14 @@ public:
46 54 unsigned short& operator() (const int& row, const int& inx = 0);
47 55 const unsigned short& operator() (const int& row, const int& inx = 0) const;
48 56  
49   - // Methods
50   - std::string string(const int& row, const int& col = 0);
51   - double real(const int& row, const int& col = 0);
52   - int integer(const int& row, const int& col = 0);
  57 + // Implement virtual methods
  58 + virtual std::string string(const int& row, const int& col = 0);
  59 + virtual double real(const int& row, const int& col = 0);
  60 + virtual int integer(const int& row, const int& col = 0);
  61 + virtual void insert(const int& rownum, const int& nrows);
  62 + virtual void remove(const int& rownum, const int& nrows);
  63 +
  64 + // Other methods
53 65 unsigned short* data(void) { return m_data; }
54 66 void nulval(const unsigned short* value);
55 67 unsigned short* nulval(void) { return m_nulval; }
... ...
pyext/GFitsTableBitCol.i
1 1 /***************************************************************************
2 2 * GFitsTableBitCol.i - FITS table bit column class SWIG definition *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright : (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableBitCol.i
15   - * @brief GFitsTableBitCol class SWIG file.
  23 + * @brief FITS table bit column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableBitCol
26 34 *
27   - * @brief SWIG interface for FITS table logical column
  35 + * @brief FITS table bit column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableBitCol : public GFitsTableCol {
30 38 public:
... ... @@ -35,18 +43,27 @@ public:
35 43 GFitsTableBitCol(const GFitsTableBitCol& column);
36 44 virtual ~GFitsTableBitCol(void);
37 45  
38   - // Methods
39   - std::string string(const int& row, const int& col = 0);
40   - double real(const int& row, const int& col = 0);
41   - int integer(const int& row, const int& col = 0);
42   - unsigned char* data(void) { return m_data; }
  46 + // Implement virtual methods
  47 + virtual std::string string(const int& row, const int& col = 0);
  48 + virtual double real(const int& row, const int& col = 0);
  49 + virtual int integer(const int& row, const int& col = 0);
  50 + virtual void insert(const int& rownum, const int& nrows);
  51 + virtual void remove(const int& rownum, const int& nrows);
  52 +
  53 + // Other methods
  54 + unsigned char* data(void);
43 55 void nulval(const unsigned char* value);
44   - unsigned char* nulval(void) { return m_nulval; }
  56 + unsigned char* nulval(void);
45 57 };
46 58  
47 59  
48 60 /***********************************************************************//**
49 61 * @brief GFitsTableBitCol class extension
  62 + *
  63 + * @todo We would like to return a reference in __getitem__ so that we can
  64 + * set the elements in an iterator. Declaring simply a reference
  65 + * shows an object pointer instead of the content. I still have to
  66 + * find out how to implement this (e.g. via typemaps).
50 67 ***************************************************************************/
51 68 %extend GFitsTableBitCol {
52 69 bool __getitem__(int GFitsTableColInx[]) {
... ...
pyext/GFitsTableBoolCol.i
1 1 /***************************************************************************
2 2 * GFitsTableBoolCol.i - FITS table boolean column class SWIG definition *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright : (C) 2008-2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableBoolCol.i
15   - * @brief GFitsTableBoolCol class SWIG file.
  23 + * @brief FITS table Boolean column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableBoolCol
26 34 *
27   - * @brief SWIG interface for FITS table logical column
  35 + * @brief FITS table Boolean column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableBoolCol : public GFitsTableCol {
30 38 public:
... ... @@ -35,18 +43,27 @@ public:
35 43 GFitsTableBoolCol(const GFitsTableBoolCol& column);
36 44 virtual ~GFitsTableBoolCol(void);
37 45  
38   - // Methods
39   - std::string string(const int& row, const int& col = 0);
40   - double real(const int& row, const int& col = 0);
41   - int integer(const int& row, const int& col = 0);
42   - bool* data(void) { return m_data; }
43   - void nulval(const bool* value);
44   - bool* nulval(void) { return m_nulval; }
  46 + // Implement virtual methods
  47 + virtual std::string string(const int& row, const int& col = 0);
  48 + virtual double real(const int& row, const int& col = 0);
  49 + virtual int integer(const int& row, const int& col = 0);
  50 + virtual void insert(const int& rownum, const int& nrows);
  51 + virtual void remove(const int& rownum, const int& nrows);
  52 +
  53 + // Other methods
  54 + bool* data(void);
  55 + void nulval(const bool* value);
  56 + bool* nulval(void);
45 57 };
46 58  
47 59  
48 60 /***********************************************************************//**
49 61 * @brief GFitsTableBoolCol class extension
  62 + *
  63 + * @todo We would like to return a reference in __getitem__ so that we can
  64 + * set the elements in an iterator. Declaring simply a reference
  65 + * shows an object pointer instead of the content. I still have to
  66 + * find out how to implement this (e.g. via typemaps).
50 67 ***************************************************************************/
51 68 %extend GFitsTableBoolCol {
52 69 bool __getitem__(int GFitsTableColInx[]) {
... ...
pyext/GFitsTableByteCol.i
1 1 /***************************************************************************
2 2 * GFitsTableByteCol.i - FITS table Byte column class SWIG definition *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright : (C) 2008-2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableByteCol.i
15   - * @brief GFitsTableByteCol class SWIG file.
  23 + * @brief FITS table Byte column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableByteCol
26 34 *
27   - * @brief SWIG interface for FITS table short integer column
  35 + * @brief FITS table Byte column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableByteCol : public GFitsTableCol {
30 38 public:
... ... @@ -34,18 +42,27 @@ public:
34 42 GFitsTableByteCol(const GFitsTableByteCol& column);
35 43 virtual ~GFitsTableByteCol(void);
36 44  
37   - // Methods
38   - std::string string(const int& row, const int& col = 0);
39   - double real(const int& row, const int& col = 0);
40   - int integer(const int& row, const int& col = 0);
41   - unsigned char* data(void) { return m_data; }
  45 + // Implement virtual methods
  46 + virtual std::string string(const int& row, const int& col = 0);
  47 + virtual double real(const int& row, const int& col = 0);
  48 + virtual int integer(const int& row, const int& col = 0);
  49 + virtual void insert(const int& rownum, const int& nrows);
  50 + virtual void remove(const int& rownum, const int& nrows);
  51 +
  52 + // Other methods
  53 + unsigned char* data(void);
42 54 void nulval(const unsigned char* value);
43   - unsigned char* nulval(void) { return m_nulval; }
  55 + unsigned char* nulval(void);
44 56 };
45 57  
46 58  
47 59 /***********************************************************************//**
48 60 * @brief GFitsTableByteCol class extension
  61 + *
  62 + * @todo We would like to return a reference in __getitem__ so that we can
  63 + * set the elements in an iterator. Declaring simply a reference
  64 + * shows an object pointer instead of the content. I still have to
  65 + * find out how to implement this (e.g. via typemaps).
49 66 ***************************************************************************/
50 67 %extend GFitsTableByteCol {
51 68 unsigned char __getitem__(int GFitsTableColInx[]) {
... ...
pyext/GFitsTableCDoubleCol.i
1 1 /***************************************************************************
2 2 * GFitsTableCDoubleCol.i - FITS table double precision complex column *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableCDoubleCol.i
15   - * @brief GFitsTableCDoubleCol class SWIG file.
  23 + * @brief FITS table double complex column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableCDoubleCol
26 34 *
27   - * @brief SWIG interface for FITS table floating point column
  35 + * @brief FITS table double complex column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableCDoubleCol : public GFitsTableCol {
30 38 public:
... ... @@ -35,13 +43,17 @@ public:
35 43 GFitsTableCDoubleCol(const GFitsTableCDoubleCol& column);
36 44 virtual ~GFitsTableCDoubleCol(void);
37 45  
38   - // Methods
39   - std::string string(const int& row, const int& col = 0);
40   - double real(const int& row, const int& col = 0);
41   - int integer(const int& row, const int& col = 0);
42   - GFits::cdouble* data(void) { return m_data; }
  46 + // Implement virtual methods
  47 + virtual std::string string(const int& row, const int& col = 0);
  48 + virtual double real(const int& row, const int& col = 0);
  49 + virtual int integer(const int& row, const int& col = 0);
  50 + virtual void insert(const int& rownum, const int& nrows);
  51 + virtual void remove(const int& rownum, const int& nrows);
  52 +
  53 + // Other methods
  54 + GFits::cdouble* data(void);
43 55 void nulval(const GFits::cdouble* value);
44   - GFits::cdouble* nulval(void) { return m_nulval; }
  56 + GFits::cdouble* nulval(void);
45 57 };
46 58  
47 59  
... ... @@ -49,7 +61,12 @@ public:
49 61 * @brief GFitsTableCDoubleCol class extension
50 62 *
51 63 * @todo Implement __getitem__ correctly. This probably means that a real
52   - * cdouble class is needed.
  64 + * cdouble class is needed.
  65 + *
  66 + * @todo We would like to return a reference in __getitem__ so that we can
  67 + * set the elements in an iterator. Declaring simply a reference
  68 + * shows an object pointer instead of the content. I still have to
  69 + * find out how to implement this (e.g. via typemaps).
53 70 ***************************************************************************/
54 71 %extend GFitsTableCDoubleCol {
55 72 /*
... ...
pyext/GFitsTableCFloatCol.i
1 1 /***************************************************************************
2 2 * GFitsTableCFloatCol.i - FITS table single precision complex column *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableCFloatCol.i
15   - * @brief GFitsTableCFloatCol class SWIG file.
  23 + * @brief FITS table float complex column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableCFloatCol
26 34 *
27   - * @brief SWIG interface for FITS table floating point column
  35 + * @brief FITS table float complex column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableCFloatCol : public GFitsTableCol {
30 38 public:
... ... @@ -35,13 +43,17 @@ public:
35 43 GFitsTableCFloatCol(const GFitsTableCFloatCol& column);
36 44 virtual ~GFitsTableCFloatCol(void);
37 45  
38   - // Methods
39   - std::string string(const int& row, const int& col = 0);
40   - double real(const int& row, const int& col = 0);
41   - int integer(const int& row, const int& col = 0);
42   - GFits::cfloat* data(void) { return m_data; }
  46 + // Implement virtual methods
  47 + virtual std::string string(const int& row, const int& col = 0);
  48 + virtual double real(const int& row, const int& col = 0);
  49 + virtual int integer(const int& row, const int& col = 0);
  50 + virtual void insert(const int& rownum, const int& nrows);
  51 + virtual void remove(const int& rownum, const int& nrows);
  52 +
  53 + // Other methods
  54 + GFits::cfloat* data(void);
43 55 void nulval(const GFits::cfloat* value);
44   - GFits::cfloat* nulval(void) { return m_nulval; }
  56 + GFits::cfloat* nulval(void);
45 57 };
46 58  
47 59  
... ... @@ -49,7 +61,12 @@ public:
49 61 * @brief GFitsTableCFloatCol class extension
50 62 *
51 63 * @todo Implement __getitem__ method. This probably means that a real
52   - * cfloat class is needed.
  64 + * cfloat class is needed.
  65 + *
  66 + * @todo We would like to return a reference in __getitem__ so that we can
  67 + * set the elements in an iterator. Declaring simply a reference
  68 + * shows an object pointer instead of the content. I still have to
  69 + * find out how to implement this (e.g. via typemaps).
53 70 ***************************************************************************/
54 71 %extend GFitsTableCFloatCol {
55 72 /*
... ...
pyext/GFitsTableCol.i
... ... @@ -4,15 +4,23 @@
4 4 * copyright : (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableCol.i
15   - * @brief GFitsTableCol class SWIG file.
  23 + * @brief FITS table column abstract Python base class definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -25,7 +33,7 @@
25 33 /***********************************************************************//**
26 34 * @class GFitsTableCol
27 35 *
28   - * @brief Abstract SWIG interface for FITS table column
  36 + * @brief FITS table column abstract Python base class definition
29 37 ***************************************************************************/
30 38 class GFitsTableCol {
31 39 public:
... ... @@ -40,6 +48,8 @@ public:
40 48 virtual std::string string(const int& row, const int& inx = 0) = 0;
41 49 virtual double real(const int& row, const int& inx = 0) = 0;
42 50 virtual int integer(const int& row, const int& inx = 0) = 0;
  51 + virtual void insert(const int& rownum, const int& nrows) = 0;
  52 + virtual void remove(const int& rownum, const int& nrows) = 0;
43 53  
44 54 // Base class Methods
45 55 void name(const std::string& name);
... ...
pyext/GFitsTableDoubleCol.i
1 1 /***************************************************************************
2 2 * GFitsTableDoubleCol.i - FITS table double column class SWIG definiton *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableDoubleCol.i
15   - * @brief GFitsTableDoubleCol class SWIG file.
  23 + * @brief FITS table double column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableDoubleCol
26 34 *
27   - * @brief SWIG interface for FITS table double precision column
  35 + * @brief FITS table double column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableDoubleCol : public GFitsTableCol {
30 38 public:
... ... @@ -35,21 +43,30 @@ public:
35 43 GFitsTableDoubleCol(const GFitsTableDoubleCol& column);
36 44 virtual ~GFitsTableDoubleCol(void);
37 45  
38   - // Methods
39   - std::string string(const int& row, const int& inx = 0);
40   - double real(const int& row, const int& inx = 0);
41   - int integer(const int& row, const int& inx = 0);
42   - double* data(void) { return m_data; }
43   - void nulval(const double* value);
44   - double* nulval(void) { return m_nulval; }
  46 + // Implement virtual methods
  47 + virtual std::string string(const int& row, const int& col = 0);
  48 + virtual double real(const int& row, const int& col = 0);
  49 + virtual int integer(const int& row, const int& col = 0);
  50 + virtual void insert(const int& rownum, const int& nrows);
  51 + virtual void remove(const int& rownum, const int& nrows);
  52 +
  53 + // Other methods
  54 + double* data(void);
  55 + void nulval(const double* value);
  56 + double* nulval(void);
45 57 };
46 58  
47 59  
48 60 /***********************************************************************//**
49 61 * @brief GFitsTableDoubleCol class extension
  62 + *
  63 + * @todo We would like to return a reference in __getitem__ so that we can
  64 + * set the elements in an iterator. Declaring simply a reference
  65 + * shows an object pointer instead of the content. I still have to
  66 + * find out how to implement this (e.g. via typemaps).
50 67 ***************************************************************************/
51 68 %extend GFitsTableDoubleCol {
52   - double __getitem__(int GFitsTableColInx[]) {
  69 + double __getitem__(int GFitsTableColInx[]) {
53 70 if (GFitsTableColInx[0] == 1)
54 71 return (*self)(GFitsTableColInx[1]);
55 72 else
... ...
pyext/GFitsTableFloatCol.i
1 1 /***************************************************************************
2 2 * GFitsTableFloatCol.i - FITS table float column class SWIG definition *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableFloatCol.i
15   - * @brief GFitsTableFloatCol class SWIG file.
  23 + * @brief FITS table float column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableFloatCol
26 34 *
27   - * @brief SWIG interface for FITS table floating point column
  35 + * @brief FITS table float column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableFloatCol : public GFitsTableCol {
30 38 public:
... ... @@ -35,18 +43,27 @@ public:
35 43 GFitsTableFloatCol(const GFitsTableFloatCol& column);
36 44 virtual ~GFitsTableFloatCol(void);
37 45  
38   - // Methods
39   - std::string string(const int& row, const int& col = 0);
40   - double real(const int& row, const int& col = 0);
41   - int integer(const int& row, const int& col = 0);
42   - float* data(void) { return m_data; }
43   - void nulval(const float* value);
44   - float* nulval(void) { return m_nulval; }
  46 + // Implement virtual methods
  47 + virtual std::string string(const int& row, const int& col = 0);
  48 + virtual double real(const int& row, const int& col = 0);
  49 + virtual int integer(const int& row, const int& col = 0);
  50 + virtual void insert(const int& rownum, const int& nrows);
  51 + virtual void remove(const int& rownum, const int& nrows);
  52 +
  53 + // Other methods
  54 + float* data(void);
  55 + void nulval(const float* value);
  56 + float* nulval(void);
45 57 };
46 58  
47 59  
48 60 /***********************************************************************//**
49 61 * @brief GFitsTableFloatCol class extension
  62 + *
  63 + * @todo We would like to return a reference in __getitem__ so that we can
  64 + * set the elements in an iterator. Declaring simply a reference
  65 + * shows an object pointer instead of the content. I still have to
  66 + * find out how to implement this (e.g. via typemaps).
50 67 ***************************************************************************/
51 68 %extend GFitsTableFloatCol {
52 69 float __getitem__(int GFitsTableColInx[]) {
... ...
pyext/GFitsTableLongCol.i
1 1 /***************************************************************************
2 2 * GFitsTableLongCol.i - FITS table long column class SWIG definiton *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright : (C) 2008-2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableLongCol.i
15   - * @brief GFitsTableLongCol class SWIG file.
  23 + * @brief FITS table long integer column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableLongCol
26 34 *
27   - * @brief SWIG interface for FITS table long integer column
  35 + * @brief FITS table long integer column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableLongCol : public GFitsTableCol {
30 38 public:
... ... @@ -35,18 +43,27 @@ public:
35 43 GFitsTableLongCol(const GFitsTableLongCol& column);
36 44 virtual ~GFitsTableLongCol(void);
37 45  
38   - // Methods
39   - std::string string(const int& row, const int& col = 0);
40   - double real(const int& row, const int& col = 0);
41   - int integer(const int& row, const int& col = 0);
42   - long* data(void) { return m_data; }
43   - void nulval(const long* value);
44   - long* nulval(void) { return m_nulval; }
  46 + // Implement virtual methods
  47 + virtual std::string string(const int& row, const int& col = 0);
  48 + virtual double real(const int& row, const int& col = 0);
  49 + virtual int integer(const int& row, const int& col = 0);
  50 + virtual void insert(const int& rownum, const int& nrows);
  51 + virtual void remove(const int& rownum, const int& nrows);
  52 +
  53 + // Other methods
  54 + long* data(void);
  55 + void nulval(const long* value);
  56 + long* nulval(void);
45 57 };
46 58  
47 59  
48 60 /***********************************************************************//**
49 61 * @brief GFitsTableLongCol class extension
  62 + *
  63 + * @todo We would like to return a reference in __getitem__ so that we can
  64 + * set the elements in an iterator. Declaring simply a reference
  65 + * shows an object pointer instead of the content. I still have to
  66 + * find out how to implement this (e.g. via typemaps).
50 67 ***************************************************************************/
51 68 %extend GFitsTableLongCol {
52 69 long __getitem__(int GFitsTableColInx[]) {
... ...
pyext/GFitsTableLongLongCol.i
1 1 /***************************************************************************
2 2 * GFitsTableLongLongCol.i - FITS table long long column class SWIG def. *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright : (C) 2008-2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableLongLongCol.i
15   - * @brief GFitsTableLongLongCol class SWIG file.
  23 + * @brief FITS table long long integer column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableLongLongCol
26 34 *
27   - * @brief SWIG interface for FITS table long integer column
  35 + * @brief FITS table long long integer column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableLongLongCol : public GFitsTableCol {
30 38 public:
... ... @@ -35,18 +43,27 @@ public:
35 43 GFitsTableLongLongCol(const GFitsTableLongLongCol& column);
36 44 virtual ~GFitsTableLongLongCol(void);
37 45  
38   - // Methods
39   - std::string string(const int& row, const int& col = 0);
40   - double real(const int& row, const int& col = 0);
41   - int integer(const int& row, const int& col = 0);
42   - long long* data(void) { return m_data; }
  46 + // Implement virtual methods
  47 + virtual std::string string(const int& row, const int& col = 0);
  48 + virtual double real(const int& row, const int& col = 0);
  49 + virtual int integer(const int& row, const int& col = 0);
  50 + virtual void insert(const int& rownum, const int& nrows);
  51 + virtual void remove(const int& rownum, const int& nrows);
  52 +
  53 + // Other methods
  54 + long long* data(void);
43 55 void nulval(const long long* value);
44   - long long* nulval(void) { return m_nulval; }
  56 + long long* nulval(void);
45 57 };
46 58  
47 59  
48 60 /***********************************************************************//**
49 61 * @brief GFitsTableLongLongCol class extension
  62 + *
  63 + * @todo We would like to return a reference in __getitem__ so that we can
  64 + * set the elements in an iterator. Declaring simply a reference
  65 + * shows an object pointer instead of the content. I still have to
  66 + * find out how to implement this (e.g. via typemaps).
50 67 ***************************************************************************/
51 68 %extend GFitsTableLongLongCol {
52 69 long long __getitem__(int GFitsTableColInx[]) {
... ...
pyext/GFitsTableShortCol.i
1 1 /***************************************************************************
2 2 * GFitsTableShortCol.i - FITS table short column class SWIG definition *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright : (C) 2008-2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableShortCol.i
15   - * @brief GFitsTableShortCol class SWIG file.
  23 + * @brief FITS table short integer column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableShortCol
26 34 *
27   - * @brief SWIG interface for FITS table short integer column
  35 + * @brief FITS table short integer column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableShortCol : public GFitsTableCol {
30 38 public:
... ... @@ -35,18 +43,27 @@ public:
35 43 GFitsTableShortCol(const GFitsTableShortCol& column);
36 44 virtual ~GFitsTableShortCol(void);
37 45  
38   - // Methods
39   - std::string string(const int& row, const int& col = 0);
40   - double real(const int& row, const int& col = 0);
41   - int integer(const int& row, const int& col = 0);
42   - short* data(void) { return m_data; }
43   - void nulval(const short* value);
44   - short* nulval(void) { return m_nulval; }
  46 + // Implement virtual methods
  47 + virtual std::string string(const int& row, const int& col = 0);
  48 + virtual double real(const int& row, const int& col = 0);
  49 + virtual int integer(const int& row, const int& col = 0);
  50 + virtual void insert(const int& rownum, const int& nrows);
  51 + virtual void remove(const int& rownum, const int& nrows);
  52 +
  53 + // Other methods
  54 + short* data(void);
  55 + void nulval(const short* value);
  56 + short* nulval(void);
45 57 };
46 58  
47 59  
48 60 /***********************************************************************//**
49 61 * @brief GFitsTableShortCol class extension
  62 + *
  63 + * @todo We would like to return a reference in __getitem__ so that we can
  64 + * set the elements in an iterator. Declaring simply a reference
  65 + * shows an object pointer instead of the content. I still have to
  66 + * find out how to implement this (e.g. via typemaps).
50 67 ***************************************************************************/
51 68 %extend GFitsTableShortCol {
52 69 short __getitem__(int GFitsTableColInx[]) {
... ...
pyext/GFitsTableStringCol.i
1 1 /***************************************************************************
2 2 * GFitsTableStringCol.i - FITS table string column class SWIG definition *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright : (C) 2008-2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableStringCol.i
15   - * @brief GFitsTableStringCol class SWIG file.
  23 + * @brief FITS table string column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableStringCol
26 34 *
27   - * @brief SWIG interface for FITS table string column
  35 + * @brief FITS table string column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableStringCol : public GFitsTableCol {
30 38 public:
... ... @@ -35,18 +43,27 @@ public:
35 43 GFitsTableStringCol(const GFitsTableStringCol& column);
36 44 virtual ~GFitsTableStringCol(void);
37 45  
38   - // Methods
39   - std::string string(const int& row, const int& col = 0);
40   - double real(const int& row, const int& col = 0);
41   - int integer(const int& row, const int& col = 0);
42   - std::string* data(void) { return m_data; }
43   - void nulval(const std::string value);
44   - char* nulval(void) { return m_nulval; }
  46 + // Implement virtual methods
  47 + virtual std::string string(const int& row, const int& col = 0);
  48 + virtual double real(const int& row, const int& col = 0);
  49 + virtual int integer(const int& row, const int& col = 0);
  50 + virtual void insert(const int& rownum, const int& nrows);
  51 + virtual void remove(const int& rownum, const int& nrows);
  52 +
  53 + // Other methods
  54 + std::string* data(void);
  55 + void nulval(const std::string& value);
  56 + char* nulval(void);
45 57 };
46 58  
47 59  
48 60 /***********************************************************************//**
49 61 * @brief GFitsTableStringCol class extension
  62 + *
  63 + * @todo We would like to return a reference in __getitem__ so that we can
  64 + * set the elements in an iterator. Declaring simply a reference
  65 + * shows an object pointer instead of the content. I still have to
  66 + * find out how to implement this (e.g. via typemaps).
50 67 ***************************************************************************/
51 68 %extend GFitsTableStringCol {
52 69 std::string __getitem__(int GFitsTableColInx[]) {
... ...
pyext/GFitsTableULongCol.i
1 1 /***************************************************************************
2 2 * GFitsTableULongCol.i - FITS table unsigned long column class SWIG def. *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright : (C) 2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableULongCol.i
15   - * @brief GFitsTableULongCol class SWIG file.
  23 + * @brief FITS table unsigned long integer column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableULongCol
26 34 *
27   - * @brief SWIG interface for FITS table long integer column
  35 + * @brief FITS table unsigned long integer column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableULongCol : public GFitsTableCol {
30 38 public:
... ... @@ -35,18 +43,27 @@ public:
35 43 GFitsTableULongCol(const GFitsTableULongCol& column);
36 44 virtual ~GFitsTableULongCol(void);
37 45  
38   - // Methods
39   - std::string string(const int& row, const int& col = 0);
40   - double real(const int& row, const int& col = 0);
41   - int integer(const int& row, const int& col = 0);
42   - unsigned long* data(void) { return m_data; }
  46 + // Implement virtual methods
  47 + virtual std::string string(const int& row, const int& col = 0);
  48 + virtual double real(const int& row, const int& col = 0);
  49 + virtual int integer(const int& row, const int& col = 0);
  50 + virtual void insert(const int& rownum, const int& nrows);
  51 + virtual void remove(const int& rownum, const int& nrows);
  52 +
  53 + // Other methods
  54 + unsigned long* data(void);
43 55 void nulval(const unsigned long* value);
44   - unsigned long* nulval(void) { return m_nulval; }
  56 + unsigned long* nulval(void);
45 57 };
46 58  
47 59  
48 60 /***********************************************************************//**
49 61 * @brief GFitsTableULongCol class extension
  62 + *
  63 + * @todo We would like to return a reference in __getitem__ so that we can
  64 + * set the elements in an iterator. Declaring simply a reference
  65 + * shows an object pointer instead of the content. I still have to
  66 + * find out how to implement this (e.g. via typemaps).
50 67 ***************************************************************************/
51 68 %extend GFitsTableULongCol {
52 69 unsigned long __getitem__(int GFitsTableColInx[]) {
... ...
pyext/GFitsTableUShortCol.i
1 1 /***************************************************************************
2 2 * GFitsTableUShortCol.i - FITS table unsigned short column class SWIG def*
3 3 * ----------------------------------------------------------------------- *
4   - * copyright : (C) 2008-2010 by Jurgen Knodlseder *
  4 + * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
14 22 * @file GFitsTableUShortCol.i
15   - * @brief GFitsTableUShortCol class SWIG file.
  23 + * @brief FITS table unsigend short integer column class Python interface definition
16 24 * @author J. Knodlseder
17 25 */
18 26 %{
... ... @@ -24,7 +32,7 @@
24 32 /***********************************************************************//**
25 33 * @class GFitsTableUShortCol
26 34 *
27   - * @brief SWIG interface for FITS table short integer column
  35 + * @brief FITS table unsigned short integer column Python interface definition
28 36 ***************************************************************************/
29 37 class GFitsTableUShortCol : public GFitsTableCol {
30 38 public:
... ... @@ -35,18 +43,27 @@ public:
35 43 GFitsTableUShortCol(const GFitsTableUShortCol& column);
36 44 virtual ~GFitsTableUShortCol(void);
37 45  
38   - // Methods
39   - std::string string(const int& row, const int& col = 0);
40   - double real(const int& row, const int& col = 0);
41   - int integer(const int& row, const int& col = 0);
42   - unsigned short* data(void) { return m_data; }
  46 + // Implement virtual methods
  47 + virtual std::string string(const int& row, const int& col = 0);
  48 + virtual double real(const int& row, const int& col = 0);
  49 + virtual int integer(const int& row, const int& col = 0);
  50 + virtual void insert(const int& rownum, const int& nrows);
  51 + virtual void remove(const int& rownum, const int& nrows);
  52 +
  53 + // Other methods
  54 + unsigned short* data(void);
43 55 void nulval(const unsigned short* value);
44   - unsigned short* nulval(void) { return m_nulval; }
  56 + unsigned short* nulval(void);
45 57 };
46 58  
47 59  
48 60 /***********************************************************************//**
49 61 * @brief GFitsTableUShortCol class extension
  62 + *
  63 + * @todo We would like to return a reference in __getitem__ so that we can
  64 + * set the elements in an iterator. Declaring simply a reference
  65 + * shows an object pointer instead of the content. I still have to
  66 + * find out how to implement this (e.g. via typemaps).
50 67 ***************************************************************************/
51 68 %extend GFitsTableUShortCol {
52 69 unsigned short __getitem__(int GFitsTableColInx[]) {
... ...
src/fits/GFitsTableBitCol.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2008-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -27,6 +35,8 @@
27 35 #include "GFitsTableBitCol.hpp"
28 36  
29 37 /* __ Method name definitions ____________________________________________ */
  38 +#define G_INSERT "GFitsTableBitCol::insert(int&, int&)"
  39 +#define G_REMOVE "GFitsTableBitCol::remove(int&, int&)"
30 40 #define G_LOAD_COLUMN "GFitsTableBitCol::load_column()"
31 41 #define G_SAVE_COLUMN "GFitsTableBitCol::save_column()"
32 42 #define G_GET_BIT "GFitsTableBitCol::get_bit(int&,int&)"
... ... @@ -269,6 +279,188 @@ int GFitsTableBitCol::integer(const int&amp; row, const int&amp; inx)
269 279  
270 280  
271 281 /***********************************************************************//**
  282 + * @brief Insert rows in column
  283 + *
  284 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  285 + * @param[in] nrows Number of rows to be inserted.
  286 + *
  287 + * @exception GException::fits_invalid_row
  288 + * Specified rownum is invalid.
  289 + *
  290 + * This method inserts rows into a FITS table. This implies that the column
  291 + * will be loaded into memory.
  292 + ***************************************************************************/
  293 +void GFitsTableBitCol::insert(const int& rownum, const int& nrows)
  294 +{
  295 + // Make sure that rownum is valid
  296 + if (rownum < 0 || rownum > m_length)
  297 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  298 +
  299 + // Continue only if there are rows to be inserted
  300 + if (nrows > 0) {
  301 +
  302 + // If we have no rows yet then simply set the length to the
  303 + // number of rows to be inserted
  304 + if (m_length == 0) {
  305 + m_length = nrows;
  306 + }
  307 +
  308 + // ... otherwise fetch data, allocate new data and copy over
  309 + // the existing items
  310 + else {
  311 +
  312 + // If data are not available then load them now
  313 + if (m_data == NULL) fetch_data();
  314 +
  315 + // Set any pending Bit
  316 + set_pending();
  317 +
  318 + // Compute new column length
  319 + int length = m_length + nrows;
  320 +
  321 + // Compute total number of Bits in column
  322 + m_bits = m_number * length;
  323 +
  324 + // Compute number of Bytes and Bits per row
  325 + m_bytes_per_row = (m_number > 0) ? ((m_number-1) / 8) + 1 : 0;
  326 + m_bits_per_row = m_bytes_per_row * 8;
  327 +
  328 + // Compute length of memory array
  329 + m_size = m_bytes_per_row * length;
  330 +
  331 + // Allocate new data to hold the column
  332 + unsigned char* new_data = new unsigned char[m_size];
  333 +
  334 + // Compute the number of elements before the insertion point,
  335 + // the number of elements that get inserted, and the total
  336 + // number of elements after the insertion point
  337 + int n_before = m_bytes_per_row * rownum;
  338 + int n_insert = m_bytes_per_row * nrows;
  339 + int n_after = m_bytes_per_row * (m_length - rownum);
  340 +
  341 + // Copy and initialise data
  342 + unsigned char* src = m_data;
  343 + unsigned char* dst = new_data;
  344 + for (int i = 0; i < n_before; ++i)
  345 + *dst++ = *src++;
  346 + for (int i = 0; i < n_insert; ++i)
  347 + *dst++ = 0;
  348 + for (int i = 0; i < n_after; ++i)
  349 + *dst++ = *src++;
  350 +
  351 + // Free old data
  352 + if (m_data != NULL) delete [] m_data;
  353 +
  354 + // Set pointer to new data and store length
  355 + m_data = new_data;
  356 + m_length = length;
  357 +
  358 + } // endelse: there were already data
  359 +
  360 + } // endfor: there were rows to be inserted
  361 +
  362 + // Return
  363 + return;
  364 +}
  365 +
  366 +
  367 +/***********************************************************************//**
  368 + * @brief Remove rows from column
  369 + *
  370 + * @param[in] rownum Row after which rows should be removed (0=first row).
  371 + * @param[in] nrows Number of rows to be removed.
  372 + *
  373 + * @exception GException::fits_invalid_row
  374 + * Specified rownum is invalid.
  375 + * @exception GException::fits_invalid_nrows
  376 + * Invalid number of rows specified.
  377 + *
  378 + * This method removes rows from a FITS table. This implies that the column
  379 + * will be loaded into memory.
  380 + ***************************************************************************/
  381 +void GFitsTableBitCol::remove(const int& rownum, const int& nrows)
  382 +{
  383 + // Make sure that rownum is valid
  384 + if (rownum < 0 || rownum >= m_length)
  385 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  386 +
  387 + // Make sure that we don't remove beyond the limit
  388 + if (nrows < 0 || nrows > m_length-rownum)
  389 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  390 +
  391 + // Continue only if there are rows to be removed
  392 + if (nrows > 0) {
  393 +
  394 + // If data are not available then load them now
  395 + if (m_data == NULL) fetch_data();
  396 +
  397 + // Set any pending Bit
  398 + set_pending();
  399 +
  400 + // Compute new column length
  401 + int length = m_length - nrows;
  402 +
  403 + // Compute total number of Bits in column
  404 + m_bits = m_number * length;
  405 +
  406 + // Compute number of Bytes and Bits per row
  407 + m_bytes_per_row = (m_number > 0) ? ((m_number-1) / 8) + 1 : 0;
  408 + m_bits_per_row = m_bytes_per_row * 8;
  409 +
  410 + // Compute length of memory array
  411 + m_size = m_bytes_per_row * length;
  412 +
  413 + // If we have rows remaining then allocate new data to hold
  414 + // the column
  415 + if (m_size > 0) {
  416 +
  417 + // Allocate new data to hold the column
  418 + unsigned char* new_data = new unsigned char[m_size];
  419 +
  420 + // Compute the number of elements before the removal point,
  421 + // the number of elements that get removed, and the total
  422 + // number of elements after the removal point
  423 + int n_before = m_bytes_per_row * rownum;
  424 + int n_remove = m_bytes_per_row * nrows;
  425 + int n_after = m_bytes_per_row * (length - rownum);
  426 +
  427 + // Copy data
  428 + unsigned char* src = m_data;
  429 + unsigned char* dst = new_data;
  430 + for (int i = 0; i < n_before; ++i)
  431 + *dst++ = *src++;
  432 + src += n_remove;
  433 + for (int i = 0; i < n_after; ++i)
  434 + *dst++ = *src++;
  435 +
  436 + // Free old data
  437 + if (m_data != NULL) delete [] m_data;
  438 +
  439 + // Set pointer to new data and store length
  440 + m_data = new_data;
  441 + m_length = length;
  442 +
  443 + } // endif: there are still elements after removal
  444 +
  445 + // ... otherwise just remove all data
  446 + else {
  447 +
  448 + // Free old data
  449 + if (m_data != NULL) delete [] m_data;
  450 +
  451 + // Set pointer to new data and store length
  452 + m_data = NULL;
  453 + m_length = length;
  454 + }
  455 +
  456 + } // endfor: there were rows to be removed
  457 +
  458 + // Return
  459 + return;
  460 +}
  461 +
  462 +
  463 +/***********************************************************************//**
272 464 * @brief Set nul value
273 465 *
274 466 * @param[in] value Nul value.
... ... @@ -614,8 +806,10 @@ void GFitsTableBitCol::save_column(void)
614 806 * @param[in] row Row of column.
615 807 * @param[in] inx Vector index in column row.
616 808 *
  809 + * @exception GException::fits_invalid_row
  810 + * Table row out of valid range.
617 811 * @exception GException::out_of_range
618   - * Table row or vector index are out of valid range.
  812 + * Table vector index out of valid range.
619 813 *
620 814 * Set the Bit for boolean data access. Note that this method assumes that
621 815 * the data have already been loaded.
... ... @@ -625,7 +819,7 @@ void GFitsTableBitCol::get_bit(const int&amp; row, const int&amp; inx)
625 819 // Check row value
626 820 #if defined(G_RANGE_CHECK)
627 821 if (row < 0 || row >= m_length)
628   - throw GException::out_of_range(G_GET_BIT, row, 0, m_length-1);
  822 + throw GException::fits_invalid_row(G_GET_BIT, row, m_length-1);
629 823 #endif
630 824  
631 825 // Check inx value
... ...
src/fits/GFitsTableBoolCol.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -27,6 +35,8 @@
27 35 #include "GFitsTableBoolCol.hpp"
28 36  
29 37 /* __ Method name definitions ____________________________________________ */
  38 +#define G_INSERT "GFitsTableBoolCol::insert(int&, int&)"
  39 +#define G_REMOVE "GFitsTableBoolCol::remove(int&, int&)"
30 40  
31 41 /* __ Macros _____________________________________________________________ */
32 42  
... ... @@ -247,6 +257,168 @@ int GFitsTableBoolCol::integer(const int&amp; row, const int&amp; inx)
247 257  
248 258  
249 259 /***********************************************************************//**
  260 + * @brief Insert rows in column
  261 + *
  262 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  263 + * @param[in] nrows Number of rows to be inserted.
  264 + *
  265 + * @exception GException::fits_invalid_row
  266 + * Specified rownum is invalid.
  267 + *
  268 + * This method inserts rows into a FITS table. This implies that the column
  269 + * will be loaded into memory.
  270 + ***************************************************************************/
  271 +void GFitsTableBoolCol::insert(const int& rownum, const int& nrows)
  272 +{
  273 + // Make sure that rownum is valid
  274 + if (rownum < 0 || rownum > m_length)
  275 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  276 +
  277 + // Continue only if there are rows to be inserted
  278 + if (nrows > 0) {
  279 +
  280 + // If we have no rows yet then simply set the length to the
  281 + // number of rows to be inserted
  282 + if (m_length == 0) {
  283 + m_length = nrows;
  284 + }
  285 +
  286 + // ... otherwise fetch data, allocate new data and copy over
  287 + // the existing items
  288 + else {
  289 +
  290 + // If data are not available then load them now
  291 + if (m_data == NULL) fetch_data();
  292 +
  293 + // Compute new column length
  294 + int length = m_length + nrows;
  295 +
  296 + // Calculate size of new memory
  297 + m_size = m_number * length;
  298 +
  299 + // Allocate new data to hold the column
  300 + bool* new_data = new bool[m_size];
  301 +
  302 + // Compute the number of elements before the insertion point,
  303 + // the number of elements that get inserted, and the total
  304 + // number of elements after the insertion point
  305 + int n_before = m_number * rownum;
  306 + int n_insert = m_number * nrows;
  307 + int n_after = m_number * (m_length - rownum);
  308 +
  309 + // Copy and initialise data
  310 + bool* src = m_data;
  311 + bool* dst = new_data;
  312 + for (int i = 0; i < n_before; ++i)
  313 + *dst++ = *src++;
  314 + for (int i = 0; i < n_insert; ++i)
  315 + *dst++ = 0;
  316 + for (int i = 0; i < n_after; ++i)
  317 + *dst++ = *src++;
  318 +
  319 + // Free old data
  320 + if (m_data != NULL) delete [] m_data;
  321 +
  322 + // Set pointer to new data and store length
  323 + m_data = new_data;
  324 + m_length = length;
  325 +
  326 + } // endelse: there were already data
  327 +
  328 + } // endfor: there were rows to be inserted
  329 +
  330 + // Return
  331 + return;
  332 +}
  333 +
  334 +
  335 +/***********************************************************************//**
  336 + * @brief Remove rows from column
  337 + *
  338 + * @param[in] rownum Row after which rows should be removed (0=first row).
  339 + * @param[in] nrows Number of rows to be removed.
  340 + *
  341 + * @exception GException::fits_invalid_row
  342 + * Specified rownum is invalid.
  343 + * @exception GException::fits_invalid_nrows
  344 + * Invalid number of rows specified.
  345 + *
  346 + * This method removes rows from a FITS table. This implies that the column
  347 + * will be loaded into memory.
  348 + ***************************************************************************/
  349 +void GFitsTableBoolCol::remove(const int& rownum, const int& nrows)
  350 +{
  351 + // Make sure that rownum is valid
  352 + if (rownum < 0 || rownum >= m_length)
  353 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  354 +
  355 + // Make sure that we don't remove beyond the limit
  356 + if (nrows < 0 || nrows > m_length-rownum)
  357 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  358 +
  359 + // Continue only if there are rows to be removed
  360 + if (nrows > 0) {
  361 +
  362 + // If data are not available then load them now
  363 + if (m_data == NULL) fetch_data();
  364 +
  365 + // Compute new column length
  366 + int length = m_length - nrows;
  367 +
  368 + // Calculate size of new memory
  369 + m_size = m_number * length;
  370 +
  371 + // If we have rows remaining then allocate new data to hold
  372 + // the column
  373 + if (m_size > 0) {
  374 +
  375 + // Allocate new data to hold the column
  376 + bool* new_data = new bool[m_size];
  377 +
  378 + // Compute the number of elements before the removal point,
  379 + // the number of elements that get removed, and the total
  380 + // number of elements after the removal point
  381 + int n_before = m_number * rownum;
  382 + int n_remove = m_number * nrows;
  383 + int n_after = m_number * (length - rownum);
  384 +
  385 + // Copy data
  386 + bool* src = m_data;
  387 + bool* dst = new_data;
  388 + for (int i = 0; i < n_before; ++i)
  389 + *dst++ = *src++;
  390 + src += n_remove;
  391 + for (int i = 0; i < n_after; ++i)
  392 + *dst++ = *src++;
  393 +
  394 + // Free old data
  395 + if (m_data != NULL) delete [] m_data;
  396 +
  397 + // Set pointer to new data and store length
  398 + m_data = new_data;
  399 + m_length = length;
  400 +
  401 + } // endif: there are still elements after removal
  402 +
  403 + // ... otherwise just remove all data
  404 + else {
  405 +
  406 + // Free old data
  407 + if (m_data != NULL) delete [] m_data;
  408 +
  409 + // Set pointer to new data and store length
  410 + m_data = NULL;
  411 + m_length = length;
  412 + }
  413 +
  414 + } // endfor: there were rows to be removed
  415 +
  416 + // Return
  417 + return;
  418 +}
  419 +
  420 +
  421 +/***********************************************************************//**
250 422 * @brief Set nul value
251 423 *
252 424 * @param[in] value Nul value.
... ...
src/fits/GFitsTableByteCol.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -27,6 +35,8 @@
27 35 #include "GFitsTableByteCol.hpp"
28 36  
29 37 /* __ Method name definitions ____________________________________________ */
  38 +#define G_INSERT "GFitsTableByteCol::insert(int&, int&)"
  39 +#define G_REMOVE "GFitsTableByteCol::remove(int&, int&)"
30 40  
31 41 /* __ Macros _____________________________________________________________ */
32 42  
... ... @@ -248,6 +258,168 @@ int GFitsTableByteCol::integer(const int&amp; row, const int&amp; inx)
248 258  
249 259  
250 260 /***********************************************************************//**
  261 + * @brief Insert rows in column
  262 + *
  263 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  264 + * @param[in] nrows Number of rows to be inserted.
  265 + *
  266 + * @exception GException::fits_invalid_row
  267 + * Specified rownum is invalid.
  268 + *
  269 + * This method inserts rows into a FITS table. This implies that the column
  270 + * will be loaded into memory.
  271 + ***************************************************************************/
  272 +void GFitsTableByteCol::insert(const int& rownum, const int& nrows)
  273 +{
  274 + // Make sure that rownum is valid
  275 + if (rownum < 0 || rownum > m_length)
  276 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  277 +
  278 + // Continue only if there are rows to be inserted
  279 + if (nrows > 0) {
  280 +
  281 + // If we have no rows yet then simply set the length to the
  282 + // number of rows to be inserted
  283 + if (m_length == 0) {
  284 + m_length = nrows;
  285 + }
  286 +
  287 + // ... otherwise fetch data, allocate new data and copy over
  288 + // the existing items
  289 + else {
  290 +
  291 + // If data are not available then load them now
  292 + if (m_data == NULL) fetch_data();
  293 +
  294 + // Compute new column length
  295 + int length = m_length + nrows;
  296 +
  297 + // Calculate size of new memory
  298 + m_size = m_number * length;
  299 +
  300 + // Allocate new data to hold the column
  301 + unsigned char* new_data = new unsigned char[m_size];
  302 +
  303 + // Compute the number of elements before the insertion point,
  304 + // the number of elements that get inserted, and the total
  305 + // number of elements after the insertion point
  306 + int n_before = m_number * rownum;
  307 + int n_insert = m_number * nrows;
  308 + int n_after = m_number * (m_length - rownum);
  309 +
  310 + // Copy and initialise data
  311 + unsigned char* src = m_data;
  312 + unsigned char* dst = new_data;
  313 + for (int i = 0; i < n_before; ++i)
  314 + *dst++ = *src++;
  315 + for (int i = 0; i < n_insert; ++i)
  316 + *dst++ = 0;
  317 + for (int i = 0; i < n_after; ++i)
  318 + *dst++ = *src++;
  319 +
  320 + // Free old data
  321 + if (m_data != NULL) delete [] m_data;
  322 +
  323 + // Set pointer to new data and store length
  324 + m_data = new_data;
  325 + m_length = length;
  326 +
  327 + } // endelse: there were already data
  328 +
  329 + } // endfor: there were rows to be inserted
  330 +
  331 + // Return
  332 + return;
  333 +}
  334 +
  335 +
  336 +/***********************************************************************//**
  337 + * @brief Remove rows from column
  338 + *
  339 + * @param[in] rownum Row after which rows should be removed (0=first row).
  340 + * @param[in] nrows Number of rows to be removed.
  341 + *
  342 + * @exception GException::fits_invalid_row
  343 + * Specified rownum is invalid.
  344 + * @exception GException::fits_invalid_nrows
  345 + * Invalid number of rows specified.
  346 + *
  347 + * This method removes rows from a FITS table. This implies that the column
  348 + * will be loaded into memory.
  349 + ***************************************************************************/
  350 +void GFitsTableByteCol::remove(const int& rownum, const int& nrows)
  351 +{
  352 + // Make sure that rownum is valid
  353 + if (rownum < 0 || rownum >= m_length)
  354 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  355 +
  356 + // Make sure that we don't remove beyond the limit
  357 + if (nrows < 0 || nrows > m_length-rownum)
  358 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  359 +
  360 + // Continue only if there are rows to be removed
  361 + if (nrows > 0) {
  362 +
  363 + // If data are not available then load them now
  364 + if (m_data == NULL) fetch_data();
  365 +
  366 + // Compute new column length
  367 + int length = m_length - nrows;
  368 +
  369 + // Calculate size of new memory
  370 + m_size = m_number * length;
  371 +
  372 + // If we have rows remaining then allocate new data to hold
  373 + // the column
  374 + if (m_size > 0) {
  375 +
  376 + // Allocate new data to hold the column
  377 + unsigned char* new_data = new unsigned char[m_size];
  378 +
  379 + // Compute the number of elements before the removal point,
  380 + // the number of elements that get removed, and the total
  381 + // number of elements after the removal point
  382 + int n_before = m_number * rownum;
  383 + int n_remove = m_number * nrows;
  384 + int n_after = m_number * (length - rownum);
  385 +
  386 + // Copy data
  387 + unsigned char* src = m_data;
  388 + unsigned char* dst = new_data;
  389 + for (int i = 0; i < n_before; ++i)
  390 + *dst++ = *src++;
  391 + src += n_remove;
  392 + for (int i = 0; i < n_after; ++i)
  393 + *dst++ = *src++;
  394 +
  395 + // Free old data
  396 + if (m_data != NULL) delete [] m_data;
  397 +
  398 + // Set pointer to new data and store length
  399 + m_data = new_data;
  400 + m_length = length;
  401 +
  402 + } // endif: there are still elements after removal
  403 +
  404 + // ... otherwise just remove all data
  405 + else {
  406 +
  407 + // Free old data
  408 + if (m_data != NULL) delete [] m_data;
  409 +
  410 + // Set pointer to new data and store length
  411 + m_data = NULL;
  412 + m_length = length;
  413 + }
  414 +
  415 + } // endfor: there were rows to be removed
  416 +
  417 + // Return
  418 + return;
  419 +}
  420 +
  421 +
  422 +/***********************************************************************//**
251 423 * @brief Set nul value
252 424 *
253 425 * @param[in] value Nul value.
... ...
src/fits/GFitsTableCDoubleCol.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -27,6 +35,8 @@
27 35 #include "GFitsTableCDoubleCol.hpp"
28 36  
29 37 /* __ Method name definitions ____________________________________________ */
  38 +#define G_INSERT "GFitsTableCDoubleCol::insert(int&, int&)"
  39 +#define G_REMOVE "GFitsTableCDoubleCol::remove(int&, int&)"
30 40  
31 41 /* __ Macros _____________________________________________________________ */
32 42  
... ... @@ -248,6 +258,171 @@ int GFitsTableCDoubleCol::integer(const int&amp; row, const int&amp; inx)
248 258  
249 259  
250 260 /***********************************************************************//**
  261 + * @brief Insert rows in column
  262 + *
  263 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  264 + * @param[in] nrows Number of rows to be inserted.
  265 + *
  266 + * @exception GException::fits_invalid_row
  267 + * Specified rownum is invalid.
  268 + *
  269 + * This method inserts rows into a FITS table. This implies that all columns
  270 + * will be loaded into memory.
  271 + ***************************************************************************/
  272 +void GFitsTableCDoubleCol::insert(const int& rownum, const int& nrows)
  273 +{
  274 + // Make sure that rownum is valid
  275 + if (rownum < 0 || rownum > m_length)
  276 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  277 +
  278 + // Continue only if there are rows to be inserted
  279 + if (nrows > 0) {
  280 +
  281 + // If we have no rows yet then simply set the length to the
  282 + // number of rows to be inserted
  283 + if (m_length == 0) {
  284 + m_length = nrows;
  285 + }
  286 +
  287 + // ... otherwise fetch data, allocate new data and copy over
  288 + // the existing items
  289 + else {
  290 +
  291 + // If data are not available then load them now
  292 + if (m_data == NULL) fetch_data();
  293 +
  294 + // Compute new column length
  295 + int length = m_length + nrows;
  296 +
  297 + // Calculate size of new memory
  298 + m_size = m_number * length;
  299 +
  300 + // Allocate new data to hold the column
  301 + GFits::cdouble* new_data = new GFits::cdouble[m_size];
  302 +
  303 + // Compute the number of elements before the insertion point,
  304 + // the number of elements that get inserted, and the total
  305 + // number of elements after the insertion point
  306 + int n_before = m_number * rownum;
  307 + int n_insert = m_number * nrows;
  308 + int n_after = m_number * (m_length - rownum);
  309 +
  310 + // Copy and initialise data
  311 + GFits::cdouble* src = m_data;
  312 + GFits::cdouble* dst = new_data;
  313 + for (int i = 0; i < n_before; ++i)
  314 + *dst++ = *src++;
  315 + for (int i = 0; i < n_insert; ++i) {
  316 + dst->re = 0.0;
  317 + dst->im = 0.0;
  318 + dst++;
  319 + }
  320 + for (int i = 0; i < n_after; ++i)
  321 + *dst++ = *src++;
  322 +
  323 + // Free old data
  324 + if (m_data != NULL) delete [] m_data;
  325 +
  326 + // Set pointer to new data and store length
  327 + m_data = new_data;
  328 + m_length = length;
  329 +
  330 + } // endelse: there were already data
  331 +
  332 + } // endfor: there were rows to be inserted
  333 +
  334 + // Return
  335 + return;
  336 +}
  337 +
  338 +
  339 +/***********************************************************************//**
  340 + * @brief Remove rows from column
  341 + *
  342 + * @param[in] rownum Row after which rows should be removed (0=first row).
  343 + * @param[in] nrows Number of rows to be removed.
  344 + *
  345 + * @exception GException::fits_invalid_row
  346 + * Specified rownum is invalid.
  347 + * @exception GException::fits_invalid_nrows
  348 + * Invalid number of rows specified.
  349 + *
  350 + * This method removes rows from a FITS table. This implies that the column
  351 + * will be loaded into memory.
  352 + ***************************************************************************/
  353 +void GFitsTableCDoubleCol::remove(const int& rownum, const int& nrows)
  354 +{
  355 + // Make sure that rownum is valid
  356 + if (rownum < 0 || rownum >= m_length)
  357 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  358 +
  359 + // Make sure that we don't remove beyond the limit
  360 + if (nrows < 0 || nrows > m_length-rownum)
  361 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  362 +
  363 + // Continue only if there are rows to be removed
  364 + if (nrows > 0) {
  365 +
  366 + // If data are not available then load them now
  367 + if (m_data == NULL) fetch_data();
  368 +
  369 + // Compute new column length
  370 + int length = m_length - nrows;
  371 +
  372 + // Calculate size of new memory
  373 + m_size = m_number * length;
  374 +
  375 + // If we have rows remaining then allocate new data to hold
  376 + // the column
  377 + if (m_size > 0) {
  378 +
  379 + // Allocate new data to hold the column
  380 + GFits::cdouble* new_data = new GFits::cdouble[m_size];
  381 +
  382 + // Compute the number of elements before the removal point,
  383 + // the number of elements that get removed, and the total
  384 + // number of elements after the removal point
  385 + int n_before = m_number * rownum;
  386 + int n_remove = m_number * nrows;
  387 + int n_after = m_number * (length - rownum);
  388 +
  389 + // Copy data
  390 + GFits::cdouble* src = m_data;
  391 + GFits::cdouble* dst = new_data;
  392 + for (int i = 0; i < n_before; ++i)
  393 + *dst++ = *src++;
  394 + src += n_remove;
  395 + for (int i = 0; i < n_after; ++i)
  396 + *dst++ = *src++;
  397 +
  398 + // Free old data
  399 + if (m_data != NULL) delete [] m_data;
  400 +
  401 + // Set pointer to new data and store length
  402 + m_data = new_data;
  403 + m_length = length;
  404 +
  405 + } // endif: there are still elements after removal
  406 +
  407 + // ... otherwise just remove all data
  408 + else {
  409 +
  410 + // Free old data
  411 + if (m_data != NULL) delete [] m_data;
  412 +
  413 + // Set pointer to new data and store length
  414 + m_data = NULL;
  415 + m_length = length;
  416 + }
  417 +
  418 + } // endfor: there were rows to be removed
  419 +
  420 + // Return
  421 + return;
  422 +}
  423 +
  424 +
  425 +/***********************************************************************//**
251 426 * @brief Set nul value
252 427 *
253 428 * @param[in] value Nul value.
... ...
src/fits/GFitsTableCFloatCol.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -27,6 +35,8 @@
27 35 #include "GFitsTableCFloatCol.hpp"
28 36  
29 37 /* __ Method name definitions ____________________________________________ */
  38 +#define G_INSERT "GFitsTableCFloatCol::insert(int&, int&)"
  39 +#define G_REMOVE "GFitsTableCFloatCol::remove(int&, int&)"
30 40  
31 41 /* __ Macros _____________________________________________________________ */
32 42  
... ... @@ -248,6 +258,171 @@ int GFitsTableCFloatCol::integer(const int&amp; row, const int&amp; inx)
248 258  
249 259  
250 260 /***********************************************************************//**
  261 + * @brief Insert rows in column
  262 + *
  263 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  264 + * @param[in] nrows Number of rows to be inserted.
  265 + *
  266 + * @exception GException::fits_invalid_row
  267 + * Specified rownum is invalid.
  268 + *
  269 + * This method inserts rows into a FITS table. This implies that all columns
  270 + * will be loaded into memory.
  271 + ***************************************************************************/
  272 +void GFitsTableCFloatCol::insert(const int& rownum, const int& nrows)
  273 +{
  274 + // Make sure that rownum is valid
  275 + if (rownum < 0 || rownum > m_length)
  276 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  277 +
  278 + // Continue only if there are rows to be inserted
  279 + if (nrows > 0) {
  280 +
  281 + // If we have no rows yet then simply set the length to the
  282 + // number of rows to be inserted
  283 + if (m_length == 0) {
  284 + m_length = nrows;
  285 + }
  286 +
  287 + // ... otherwise fetch data, allocate new data and copy over
  288 + // the existing items
  289 + else {
  290 +
  291 + // If data are not available then load them now
  292 + if (m_data == NULL) fetch_data();
  293 +
  294 + // Compute new column length
  295 + int length = m_length + nrows;
  296 +
  297 + // Calculate size of new memory
  298 + m_size = m_number * length;
  299 +
  300 + // Allocate new data to hold the column
  301 + GFits::cfloat* new_data = new GFits::cfloat[m_size];
  302 +
  303 + // Compute the number of elements before the insertion point,
  304 + // the number of elements that get inserted, and the total
  305 + // number of elements after the insertion point
  306 + int n_before = m_number * rownum;
  307 + int n_insert = m_number * nrows;
  308 + int n_after = m_number * (m_length - rownum);
  309 +
  310 + // Copy and initialise data
  311 + GFits::cfloat* src = m_data;
  312 + GFits::cfloat* dst = new_data;
  313 + for (int i = 0; i < n_before; ++i)
  314 + *dst++ = *src++;
  315 + for (int i = 0; i < n_insert; ++i) {
  316 + dst->re = 0.0;
  317 + dst->im = 0.0;
  318 + dst++;
  319 + }
  320 + for (int i = 0; i < n_after; ++i)
  321 + *dst++ = *src++;
  322 +
  323 + // Free old data
  324 + if (m_data != NULL) delete [] m_data;
  325 +
  326 + // Set pointer to new data and store length
  327 + m_data = new_data;
  328 + m_length = length;
  329 +
  330 + } // endelse: there were already data
  331 +
  332 + } // endfor: there were rows to be inserted
  333 +
  334 + // Return
  335 + return;
  336 +}
  337 +
  338 +
  339 +/***********************************************************************//**
  340 + * @brief Remove rows from column
  341 + *
  342 + * @param[in] rownum Row after which rows should be removed (0=first row).
  343 + * @param[in] nrows Number of rows to be removed.
  344 + *
  345 + * @exception GException::fits_invalid_row
  346 + * Specified rownum is invalid.
  347 + * @exception GException::fits_invalid_nrows
  348 + * Invalid number of rows specified.
  349 + *
  350 + * This method removes rows from a FITS table. This implies that the column
  351 + * will be loaded into memory.
  352 + ***************************************************************************/
  353 +void GFitsTableCFloatCol::remove(const int& rownum, const int& nrows)
  354 +{
  355 + // Make sure that rownum is valid
  356 + if (rownum < 0 || rownum >= m_length)
  357 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  358 +
  359 + // Make sure that we don't remove beyond the limit
  360 + if (nrows < 0 || nrows > m_length-rownum)
  361 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  362 +
  363 + // Continue only if there are rows to be removed
  364 + if (nrows > 0) {
  365 +
  366 + // If data are not available then load them now
  367 + if (m_data == NULL) fetch_data();
  368 +
  369 + // Compute new column length
  370 + int length = m_length - nrows;
  371 +
  372 + // Calculate size of new memory
  373 + m_size = m_number * length;
  374 +
  375 + // If we have rows remaining then allocate new data to hold
  376 + // the column
  377 + if (m_size > 0) {
  378 +
  379 + // Allocate new data to hold the column
  380 + GFits::cfloat* new_data = new GFits::cfloat[m_size];
  381 +
  382 + // Compute the number of elements before the removal point,
  383 + // the number of elements that get removed, and the total
  384 + // number of elements after the removal point
  385 + int n_before = m_number * rownum;
  386 + int n_remove = m_number * nrows;
  387 + int n_after = m_number * (length - rownum);
  388 +
  389 + // Copy data
  390 + GFits::cfloat* src = m_data;
  391 + GFits::cfloat* dst = new_data;
  392 + for (int i = 0; i < n_before; ++i)
  393 + *dst++ = *src++;
  394 + src += n_remove;
  395 + for (int i = 0; i < n_after; ++i)
  396 + *dst++ = *src++;
  397 +
  398 + // Free old data
  399 + if (m_data != NULL) delete [] m_data;
  400 +
  401 + // Set pointer to new data and store length
  402 + m_data = new_data;
  403 + m_length = length;
  404 +
  405 + } // endif: there are still elements after removal
  406 +
  407 + // ... otherwise just remove all data
  408 + else {
  409 +
  410 + // Free old data
  411 + if (m_data != NULL) delete [] m_data;
  412 +
  413 + // Set pointer to new data and store length
  414 + m_data = NULL;
  415 + m_length = length;
  416 + }
  417 +
  418 + } // endfor: there were rows to be removed
  419 +
  420 + // Return
  421 + return;
  422 +}
  423 +
  424 +
  425 +/***********************************************************************//**
251 426 * @brief Set nul value
252 427 *
253 428 * @param[in] value Nul value.
... ...
src/fits/GFitsTableDoubleCol.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -27,6 +35,8 @@
27 35 #include "GFitsTableDoubleCol.hpp"
28 36  
29 37 /* __ Method name definitions ____________________________________________ */
  38 +#define G_INSERT "GFitsTableDoubleCol::insert(int&, int&)"
  39 +#define G_REMOVE "GFitsTableDoubleCol::remove(int&, int&)"
30 40  
31 41 /* __ Macros _____________________________________________________________ */
32 42  
... ... @@ -248,6 +258,168 @@ int GFitsTableDoubleCol::integer(const int&amp; row, const int&amp; inx)
248 258  
249 259  
250 260 /***********************************************************************//**
  261 + * @brief Insert rows in column
  262 + *
  263 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  264 + * @param[in] nrows Number of rows to be inserted.
  265 + *
  266 + * @exception GException::fits_invalid_row
  267 + * Specified rownum is invalid.
  268 + *
  269 + * This method inserts rows into a FITS table. This implies that the column
  270 + * will be loaded into memory.
  271 + ***************************************************************************/
  272 +void GFitsTableDoubleCol::insert(const int& rownum, const int& nrows)
  273 +{
  274 + // Make sure that rownum is valid
  275 + if (rownum < 0 || rownum > m_length)
  276 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  277 +
  278 + // Continue only if there are rows to be inserted
  279 + if (nrows > 0) {
  280 +
  281 + // If we have no rows yet then simply set the length to the
  282 + // number of rows to be inserted
  283 + if (m_length == 0) {
  284 + m_length = nrows;
  285 + }
  286 +
  287 + // ... otherwise fetch data, allocate new data and copy over
  288 + // the existing items
  289 + else {
  290 +
  291 + // If data are not available then load them now
  292 + if (m_data == NULL) fetch_data();
  293 +
  294 + // Compute new column length
  295 + int length = m_length + nrows;
  296 +
  297 + // Calculate size of new memory
  298 + m_size = m_number * length;
  299 +
  300 + // Allocate new data to hold the column
  301 + double* new_data = new double[m_size];
  302 +
  303 + // Compute the number of elements before the insertion point,
  304 + // the number of elements that get inserted, and the total
  305 + // number of elements after the insertion point
  306 + int n_before = m_number * rownum;
  307 + int n_insert = m_number * nrows;
  308 + int n_after = m_number * (m_length - rownum);
  309 +
  310 + // Copy and initialise data
  311 + double* src = m_data;
  312 + double* dst = new_data;
  313 + for (int i = 0; i < n_before; ++i)
  314 + *dst++ = *src++;
  315 + for (int i = 0; i < n_insert; ++i)
  316 + *dst++ = 0.0;
  317 + for (int i = 0; i < n_after; ++i)
  318 + *dst++ = *src++;
  319 +
  320 + // Free old data
  321 + if (m_data != NULL) delete [] m_data;
  322 +
  323 + // Set pointer to new data and store length
  324 + m_data = new_data;
  325 + m_length = length;
  326 +
  327 + } // endelse: there were already data
  328 +
  329 + } // endfor: there were rows to be inserted
  330 +
  331 + // Return
  332 + return;
  333 +}
  334 +
  335 +
  336 +/***********************************************************************//**
  337 + * @brief Remove rows from column
  338 + *
  339 + * @param[in] rownum Row after which rows should be removed (0=first row).
  340 + * @param[in] nrows Number of rows to be removed.
  341 + *
  342 + * @exception GException::fits_invalid_row
  343 + * Specified rownum is invalid.
  344 + * @exception GException::fits_invalid_nrows
  345 + * Invalid number of rows specified.
  346 + *
  347 + * This method removes rows from a FITS table. This implies that the column
  348 + * will be loaded into memory.
  349 + ***************************************************************************/
  350 +void GFitsTableDoubleCol::remove(const int& rownum, const int& nrows)
  351 +{
  352 + // Make sure that rownum is valid
  353 + if (rownum < 0 || rownum >= m_length)
  354 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  355 +
  356 + // Make sure that we don't remove beyond the limit
  357 + if (nrows < 0 || nrows > m_length-rownum)
  358 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  359 +
  360 + // Continue only if there are rows to be removed
  361 + if (nrows > 0) {
  362 +
  363 + // If data are not available then load them now
  364 + if (m_data == NULL) fetch_data();
  365 +
  366 + // Compute new column length
  367 + int length = m_length - nrows;
  368 +
  369 + // Calculate size of new memory
  370 + m_size = m_number * length;
  371 +
  372 + // If we have rows remaining then allocate new data to hold
  373 + // the column
  374 + if (m_size > 0) {
  375 +
  376 + // Allocate new data to hold the column
  377 + double* new_data = new double[m_size];
  378 +
  379 + // Compute the number of elements before the removal point,
  380 + // the number of elements that get removed, and the total
  381 + // number of elements after the removal point
  382 + int n_before = m_number * rownum;
  383 + int n_remove = m_number * nrows;
  384 + int n_after = m_number * (length - rownum);
  385 +
  386 + // Copy data
  387 + double* src = m_data;
  388 + double* dst = new_data;
  389 + for (int i = 0; i < n_before; ++i)
  390 + *dst++ = *src++;
  391 + src += n_remove;
  392 + for (int i = 0; i < n_after; ++i)
  393 + *dst++ = *src++;
  394 +
  395 + // Free old data
  396 + if (m_data != NULL) delete [] m_data;
  397 +
  398 + // Set pointer to new data and store length
  399 + m_data = new_data;
  400 + m_length = length;
  401 +
  402 + } // endif: there are still elements after removal
  403 +
  404 + // ... otherwise just remove all data
  405 + else {
  406 +
  407 + // Free old data
  408 + if (m_data != NULL) delete [] m_data;
  409 +
  410 + // Set pointer to new data and store length
  411 + m_data = NULL;
  412 + m_length = length;
  413 + }
  414 +
  415 + } // endfor: there were rows to be removed
  416 +
  417 + // Return
  418 + return;
  419 +}
  420 +
  421 +
  422 +/***********************************************************************//**
251 423 * @brief Set nul value
252 424 *
253 425 * @param[in] value Nul value.
... ...
src/fits/GFitsTableFloatCol.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -27,6 +35,8 @@
27 35 #include "GFitsTableFloatCol.hpp"
28 36  
29 37 /* __ Method name definitions ____________________________________________ */
  38 +#define G_INSERT "GFitsTableFloatCol::insert(int&, int&)"
  39 +#define G_REMOVE "GFitsTableFloatCol::remove(int&, int&)"
30 40  
31 41 /* __ Macros _____________________________________________________________ */
32 42  
... ... @@ -248,6 +258,168 @@ int GFitsTableFloatCol::integer(const int&amp; row, const int&amp; inx)
248 258  
249 259  
250 260 /***********************************************************************//**
  261 + * @brief Insert rows in column
  262 + *
  263 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  264 + * @param[in] nrows Number of rows to be inserted.
  265 + *
  266 + * @exception GException::fits_invalid_row
  267 + * Specified rownum is invalid.
  268 + *
  269 + * This method inserts rows into a FITS table. This implies that all columns
  270 + * will be loaded into memory.
  271 + ***************************************************************************/
  272 +void GFitsTableFloatCol::insert(const int& rownum, const int& nrows)
  273 +{
  274 + // Make sure that rownum is valid
  275 + if (rownum < 0 || rownum > m_length)
  276 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  277 +
  278 + // Continue only if there are rows to be inserted
  279 + if (nrows > 0) {
  280 +
  281 + // If we have no rows yet then simply set the length to the
  282 + // number of rows to be inserted
  283 + if (m_length == 0) {
  284 + m_length = nrows;
  285 + }
  286 +
  287 + // ... otherwise fetch data, allocate new data and copy over
  288 + // the existing items
  289 + else {
  290 +
  291 + // If data are not available then load them now
  292 + if (m_data == NULL) fetch_data();
  293 +
  294 + // Compute new column length
  295 + int length = m_length + nrows;
  296 +
  297 + // Calculate size of new memory
  298 + m_size = m_number * length;
  299 +
  300 + // Allocate new data to hold the column
  301 + float* new_data = new float[m_size];
  302 +
  303 + // Compute the number of elements before the insertion point,
  304 + // the number of elements that get inserted, and the total
  305 + // number of elements after the insertion point
  306 + int n_before = m_number * rownum;
  307 + int n_insert = m_number * nrows;
  308 + int n_after = m_number * (m_length - rownum);
  309 +
  310 + // Copy and initialise data
  311 + float* src = m_data;
  312 + float* dst = new_data;
  313 + for (int i = 0; i < n_before; ++i)
  314 + *dst++ = *src++;
  315 + for (int i = 0; i < n_insert; ++i)
  316 + *dst++ = 0.0;
  317 + for (int i = 0; i < n_after; ++i)
  318 + *dst++ = *src++;
  319 +
  320 + // Free old data
  321 + if (m_data != NULL) delete [] m_data;
  322 +
  323 + // Set pointer to new data and store length
  324 + m_data = new_data;
  325 + m_length = length;
  326 +
  327 + } // endelse: there were already data
  328 +
  329 + } // endfor: there were rows to be inserted
  330 +
  331 + // Return
  332 + return;
  333 +}
  334 +
  335 +
  336 +/***********************************************************************//**
  337 + * @brief Remove rows from column
  338 + *
  339 + * @param[in] rownum Row after which rows should be removed (0=first row).
  340 + * @param[in] nrows Number of rows to be removed.
  341 + *
  342 + * @exception GException::fits_invalid_row
  343 + * Specified rownum is invalid.
  344 + * @exception GException::fits_invalid_nrows
  345 + * Invalid number of rows specified.
  346 + *
  347 + * This method removes rows from a FITS table. This implies that the column
  348 + * will be loaded into memory.
  349 + ***************************************************************************/
  350 +void GFitsTableFloatCol::remove(const int& rownum, const int& nrows)
  351 +{
  352 + // Make sure that rownum is valid
  353 + if (rownum < 0 || rownum >= m_length)
  354 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  355 +
  356 + // Make sure that we don't remove beyond the limit
  357 + if (nrows < 0 || nrows > m_length-rownum)
  358 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  359 +
  360 + // Continue only if there are rows to be removed
  361 + if (nrows > 0) {
  362 +
  363 + // If data are not available then load them now
  364 + if (m_data == NULL) fetch_data();
  365 +
  366 + // Compute new column length
  367 + int length = m_length - nrows;
  368 +
  369 + // Calculate size of new memory
  370 + m_size = m_number * length;
  371 +
  372 + // If we have rows remaining then allocate new data to hold
  373 + // the column
  374 + if (m_size > 0) {
  375 +
  376 + // Allocate new data to hold the column
  377 + float* new_data = new float[m_size];
  378 +
  379 + // Compute the number of elements before the removal point,
  380 + // the number of elements that get removed, and the total
  381 + // number of elements after the removal point
  382 + int n_before = m_number * rownum;
  383 + int n_remove = m_number * nrows;
  384 + int n_after = m_number * (length - rownum);
  385 +
  386 + // Copy data
  387 + float* src = m_data;
  388 + float* dst = new_data;
  389 + for (int i = 0; i < n_before; ++i)
  390 + *dst++ = *src++;
  391 + src += n_remove;
  392 + for (int i = 0; i < n_after; ++i)
  393 + *dst++ = *src++;
  394 +
  395 + // Free old data
  396 + if (m_data != NULL) delete [] m_data;
  397 +
  398 + // Set pointer to new data and store length
  399 + m_data = new_data;
  400 + m_length = length;
  401 +
  402 + } // endif: there are still elements after removal
  403 +
  404 + // ... otherwise just remove all data
  405 + else {
  406 +
  407 + // Free old data
  408 + if (m_data != NULL) delete [] m_data;
  409 +
  410 + // Set pointer to new data and store length
  411 + m_data = NULL;
  412 + m_length = length;
  413 + }
  414 +
  415 + } // endfor: there were rows to be removed
  416 +
  417 + // Return
  418 + return;
  419 +}
  420 +
  421 +
  422 +/***********************************************************************//**
251 423 * @brief Set nul value
252 424 *
253 425 * @param[in] value Nul value.
... ...
src/fits/GFitsTableLongCol.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -27,6 +35,8 @@
27 35 #include "GFitsTableLongCol.hpp"
28 36  
29 37 /* __ Method name definitions ____________________________________________ */
  38 +#define G_INSERT "GFitsTableLongCol::insert(int&, int&)"
  39 +#define G_REMOVE "GFitsTableLongCol::remove(int&, int&)"
30 40  
31 41 /* __ Macros _____________________________________________________________ */
32 42  
... ... @@ -248,6 +258,168 @@ int GFitsTableLongCol::integer(const int&amp; row, const int&amp; inx)
248 258  
249 259  
250 260 /***********************************************************************//**
  261 + * @brief Insert rows in column
  262 + *
  263 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  264 + * @param[in] nrows Number of rows to be inserted.
  265 + *
  266 + * @exception GException::fits_invalid_row
  267 + * Specified rownum is invalid.
  268 + *
  269 + * This method inserts rows into a FITS table. This implies that all columns
  270 + * will be loaded into memory.
  271 + ***************************************************************************/
  272 +void GFitsTableLongCol::insert(const int& rownum, const int& nrows)
  273 +{
  274 + // Make sure that rownum is valid
  275 + if (rownum < 0 || rownum > m_length)
  276 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  277 +
  278 + // Continue only if there are rows to be inserted
  279 + if (nrows > 0) {
  280 +
  281 + // If we have no rows yet then simply set the length to the
  282 + // number of rows to be inserted
  283 + if (m_length == 0) {
  284 + m_length = nrows;
  285 + }
  286 +
  287 + // ... otherwise fetch data, allocate new data and copy over
  288 + // the existing items
  289 + else {
  290 +
  291 + // If data are not available then load them now
  292 + if (m_data == NULL) fetch_data();
  293 +
  294 + // Compute new column length
  295 + int length = m_length + nrows;
  296 +
  297 + // Calculate size of new memory
  298 + m_size = m_number * length;
  299 +
  300 + // Allocate new data to hold the column
  301 + long* new_data = new long[m_size];
  302 +
  303 + // Compute the number of elements before the insertion point,
  304 + // the number of elements that get inserted, and the total
  305 + // number of elements after the insertion point
  306 + int n_before = m_number * rownum;
  307 + int n_insert = m_number * nrows;
  308 + int n_after = m_number * (m_length - rownum);
  309 +
  310 + // Copy and initialise data
  311 + long* src = m_data;
  312 + long* dst = new_data;
  313 + for (int i = 0; i < n_before; ++i)
  314 + *dst++ = *src++;
  315 + for (int i = 0; i < n_insert; ++i)
  316 + *dst++ = 0.0;
  317 + for (int i = 0; i < n_after; ++i)
  318 + *dst++ = *src++;
  319 +
  320 + // Free old data
  321 + if (m_data != NULL) delete [] m_data;
  322 +
  323 + // Set pointer to new data and store length
  324 + m_data = new_data;
  325 + m_length = length;
  326 +
  327 + } // endelse: there were already data
  328 +
  329 + } // endfor: there were rows to be inserted
  330 +
  331 + // Return
  332 + return;
  333 +}
  334 +
  335 +
  336 +/***********************************************************************//**
  337 + * @brief Remove rows from column
  338 + *
  339 + * @param[in] rownum Row after which rows should be removed (0=first row).
  340 + * @param[in] nrows Number of rows to be removed.
  341 + *
  342 + * @exception GException::fits_invalid_row
  343 + * Specified rownum is invalid.
  344 + * @exception GException::fits_invalid_nrows
  345 + * Invalid number of rows specified.
  346 + *
  347 + * This method removes rows from a FITS table. This implies that the column
  348 + * will be loaded into memory.
  349 + ***************************************************************************/
  350 +void GFitsTableLongCol::remove(const int& rownum, const int& nrows)
  351 +{
  352 + // Make sure that rownum is valid
  353 + if (rownum < 0 || rownum >= m_length)
  354 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  355 +
  356 + // Make sure that we don't remove beyond the limit
  357 + if (nrows < 0 || nrows > m_length-rownum)
  358 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  359 +
  360 + // Continue only if there are rows to be removed
  361 + if (nrows > 0) {
  362 +
  363 + // If data are not available then load them now
  364 + if (m_data == NULL) fetch_data();
  365 +
  366 + // Compute new column length
  367 + int length = m_length - nrows;
  368 +
  369 + // Calculate size of new memory
  370 + m_size = m_number * length;
  371 +
  372 + // If we have rows remaining then allocate new data to hold
  373 + // the column
  374 + if (m_size > 0) {
  375 +
  376 + // Allocate new data to hold the column
  377 + long* new_data = new long[m_size];
  378 +
  379 + // Compute the number of elements before the removal point,
  380 + // the number of elements that get removed, and the total
  381 + // number of elements after the removal point
  382 + int n_before = m_number * rownum;
  383 + int n_remove = m_number * nrows;
  384 + int n_after = m_number * (length - rownum);
  385 +
  386 + // Copy data
  387 + long* src = m_data;
  388 + long* dst = new_data;
  389 + for (int i = 0; i < n_before; ++i)
  390 + *dst++ = *src++;
  391 + src += n_remove;
  392 + for (int i = 0; i < n_after; ++i)
  393 + *dst++ = *src++;
  394 +
  395 + // Free old data
  396 + if (m_data != NULL) delete [] m_data;
  397 +
  398 + // Set pointer to new data and store length
  399 + m_data = new_data;
  400 + m_length = length;
  401 +
  402 + } // endif: there are still elements after removal
  403 +
  404 + // ... otherwise just remove all data
  405 + else {
  406 +
  407 + // Free old data
  408 + if (m_data != NULL) delete [] m_data;
  409 +
  410 + // Set pointer to new data and store length
  411 + m_data = NULL;
  412 + m_length = length;
  413 + }
  414 +
  415 + } // endfor: there were rows to be removed
  416 +
  417 + // Return
  418 + return;
  419 +}
  420 +
  421 +
  422 +/***********************************************************************//**
251 423 * @brief Set nul value
252 424 *
253 425 * @param[in] value Nul value.
... ...
src/fits/GFitsTableLongLongCol.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -27,6 +35,8 @@
27 35 #include "GFitsTableLongLongCol.hpp"
28 36  
29 37 /* __ Method name definitions ____________________________________________ */
  38 +#define G_INSERT "GFitsTableLongLongCol::insert(int&, int&)"
  39 +#define G_REMOVE "GFitsTableLongLongCol::remove(int&, int&)"
30 40  
31 41 /* __ Macros _____________________________________________________________ */
32 42  
... ... @@ -248,6 +258,168 @@ int GFitsTableLongLongCol::integer(const int&amp; row, const int&amp; inx)
248 258  
249 259  
250 260 /***********************************************************************//**
  261 + * @brief Insert rows in column
  262 + *
  263 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  264 + * @param[in] nrows Number of rows to be inserted.
  265 + *
  266 + * @exception GException::fits_invalid_row
  267 + * Specified rownum is invalid.
  268 + *
  269 + * This method inserts rows into a FITS table. This implies that all columns
  270 + * will be loaded into memory.
  271 + ***************************************************************************/
  272 +void GFitsTableLongLongCol::insert(const int& rownum, const int& nrows)
  273 +{
  274 + // Make sure that rownum is valid
  275 + if (rownum < 0 || rownum > m_length)
  276 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  277 +
  278 + // Continue only if there are rows to be inserted
  279 + if (nrows > 0) {
  280 +
  281 + // If we have no rows yet then simply set the length to the
  282 + // number of rows to be inserted
  283 + if (m_length == 0) {
  284 + m_length = nrows;
  285 + }
  286 +
  287 + // ... otherwise fetch data, allocate new data and copy over
  288 + // the existing items
  289 + else {
  290 +
  291 + // If data are not available then load them now
  292 + if (m_data == NULL) fetch_data();
  293 +
  294 + // Compute new column length
  295 + int length = m_length + nrows;
  296 +
  297 + // Calculate size of new memory
  298 + m_size = m_number * length;
  299 +
  300 + // Allocate new data to hold the column
  301 + long long* new_data = new long long[m_size];
  302 +
  303 + // Compute the number of elements before the insertion point,
  304 + // the number of elements that get inserted, and the total
  305 + // number of elements after the insertion point
  306 + int n_before = m_number * rownum;
  307 + int n_insert = m_number * nrows;
  308 + int n_after = m_number * (m_length - rownum);
  309 +
  310 + // Copy and initialise data
  311 + long long* src = m_data;
  312 + long long* dst = new_data;
  313 + for (int i = 0; i < n_before; ++i)
  314 + *dst++ = *src++;
  315 + for (int i = 0; i < n_insert; ++i)
  316 + *dst++ = 0.0;
  317 + for (int i = 0; i < n_after; ++i)
  318 + *dst++ = *src++;
  319 +
  320 + // Free old data
  321 + if (m_data != NULL) delete [] m_data;
  322 +
  323 + // Set pointer to new data and store length
  324 + m_data = new_data;
  325 + m_length = length;
  326 +
  327 + } // endelse: there were already data
  328 +
  329 + } // endfor: there were rows to be inserted
  330 +
  331 + // Return
  332 + return;
  333 +}
  334 +
  335 +
  336 +/***********************************************************************//**
  337 + * @brief Remove rows from column
  338 + *
  339 + * @param[in] rownum Row after which rows should be removed (0=first row).
  340 + * @param[in] nrows Number of rows to be removed.
  341 + *
  342 + * @exception GException::fits_invalid_row
  343 + * Specified rownum is invalid.
  344 + * @exception GException::fits_invalid_nrows
  345 + * Invalid number of rows specified.
  346 + *
  347 + * This method removes rows from a FITS table. This implies that the column
  348 + * will be loaded into memory.
  349 + ***************************************************************************/
  350 +void GFitsTableLongLongCol::remove(const int& rownum, const int& nrows)
  351 +{
  352 + // Make sure that rownum is valid
  353 + if (rownum < 0 || rownum >= m_length)
  354 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  355 +
  356 + // Make sure that we don't remove beyond the limit
  357 + if (nrows < 0 || nrows > m_length-rownum)
  358 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  359 +
  360 + // Continue only if there are rows to be removed
  361 + if (nrows > 0) {
  362 +
  363 + // If data are not available then load them now
  364 + if (m_data == NULL) fetch_data();
  365 +
  366 + // Compute new column length
  367 + int length = m_length - nrows;
  368 +
  369 + // Calculate size of new memory
  370 + m_size = m_number * length;
  371 +
  372 + // If we have rows remaining then allocate new data to hold
  373 + // the column
  374 + if (m_size > 0) {
  375 +
  376 + // Allocate new data to hold the column
  377 + long long* new_data = new long long[m_size];
  378 +
  379 + // Compute the number of elements before the removal point,
  380 + // the number of elements that get removed, and the total
  381 + // number of elements after the removal point
  382 + int n_before = m_number * rownum;
  383 + int n_remove = m_number * nrows;
  384 + int n_after = m_number * (length - rownum);
  385 +
  386 + // Copy data
  387 + long long* src = m_data;
  388 + long long* dst = new_data;
  389 + for (int i = 0; i < n_before; ++i)
  390 + *dst++ = *src++;
  391 + src += n_remove;
  392 + for (int i = 0; i < n_after; ++i)
  393 + *dst++ = *src++;
  394 +
  395 + // Free old data
  396 + if (m_data != NULL) delete [] m_data;
  397 +
  398 + // Set pointer to new data and store length
  399 + m_data = new_data;
  400 + m_length = length;
  401 +
  402 + } // endif: there are still elements after removal
  403 +
  404 + // ... otherwise just remove all data
  405 + else {
  406 +
  407 + // Free old data
  408 + if (m_data != NULL) delete [] m_data;
  409 +
  410 + // Set pointer to new data and store length
  411 + m_data = NULL;
  412 + m_length = length;
  413 + }
  414 +
  415 + } // endfor: there were rows to be removed
  416 +
  417 + // Return
  418 + return;
  419 +}
  420 +
  421 +
  422 +/***********************************************************************//**
251 423 * @brief Set nul value
252 424 *
253 425 * @param[in] value Nul value.
... ...
src/fits/GFitsTableShortCol.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -27,6 +35,8 @@
27 35 #include "GFitsTableShortCol.hpp"
28 36  
29 37 /* __ Method name definitions ____________________________________________ */
  38 +#define G_INSERT "GFitsTableShortCol::insert(int&, int&)"
  39 +#define G_REMOVE "GFitsTableShortCol::remove(int&, int&)"
30 40  
31 41 /* __ Macros _____________________________________________________________ */
32 42  
... ... @@ -248,6 +258,168 @@ int GFitsTableShortCol::integer(const int&amp; row, const int&amp; inx)
248 258  
249 259  
250 260 /***********************************************************************//**
  261 + * @brief Insert rows in column
  262 + *
  263 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  264 + * @param[in] nrows Number of rows to be inserted.
  265 + *
  266 + * @exception GException::fits_invalid_row
  267 + * Specified rownum is invalid.
  268 + *
  269 + * This method inserts rows into a FITS table. This implies that all columns
  270 + * will be loaded into memory.
  271 + ***************************************************************************/
  272 +void GFitsTableShortCol::insert(const int& rownum, const int& nrows)
  273 +{
  274 + // Make sure that rownum is valid
  275 + if (rownum < 0 || rownum > m_length)
  276 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  277 +
  278 + // Continue only if there are rows to be inserted
  279 + if (nrows > 0) {
  280 +
  281 + // If we have no rows yet then simply set the length to the
  282 + // number of rows to be inserted
  283 + if (m_length == 0) {
  284 + m_length = nrows;
  285 + }
  286 +
  287 + // ... otherwise fetch data, allocate new data and copy over
  288 + // the existing items
  289 + else {
  290 +
  291 + // If data are not available then load them now
  292 + if (m_data == NULL) fetch_data();
  293 +
  294 + // Compute new column length
  295 + int length = m_length + nrows;
  296 +
  297 + // Calculate size of new memory
  298 + m_size = m_number * length;
  299 +
  300 + // Allocate new data to hold the column
  301 + short* new_data = new short[m_size];
  302 +
  303 + // Compute the number of elements before the insertion point,
  304 + // the number of elements that get inserted, and the total
  305 + // number of elements after the insertion point
  306 + int n_before = m_number * rownum;
  307 + int n_insert = m_number * nrows;
  308 + int n_after = m_number * (m_length - rownum);
  309 +
  310 + // Copy and initialise data
  311 + short* src = m_data;
  312 + short* dst = new_data;
  313 + for (int i = 0; i < n_before; ++i)
  314 + *dst++ = *src++;
  315 + for (int i = 0; i < n_insert; ++i)
  316 + *dst++ = 0.0;
  317 + for (int i = 0; i < n_after; ++i)
  318 + *dst++ = *src++;
  319 +
  320 + // Free old data
  321 + if (m_data != NULL) delete [] m_data;
  322 +
  323 + // Set pointer to new data and store length
  324 + m_data = new_data;
  325 + m_length = length;
  326 +
  327 + } // endelse: there were already data
  328 +
  329 + } // endfor: there were rows to be inserted
  330 +
  331 + // Return
  332 + return;
  333 +}
  334 +
  335 +
  336 +/***********************************************************************//**
  337 + * @brief Remove rows from column
  338 + *
  339 + * @param[in] rownum Row after which rows should be removed (0=first row).
  340 + * @param[in] nrows Number of rows to be removed.
  341 + *
  342 + * @exception GException::fits_invalid_row
  343 + * Specified rownum is invalid.
  344 + * @exception GException::fits_invalid_nrows
  345 + * Invalid number of rows specified.
  346 + *
  347 + * This method removes rows from a FITS table. This implies that the column
  348 + * will be loaded into memory.
  349 + ***************************************************************************/
  350 +void GFitsTableShortCol::remove(const int& rownum, const int& nrows)
  351 +{
  352 + // Make sure that rownum is valid
  353 + if (rownum < 0 || rownum >= m_length)
  354 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  355 +
  356 + // Make sure that we don't remove beyond the limit
  357 + if (nrows < 0 || nrows > m_length-rownum)
  358 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  359 +
  360 + // Continue only if there are rows to be removed
  361 + if (nrows > 0) {
  362 +
  363 + // If data are not available then load them now
  364 + if (m_data == NULL) fetch_data();
  365 +
  366 + // Compute new column length
  367 + int length = m_length - nrows;
  368 +
  369 + // Calculate size of new memory
  370 + m_size = m_number * length;
  371 +
  372 + // If we have rows remaining then allocate new data to hold
  373 + // the column
  374 + if (m_size > 0) {
  375 +
  376 + // Allocate new data to hold the column
  377 + short* new_data = new short[m_size];
  378 +
  379 + // Compute the number of elements before the removal point,
  380 + // the number of elements that get removed, and the total
  381 + // number of elements after the removal point
  382 + int n_before = m_number * rownum;
  383 + int n_remove = m_number * nrows;
  384 + int n_after = m_number * (length - rownum);
  385 +
  386 + // Copy data
  387 + short* src = m_data;
  388 + short* dst = new_data;
  389 + for (int i = 0; i < n_before; ++i)
  390 + *dst++ = *src++;
  391 + src += n_remove;
  392 + for (int i = 0; i < n_after; ++i)
  393 + *dst++ = *src++;
  394 +
  395 + // Free old data
  396 + if (m_data != NULL) delete [] m_data;
  397 +
  398 + // Set pointer to new data and store length
  399 + m_data = new_data;
  400 + m_length = length;
  401 +
  402 + } // endif: there are still elements after removal
  403 +
  404 + // ... otherwise just remove all data
  405 + else {
  406 +
  407 + // Free old data
  408 + if (m_data != NULL) delete [] m_data;
  409 +
  410 + // Set pointer to new data and store length
  411 + m_data = NULL;
  412 + m_length = length;
  413 + }
  414 +
  415 + } // endfor: there were rows to be removed
  416 +
  417 + // Return
  418 + return;
  419 +}
  420 +
  421 +
  422 +/***********************************************************************//**
251 423 * @brief Set nul value
252 424 *
253 425 * @param[in] value Nul value.
... ...
src/fits/GFitsTableStringCol.cpp
1 1 /***************************************************************************
2 2 * GFitsTableStringCol.cpp - FITS table string column class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2011 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -28,6 +36,8 @@
28 36 #include "GFitsTableStringCol.hpp"
29 37  
30 38 /* __ Method name definitions ____________________________________________ */
  39 +#define G_INSERT "GFitsTableStringCol::insert(int&, int&)"
  40 +#define G_REMOVE "GFitsTableStringCol::remove(int&, int&)"
31 41  
32 42 /* __ Macros _____________________________________________________________ */
33 43  
... ... @@ -247,6 +257,170 @@ int GFitsTableStringCol::integer(const int&amp; row, const int&amp; inx)
247 257  
248 258  
249 259 /***********************************************************************//**
  260 + * @brief Insert rows in column
  261 + *
  262 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  263 + * @param[in] nrows Number of rows to be inserted.
  264 + *
  265 + * @exception GException::fits_invalid_row
  266 + * Specified rownum is invalid.
  267 + *
  268 + * This method inserts rows into a FITS table. This implies that all columns
  269 + * will be loaded into memory.
  270 + ***************************************************************************/
  271 +void GFitsTableStringCol::insert(const int& rownum, const int& nrows)
  272 +{
  273 + // Make sure that rownum is valid
  274 + if (rownum < 0 || rownum > m_length)
  275 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  276 +
  277 + // Continue only if there are rows to be inserted
  278 + if (nrows > 0) {
  279 +
  280 + // If we have no rows yet then simply set the length to the
  281 + // number of rows to be inserted
  282 + if (m_length == 0) {
  283 + m_length = nrows;
  284 + }
  285 +
  286 + // ... otherwise fetch data, allocate new data and copy over
  287 + // the existing items
  288 + else {
  289 +
  290 + // If data are not available then load them now
  291 + if (m_data == NULL) fetch_data();
  292 +
  293 + // Compute new column length
  294 + int length = m_length + nrows;
  295 +
  296 + // Calculate size of new memory
  297 + m_size = m_number * length;
  298 +
  299 + // Allocate new data to hold the column
  300 + std::string* new_data = new std::string[m_size];
  301 +
  302 + // Compute the number of elements before the insertion point,
  303 + // the number of elements that get inserted, and the total
  304 + // number of elements after the insertion point
  305 + int n_before = m_number * rownum;
  306 + int n_insert = m_number * nrows;
  307 + int n_after = m_number * (m_length - rownum);
  308 +
  309 + // Copy and initialise data
  310 + std::string* src = m_data;
  311 + std::string* dst = new_data;
  312 + for (int i = 0; i < n_before; ++i)
  313 + *dst++ = *src++;
  314 + for (int i = 0; i < n_insert; ++i) {
  315 + dst->clear();
  316 + dst++;
  317 + }
  318 + for (int i = 0; i < n_after; ++i)
  319 + *dst++ = *src++;
  320 +
  321 + // Free old data
  322 + if (m_data != NULL) delete [] m_data;
  323 +
  324 + // Set pointer to new data and store length
  325 + m_data = new_data;
  326 + m_length = length;
  327 +
  328 + } // endelse: there were already data
  329 +
  330 + } // endfor: there were rows to be inserted
  331 +
  332 + // Return
  333 + return;
  334 +}
  335 +
  336 +
  337 +/***********************************************************************//**
  338 + * @brief Remove rows from column
  339 + *
  340 + * @param[in] rownum Row after which rows should be removed (0=first row).
  341 + * @param[in] nrows Number of rows to be removed.
  342 + *
  343 + * @exception GException::fits_invalid_row
  344 + * Specified rownum is invalid.
  345 + * @exception GException::fits_invalid_nrows
  346 + * Invalid number of rows specified.
  347 + *
  348 + * This method removes rows from a FITS table. This implies that the column
  349 + * will be loaded into memory.
  350 + ***************************************************************************/
  351 +void GFitsTableStringCol::remove(const int& rownum, const int& nrows)
  352 +{
  353 + // Make sure that rownum is valid
  354 + if (rownum < 0 || rownum >= m_length)
  355 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  356 +
  357 + // Make sure that we don't remove beyond the limit
  358 + if (nrows < 0 || nrows > m_length-rownum)
  359 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  360 +
  361 + // Continue only if there are rows to be removed
  362 + if (nrows > 0) {
  363 +
  364 + // If data are not available then load them now
  365 + if (m_data == NULL) fetch_data();
  366 +
  367 + // Compute new column length
  368 + int length = m_length - nrows;
  369 +
  370 + // Calculate size of new memory
  371 + m_size = m_number * length;
  372 +
  373 + // If we have rows remaining then allocate new data to hold
  374 + // the column
  375 + if (m_size > 0) {
  376 +
  377 + // Allocate new data to hold the column
  378 + std::string* new_data = new std::string[m_size];
  379 +
  380 + // Compute the number of elements before the removal point,
  381 + // the number of elements that get removed, and the total
  382 + // number of elements after the removal point
  383 + int n_before = m_number * rownum;
  384 + int n_remove = m_number * nrows;
  385 + int n_after = m_number * (length - rownum);
  386 +
  387 + // Copy data
  388 + std::string* src = m_data;
  389 + std::string* dst = new_data;
  390 + for (int i = 0; i < n_before; ++i)
  391 + *dst++ = *src++;
  392 + src += n_remove;
  393 + for (int i = 0; i < n_after; ++i)
  394 + *dst++ = *src++;
  395 +
  396 + // Free old data
  397 + if (m_data != NULL) delete [] m_data;
  398 +
  399 + // Set pointer to new data and store length
  400 + m_data = new_data;
  401 + m_length = length;
  402 +
  403 + } // endif: there are still elements after removal
  404 +
  405 + // ... otherwise just remove all data
  406 + else {
  407 +
  408 + // Free old data
  409 + if (m_data != NULL) delete [] m_data;
  410 +
  411 + // Set pointer to new data and store length
  412 + m_data = NULL;
  413 + m_length = length;
  414 + }
  415 +
  416 + } // endfor: there were rows to be removed
  417 +
  418 + // Return
  419 + return;
  420 +}
  421 +
  422 +
  423 +/***********************************************************************//**
250 424 * @brief Set nul value
251 425 *
252 426 * @param[in] value Nul value string.
... ...
src/fits/GFitsTableULongCol.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -27,6 +35,8 @@
27 35 #include "GFitsTableULongCol.hpp"
28 36  
29 37 /* __ Method name definitions ____________________________________________ */
  38 +#define G_INSERT "GFitsTableLongCol::insert(int&, int&)"
  39 +#define G_REMOVE "GFitsTableLongCol::remove(int&, int&)"
30 40  
31 41 /* __ Macros _____________________________________________________________ */
32 42  
... ... @@ -248,6 +258,168 @@ int GFitsTableULongCol::integer(const int&amp; row, const int&amp; inx)
248 258  
249 259  
250 260 /***********************************************************************//**
  261 + * @brief Insert rows in column
  262 + *
  263 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  264 + * @param[in] nrows Number of rows to be inserted.
  265 + *
  266 + * @exception GException::fits_invalid_row
  267 + * Specified rownum is invalid.
  268 + *
  269 + * This method inserts rows into a FITS table. This implies that all columns
  270 + * will be loaded into memory.
  271 + ***************************************************************************/
  272 +void GFitsTableULongCol::insert(const int& rownum, const int& nrows)
  273 +{
  274 + // Make sure that rownum is valid
  275 + if (rownum < 0 || rownum > m_length)
  276 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  277 +
  278 + // Continue only if there are rows to be inserted
  279 + if (nrows > 0) {
  280 +
  281 + // If we have no rows yet then simply set the length to the
  282 + // number of rows to be inserted
  283 + if (m_length == 0) {
  284 + m_length = nrows;
  285 + }
  286 +
  287 + // ... otherwise fetch data, allocate new data and copy over
  288 + // the existing items
  289 + else {
  290 +
  291 + // If data are not available then load them now
  292 + if (m_data == NULL) fetch_data();
  293 +
  294 + // Compute new column length
  295 + int length = m_length + nrows;
  296 +
  297 + // Calculate size of new memory
  298 + m_size = m_number * length;
  299 +
  300 + // Allocate new data to hold the column
  301 + unsigned long* new_data = new unsigned long[m_size];
  302 +
  303 + // Compute the number of elements before the insertion point,
  304 + // the number of elements that get inserted, and the total
  305 + // number of elements after the insertion point
  306 + int n_before = m_number * rownum;
  307 + int n_insert = m_number * nrows;
  308 + int n_after = m_number * (m_length - rownum);
  309 +
  310 + // Copy and initialise data
  311 + unsigned long* src = m_data;
  312 + unsigned long* dst = new_data;
  313 + for (int i = 0; i < n_before; ++i)
  314 + *dst++ = *src++;
  315 + for (int i = 0; i < n_insert; ++i)
  316 + *dst++ = 0.0;
  317 + for (int i = 0; i < n_after; ++i)
  318 + *dst++ = *src++;
  319 +
  320 + // Free old data
  321 + if (m_data != NULL) delete [] m_data;
  322 +
  323 + // Set pointer to new data and store length
  324 + m_data = new_data;
  325 + m_length = length;
  326 +
  327 + } // endelse: there were already data
  328 +
  329 + } // endfor: there were rows to be inserted
  330 +
  331 + // Return
  332 + return;
  333 +}
  334 +
  335 +
  336 +/***********************************************************************//**
  337 + * @brief Remove rows from column
  338 + *
  339 + * @param[in] rownum Row after which rows should be removed (0=first row).
  340 + * @param[in] nrows Number of rows to be removed.
  341 + *
  342 + * @exception GException::fits_invalid_row
  343 + * Specified rownum is invalid.
  344 + * @exception GException::fits_invalid_nrows
  345 + * Invalid number of rows specified.
  346 + *
  347 + * This method removes rows from a FITS table. This implies that the column
  348 + * will be loaded into memory.
  349 + ***************************************************************************/
  350 +void GFitsTableULongCol::remove(const int& rownum, const int& nrows)
  351 +{
  352 + // Make sure that rownum is valid
  353 + if (rownum < 0 || rownum >= m_length)
  354 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  355 +
  356 + // Make sure that we don't remove beyond the limit
  357 + if (nrows < 0 || nrows > m_length-rownum)
  358 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  359 +
  360 + // Continue only if there are rows to be removed
  361 + if (nrows > 0) {
  362 +
  363 + // If data are not available then load them now
  364 + if (m_data == NULL) fetch_data();
  365 +
  366 + // Compute new column length
  367 + int length = m_length - nrows;
  368 +
  369 + // Calculate size of new memory
  370 + m_size = m_number * length;
  371 +
  372 + // If we have rows remaining then allocate new data to hold
  373 + // the column
  374 + if (m_size > 0) {
  375 +
  376 + // Allocate new data to hold the column
  377 + unsigned long* new_data = new unsigned long[m_size];
  378 +
  379 + // Compute the number of elements before the removal point,
  380 + // the number of elements that get removed, and the total
  381 + // number of elements after the removal point
  382 + int n_before = m_number * rownum;
  383 + int n_remove = m_number * nrows;
  384 + int n_after = m_number * (length - rownum);
  385 +
  386 + // Copy data
  387 + unsigned long* src = m_data;
  388 + unsigned long* dst = new_data;
  389 + for (int i = 0; i < n_before; ++i)
  390 + *dst++ = *src++;
  391 + src += n_remove;
  392 + for (int i = 0; i < n_after; ++i)
  393 + *dst++ = *src++;
  394 +
  395 + // Free old data
  396 + if (m_data != NULL) delete [] m_data;
  397 +
  398 + // Set pointer to new data and store length
  399 + m_data = new_data;
  400 + m_length = length;
  401 +
  402 + } // endif: there are still elements after removal
  403 +
  404 + // ... otherwise just remove all data
  405 + else {
  406 +
  407 + // Free old data
  408 + if (m_data != NULL) delete [] m_data;
  409 +
  410 + // Set pointer to new data and store length
  411 + m_data = NULL;
  412 + m_length = length;
  413 + }
  414 +
  415 + } // endfor: there were rows to be removed
  416 +
  417 + // Return
  418 + return;
  419 +}
  420 +
  421 +
  422 +/***********************************************************************//**
251 423 * @brief Set nul value
252 424 *
253 425 * @param[in] value Nul value.
... ...
src/fits/GFitsTableUShortCol.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 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. *
  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/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -27,6 +35,8 @@
27 35 #include "GFitsTableUShortCol.hpp"
28 36  
29 37 /* __ Method name definitions ____________________________________________ */
  38 +#define G_INSERT "GFitsTableUShortCol::insert(int&, int&)"
  39 +#define G_REMOVE "GFitsTableUShortCol::remove(int&, int&)"
30 40  
31 41 /* __ Macros _____________________________________________________________ */
32 42  
... ... @@ -248,6 +258,168 @@ int GFitsTableUShortCol::integer(const int&amp; row, const int&amp; inx)
248 258  
249 259  
250 260 /***********************************************************************//**
  261 + * @brief Insert rows in column
  262 + *
  263 + * @param[in] rownum Row after which rows should be inserted (0=first row).
  264 + * @param[in] nrows Number of rows to be inserted.
  265 + *
  266 + * @exception GException::fits_invalid_row
  267 + * Specified rownum is invalid.
  268 + *
  269 + * This method inserts rows into a FITS table. This implies that all columns
  270 + * will be loaded into memory.
  271 + ***************************************************************************/
  272 +void GFitsTableUShortCol::insert(const int& rownum, const int& nrows)
  273 +{
  274 + // Make sure that rownum is valid
  275 + if (rownum < 0 || rownum > m_length)
  276 + throw GException::fits_invalid_row(G_INSERT, rownum, m_length);
  277 +
  278 + // Continue only if there are rows to be inserted
  279 + if (nrows > 0) {
  280 +
  281 + // If we have no rows yet then simply set the length to the
  282 + // number of rows to be inserted
  283 + if (m_length == 0) {
  284 + m_length = nrows;
  285 + }
  286 +
  287 + // ... otherwise fetch data, allocate new data and copy over
  288 + // the existing items
  289 + else {
  290 +
  291 + // If data are not available then load them now
  292 + if (m_data == NULL) fetch_data();
  293 +
  294 + // Compute new column length
  295 + int length = m_length + nrows;
  296 +
  297 + // Calculate size of new memory
  298 + m_size = m_number * length;
  299 +
  300 + // Allocate new data to hold the column
  301 + unsigned short* new_data = new unsigned short[m_size];
  302 +
  303 + // Compute the number of elements before the insertion point,
  304 + // the number of elements that get inserted, and the total
  305 + // number of elements after the insertion point
  306 + int n_before = m_number * rownum;
  307 + int n_insert = m_number * nrows;
  308 + int n_after = m_number * (m_length - rownum);
  309 +
  310 + // Copy and initialise data
  311 + unsigned short* src = m_data;
  312 + unsigned short* dst = new_data;
  313 + for (int i = 0; i < n_before; ++i)
  314 + *dst++ = *src++;
  315 + for (int i = 0; i < n_insert; ++i)
  316 + *dst++ = 0.0;
  317 + for (int i = 0; i < n_after; ++i)
  318 + *dst++ = *src++;
  319 +
  320 + // Free old data
  321 + if (m_data != NULL) delete [] m_data;
  322 +
  323 + // Set pointer to new data and store length
  324 + m_data = new_data;
  325 + m_length = length;
  326 +
  327 + } // endelse: there were already data
  328 +
  329 + } // endfor: there were rows to be inserted
  330 +
  331 + // Return
  332 + return;
  333 +}
  334 +
  335 +
  336 +/***********************************************************************//**
  337 + * @brief Remove rows from column
  338 + *
  339 + * @param[in] rownum Row after which rows should be removed (0=first row).
  340 + * @param[in] nrows Number of rows to be removed.
  341 + *
  342 + * @exception GException::fits_invalid_row
  343 + * Specified rownum is invalid.
  344 + * @exception GException::fits_invalid_nrows
  345 + * Invalid number of rows specified.
  346 + *
  347 + * This method removes rows from a FITS table. This implies that the column
  348 + * will be loaded into memory.
  349 + ***************************************************************************/
  350 +void GFitsTableUShortCol::remove(const int& rownum, const int& nrows)
  351 +{
  352 + // Make sure that rownum is valid
  353 + if (rownum < 0 || rownum >= m_length)
  354 + throw GException::fits_invalid_row(G_REMOVE, rownum, m_length-1);
  355 +
  356 + // Make sure that we don't remove beyond the limit
  357 + if (nrows < 0 || nrows > m_length-rownum)
  358 + throw GException::fits_invalid_nrows(G_REMOVE, nrows, m_length-rownum);
  359 +
  360 + // Continue only if there are rows to be removed
  361 + if (nrows > 0) {
  362 +
  363 + // If data are not available then load them now
  364 + if (m_data == NULL) fetch_data();
  365 +
  366 + // Compute new column length
  367 + int length = m_length - nrows;
  368 +
  369 + // Calculate size of new memory
  370 + m_size = m_number * length;
  371 +
  372 + // If we have rows remaining then allocate new data to hold
  373 + // the column
  374 + if (m_size > 0) {
  375 +
  376 + // Allocate new data to hold the column
  377 + unsigned short* new_data = new unsigned short[m_size];
  378 +
  379 + // Compute the number of elements before the removal point,
  380 + // the number of elements that get removed, and the total
  381 + // number of elements after the removal point
  382 + int n_before = m_number * rownum;
  383 + int n_remove = m_number * nrows;
  384 + int n_after = m_number * (length - rownum);
  385 +
  386 + // Copy data
  387 + unsigned short* src = m_data;
  388 + unsigned short* dst = new_data;
  389 + for (int i = 0; i < n_before; ++i)
  390 + *dst++ = *src++;
  391 + src += n_remove;
  392 + for (int i = 0; i < n_after; ++i)
  393 + *dst++ = *src++;
  394 +
  395 + // Free old data
  396 + if (m_data != NULL) delete [] m_data;
  397 +
  398 + // Set pointer to new data and store length
  399 + m_data = new_data;
  400 + m_length = length;
  401 +
  402 + } // endif: there are still elements after removal
  403 +
  404 + // ... otherwise just remove all data
  405 + else {
  406 +
  407 + // Free old data
  408 + if (m_data != NULL) delete [] m_data;
  409 +
  410 + // Set pointer to new data and store length
  411 + m_data = NULL;
  412 + m_length = length;
  413 + }
  414 +
  415 + } // endfor: there were rows to be removed
  416 +
  417 + // Return
  418 + return;
  419 +}
  420 +
  421 +
  422 +/***********************************************************************//**
251 423 * @brief Set nul value
252 424 *
253 425 * @param[in] value Nul value.
... ...