Commit d935e46e088e70b6ee2c99740e1da72e22dff25e
1 parent
53d335e3
initial version
Showing
5 changed files
with
364 additions
and
0 deletions
include/GFitsTableCDoubleCol.hpp
0 โ 100644
| 1 | +/*************************************************************************** | |
| 2 | + * GFitsTableCDoubleCol.hpp - FITS table double precision complex column * | |
| 3 | + * ----------------------------------------------------------------------- * | |
| 4 | + * copyright (C) 2010 by Jurgen Knodlseder * | |
| 5 | + * ----------------------------------------------------------------------- * | |
| 6 | + * * | |
| 7 | + * This program is free software; you can redistribute it and/or modify * | |
| 8 | + * it under the terms of the GNU General Public License as published by * | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | |
| 10 | + * (at your option) any later version. * | |
| 11 | + * * | |
| 12 | + ***************************************************************************/ | |
| 13 | +/** | |
| 14 | + * @file GFitsTableCDoubleCol.hpp | |
| 15 | + * @brief GFitsTableCDoubleCol class definition. | |
| 16 | + * @author J. Knodlseder | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#ifndef GFITSTABLECDOUBLECOL_HPP | |
| 20 | +#define GFITSTABLECDOUBLECOL_HPP | |
| 21 | + | |
| 22 | +/* __ Includes ___________________________________________________________ */ | |
| 23 | +#include <string> | |
| 24 | +#include "GFits.hpp" | |
| 25 | +#include "GFitsTableCol.hpp" | |
| 26 | + | |
| 27 | + | |
| 28 | +/***********************************************************************//** | |
| 29 | + * @class GFitsTableCDoubleCol | |
| 30 | + * | |
| 31 | + * @brief Interface for FITS table float column | |
| 32 | + * | |
| 33 | + * This class implements a FITS table float column. | |
| 34 | + ***************************************************************************/ | |
| 35 | +class GFitsTableCDoubleCol : public GFitsTableCol { | |
| 36 | + | |
| 37 | +public: | |
| 38 | + // Constructors and destructors | |
| 39 | + GFitsTableCDoubleCol(void); | |
| 40 | + GFitsTableCDoubleCol(const std::string& name, const int& length, | |
| 41 | + const int& size = 1); | |
| 42 | + GFitsTableCDoubleCol(const GFitsTableCDoubleCol& column); | |
| 43 | + virtual ~GFitsTableCDoubleCol(void); | |
| 44 | + | |
| 45 | + // Operators | |
| 46 | + GFitsTableCDoubleCol& operator= (const GFitsTableCDoubleCol& column); | |
| 47 | + GFits::cdouble& operator() (const int& row, const int& inx = 0); | |
| 48 | + const GFits::cdouble& operator() (const int& row, const int& inx = 0) const; | |
| 49 | + | |
| 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); | |
| 54 | + GFits::cdouble* data(void) { return m_data; } | |
| 55 | + void nulval(const GFits::cdouble* value); | |
| 56 | + GFits::cdouble* nulval(void) { return m_nulval; } | |
| 57 | + | |
| 58 | +private: | |
| 59 | + // Private methods | |
| 60 | + void init_members(void); | |
| 61 | + void copy_members(const GFitsTableCDoubleCol& column); | |
| 62 | + void free_members(void); | |
| 63 | + GFitsTableCDoubleCol* clone(void) const; | |
| 64 | + std::string ascii_format(void) const; | |
| 65 | + std::string binary_format(void) const; | |
| 66 | + void alloc_data(void); | |
| 67 | + void release_data(void); | |
| 68 | + void alloc_nulval(const GFits::cdouble* value); | |
| 69 | + void init_data(void); | |
| 70 | + void* ptr_data(void) { return m_data; } | |
| 71 | + void* ptr_nulval(void) { return m_nulval; } | |
| 72 | + | |
| 73 | + // Private data area | |
| 74 | + GFits::cdouble* m_data; //!< Data vector | |
| 75 | + GFits::cdouble* m_nulval; //!< NULL value | |
| 76 | +}; | |
| 77 | + | |
| 78 | +#endif /* GFITSTABLECDOUBLECOL_HPP */ | ... | ... |
include/GFitsTableCFloatCol.hpp
0 โ 100644
| 1 | +/*************************************************************************** | |
| 2 | + * GFitsTableCFloatCol.hpp - FITS table single precision complex column * | |
| 3 | + * ----------------------------------------------------------------------- * | |
| 4 | + * copyright (C) 2010 by Jurgen Knodlseder * | |
| 5 | + * ----------------------------------------------------------------------- * | |
| 6 | + * * | |
| 7 | + * This program is free software; you can redistribute it and/or modify * | |
| 8 | + * it under the terms of the GNU General Public License as published by * | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | |
| 10 | + * (at your option) any later version. * | |
| 11 | + * * | |
| 12 | + ***************************************************************************/ | |
| 13 | +/** | |
| 14 | + * @file GFitsTableCFloatCol.hpp | |
| 15 | + * @brief GFitsTableCFloatCol class definition. | |
| 16 | + * @author J. Knodlseder | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#ifndef GFITSTABLECFLOATCOL_HPP | |
| 20 | +#define GFITSTABLECFLOATCOL_HPP | |
| 21 | + | |
| 22 | +/* __ Includes ___________________________________________________________ */ | |
| 23 | +#include <string> | |
| 24 | +#include "GFits.hpp" | |
| 25 | +#include "GFitsTableCol.hpp" | |
| 26 | + | |
| 27 | + | |
| 28 | +/***********************************************************************//** | |
| 29 | + * @class GFitsTableCFloatCol | |
| 30 | + * | |
| 31 | + * @brief Interface for FITS table float column | |
| 32 | + * | |
| 33 | + * This class implements a FITS table float column. | |
| 34 | + ***************************************************************************/ | |
| 35 | +class GFitsTableCFloatCol : public GFitsTableCol { | |
| 36 | + | |
| 37 | +public: | |
| 38 | + // Constructors and destructors | |
| 39 | + GFitsTableCFloatCol(void); | |
| 40 | + GFitsTableCFloatCol(const std::string& name, const int& length, | |
| 41 | + const int& size = 1); | |
| 42 | + GFitsTableCFloatCol(const GFitsTableCFloatCol& column); | |
| 43 | + virtual ~GFitsTableCFloatCol(void); | |
| 44 | + | |
| 45 | + // Operators | |
| 46 | + GFitsTableCFloatCol& operator= (const GFitsTableCFloatCol& column); | |
| 47 | + GFits::cfloat& operator() (const int& row, const int& inx = 0); | |
| 48 | + const GFits::cfloat& operator() (const int& row, const int& inx = 0) const; | |
| 49 | + | |
| 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); | |
| 54 | + GFits::cfloat* data(void) { return m_data; } | |
| 55 | + void nulval(const GFits::cfloat* value); | |
| 56 | + GFits::cfloat* nulval(void) { return m_nulval; } | |
| 57 | + | |
| 58 | +private: | |
| 59 | + // Private methods | |
| 60 | + void init_members(void); | |
| 61 | + void copy_members(const GFitsTableCFloatCol& column); | |
| 62 | + void free_members(void); | |
| 63 | + GFitsTableCFloatCol* clone(void) const; | |
| 64 | + std::string ascii_format(void) const; | |
| 65 | + std::string binary_format(void) const; | |
| 66 | + void alloc_data(void); | |
| 67 | + void release_data(void); | |
| 68 | + void alloc_nulval(const GFits::cfloat* value); | |
| 69 | + void init_data(void); | |
| 70 | + void* ptr_data(void) { return m_data; } | |
| 71 | + void* ptr_nulval(void) { return m_nulval; } | |
| 72 | + | |
| 73 | + // Private data area | |
| 74 | + GFits::cfloat* m_data; //!< Data vector | |
| 75 | + GFits::cfloat* m_nulval; //!< NULL value | |
| 76 | +}; | |
| 77 | + | |
| 78 | +#endif /* GFITSTABLECFLOATCOL_HPP */ | ... | ... |
pyext/GFitsTableByteCol.i
0 โ 100644
| 1 | +/*************************************************************************** | |
| 2 | + * GFitsTableByteCol.i - FITS table Byte column class SWIG definition * | |
| 3 | + * ----------------------------------------------------------------------- * | |
| 4 | + * copyright : (C) 2008-2010 by Jurgen Knodlseder * | |
| 5 | + * ----------------------------------------------------------------------- * | |
| 6 | + * * | |
| 7 | + * This program is free software; you can redistribute it and/or modify * | |
| 8 | + * it under the terms of the GNU General Public License as published by * | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | |
| 10 | + * (at your option) any later version. * | |
| 11 | + * * | |
| 12 | + ***************************************************************************/ | |
| 13 | +/** | |
| 14 | + * @file GFitsTableByteCol.i | |
| 15 | + * @brief GFitsTableByteCol class SWIG file. | |
| 16 | + * @author J. Knodlseder | |
| 17 | + */ | |
| 18 | +%{ | |
| 19 | +/* Put headers and other declarations here that are needed for compilation */ | |
| 20 | +#include "GFitsTableByteCol.hpp" | |
| 21 | +%} | |
| 22 | + | |
| 23 | + | |
| 24 | +/***********************************************************************//** | |
| 25 | + * @class GFitsTableByteCol | |
| 26 | + * | |
| 27 | + * @brief SWIG interface for FITS table short integer column | |
| 28 | + ***************************************************************************/ | |
| 29 | +class GFitsTableByteCol : public GFitsTableCol { | |
| 30 | +public: | |
| 31 | + // Constructors and destructors | |
| 32 | + GFitsTableByteCol(void); | |
| 33 | + GFitsTableByteCol(const std::string& name, const int& length, const int& size = 1); | |
| 34 | + GFitsTableByteCol(const GFitsTableByteCol& column); | |
| 35 | + virtual ~GFitsTableByteCol(void); | |
| 36 | + | |
| 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; } | |
| 42 | + void nulval(const unsigned char* value); | |
| 43 | + unsigned char* nulval(void) { return m_nulval; } | |
| 44 | +}; | |
| 45 | + | |
| 46 | + | |
| 47 | +/***********************************************************************//** | |
| 48 | + * @brief GFitsTableByteCol class extension | |
| 49 | + ***************************************************************************/ | |
| 50 | +%extend GFitsTableByteCol { | |
| 51 | + unsigned char __getitem__(int GFitsTableColInx[]) { | |
| 52 | + if (GFitsTableColInx[0] == 1) | |
| 53 | + return (*self)(GFitsTableColInx[1]); | |
| 54 | + else if (GFitsTableColInx[0] == 2) | |
| 55 | + return (*self)(GFitsTableColInx[1], GFitsTableColInx[2]); | |
| 56 | + else { | |
| 57 | + PyErr_SetString(PyExc_ValueError,"Too many arguments in tuple"); | |
| 58 | + return NULL; | |
| 59 | + } | |
| 60 | + } | |
| 61 | + void __setitem__(int GFitsTableColInx[], unsigned char value) { | |
| 62 | + if (GFitsTableColInx[0] == 1) | |
| 63 | + (*self)(GFitsTableColInx[1]) = value; | |
| 64 | + else if (GFitsTableColInx[0] == 2) | |
| 65 | + (*self)(GFitsTableColInx[1], GFitsTableColInx[2]) = value; | |
| 66 | + else { | |
| 67 | + PyErr_SetString(PyExc_ValueError,"Too many arguments in tuple"); | |
| 68 | + return; | |
| 69 | + } | |
| 70 | + } | |
| 71 | + GFitsTableByteCol copy() { | |
| 72 | + return (*self); | |
| 73 | + } | |
| 74 | +}; | ... | ... |
pyext/GFitsTableCDoubleCol.i
0 โ 100644
| 1 | +/*************************************************************************** | |
| 2 | + * GFitsTableCDoubleCol.i - FITS table double precision complex column * | |
| 3 | + * ----------------------------------------------------------------------- * | |
| 4 | + * copyright (C) 2010 by Jurgen Knodlseder * | |
| 5 | + * ----------------------------------------------------------------------- * | |
| 6 | + * * | |
| 7 | + * This program is free software; you can redistribute it and/or modify * | |
| 8 | + * it under the terms of the GNU General Public License as published by * | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | |
| 10 | + * (at your option) any later version. * | |
| 11 | + * * | |
| 12 | + ***************************************************************************/ | |
| 13 | +/** | |
| 14 | + * @file GFitsTableCDoubleCol.i | |
| 15 | + * @brief GFitsTableCDoubleCol class SWIG file. | |
| 16 | + * @author J. Knodlseder | |
| 17 | + */ | |
| 18 | +%{ | |
| 19 | +/* Put headers and other declarations here that are needed for compilation */ | |
| 20 | +#include "GFitsTableCDoubleCol.hpp" | |
| 21 | +%} | |
| 22 | + | |
| 23 | + | |
| 24 | +/***********************************************************************//** | |
| 25 | + * @class GFitsTableCDoubleCol | |
| 26 | + * | |
| 27 | + * @brief SWIG interface for FITS table floating point column | |
| 28 | + ***************************************************************************/ | |
| 29 | +class GFitsTableCDoubleCol : public GFitsTableCol { | |
| 30 | +public: | |
| 31 | + // Constructors and destructors | |
| 32 | + GFitsTableCDoubleCol(void); | |
| 33 | + GFitsTableCDoubleCol(const std::string& name, const int& length, | |
| 34 | + const int& size = 1); | |
| 35 | + GFitsTableCDoubleCol(const GFitsTableCDoubleCol& column); | |
| 36 | + virtual ~GFitsTableCDoubleCol(void); | |
| 37 | + | |
| 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; } | |
| 43 | + void nulval(const GFits::cdouble* value); | |
| 44 | + GFits::cdouble* nulval(void) { return m_nulval; } | |
| 45 | +}; | |
| 46 | + | |
| 47 | + | |
| 48 | +/***********************************************************************//** | |
| 49 | + * @brief GFitsTableCDoubleCol class extension | |
| 50 | + ***************************************************************************/ | |
| 51 | +%extend GFitsTableCDoubleCol { | |
| 52 | + GFits::cdouble get(const int& row) { | |
| 53 | + return (*self)(row); | |
| 54 | + } | |
| 55 | + GFits::cdouble get(const int& row, const int& col) { | |
| 56 | + return (*self)(row, col); | |
| 57 | + } | |
| 58 | + void set(const int& row, const GFits::cdouble& value) { | |
| 59 | + (*self)(row) = value; | |
| 60 | + } | |
| 61 | + void set(const int& row, const int& col, const GFits::cdouble& value) { | |
| 62 | + (*self)(row, col) = value; | |
| 63 | + } | |
| 64 | + GFitsTableCDoubleCol copy() { | |
| 65 | + return (*self); | |
| 66 | + } | |
| 67 | +}; | ... | ... |
pyext/GFitsTableCFloatCol.i
0 โ 100644
| 1 | +/*************************************************************************** | |
| 2 | + * GFitsTableCFloatCol.i - FITS table single precision complex column * | |
| 3 | + * ----------------------------------------------------------------------- * | |
| 4 | + * copyright (C) 2010 by Jurgen Knodlseder * | |
| 5 | + * ----------------------------------------------------------------------- * | |
| 6 | + * * | |
| 7 | + * This program is free software; you can redistribute it and/or modify * | |
| 8 | + * it under the terms of the GNU General Public License as published by * | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or * | |
| 10 | + * (at your option) any later version. * | |
| 11 | + * * | |
| 12 | + ***************************************************************************/ | |
| 13 | +/** | |
| 14 | + * @file GFitsTableCFloatCol.i | |
| 15 | + * @brief GFitsTableCFloatCol class SWIG file. | |
| 16 | + * @author J. Knodlseder | |
| 17 | + */ | |
| 18 | +%{ | |
| 19 | +/* Put headers and other declarations here that are needed for compilation */ | |
| 20 | +#include "GFitsTableCFloatCol.hpp" | |
| 21 | +%} | |
| 22 | + | |
| 23 | + | |
| 24 | +/***********************************************************************//** | |
| 25 | + * @class GFitsTableCFloatCol | |
| 26 | + * | |
| 27 | + * @brief SWIG interface for FITS table floating point column | |
| 28 | + ***************************************************************************/ | |
| 29 | +class GFitsTableCFloatCol : public GFitsTableCol { | |
| 30 | +public: | |
| 31 | + // Constructors and destructors | |
| 32 | + GFitsTableCFloatCol(void); | |
| 33 | + GFitsTableCFloatCol(const std::string& name, const int& length, | |
| 34 | + const int& size = 1); | |
| 35 | + GFitsTableCFloatCol(const GFitsTableCFloatCol& column); | |
| 36 | + virtual ~GFitsTableCFloatCol(void); | |
| 37 | + | |
| 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; } | |
| 43 | + void nulval(const GFits::cfloat* value); | |
| 44 | + GFits::cfloat* nulval(void) { return m_nulval; } | |
| 45 | +}; | |
| 46 | + | |
| 47 | + | |
| 48 | +/***********************************************************************//** | |
| 49 | + * @brief GFitsTableCFloatCol class extension | |
| 50 | + ***************************************************************************/ | |
| 51 | +%extend GFitsTableCFloatCol { | |
| 52 | + GFits::cfloat get(const int& row) { | |
| 53 | + return (*self)(row); | |
| 54 | + } | |
| 55 | + GFits::cfloat get(const int& row, const int& col) { | |
| 56 | + return (*self)(row, col); | |
| 57 | + } | |
| 58 | + void set(const int& row, const GFits::cfloat& value) { | |
| 59 | + (*self)(row) = value; | |
| 60 | + } | |
| 61 | + void set(const int& row, const int& col, const GFits::cfloat& value) { | |
| 62 | + (*self)(row, col) = value; | |
| 63 | + } | |
| 64 | + GFitsTableCFloatCol copy() { | |
| 65 | + return (*self); | |
| 66 | + } | |
| 67 | +}; | ... | ... |