From ab6cfddbb8c8f159daad7c998b083ffbe4476801 Mon Sep 17 00:00:00 2001 From: knodlseder <> Date: Thu, 13 Mar 2008 06:18:09 +0000 Subject: [PATCH] add logical FITS table column --- pyext/GFitsTableLogCol.i | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pyext/gammalib.i | 5 +++++ 2 files changed, 80 insertions(+), 0 deletions(-) create mode 100644 pyext/GFitsTableLogCol.i diff --git a/pyext/GFitsTableLogCol.i b/pyext/GFitsTableLogCol.i new file mode 100644 index 0000000..5b212ea --- /dev/null +++ b/pyext/GFitsTableLogCol.i @@ -0,0 +1,75 @@ +/*************************************************************************** + * GFitsTableLogCol.i - FITS table logical column class SWIG definition * + * ----------------------------------------------------------------------- * + * copyright : (C) 2008 by Jurgen Knodlseder * + * ----------------------------------------------------------------------- * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +/** + * @file GFitsTableLogCol.i + * @brief GFitsTableLogCol class SWIG file. + * @author J. Knodlseder + */ +%{ +/* Put headers and other declarations here that are needed for compilation */ +#include "GFitsTableLogCol.hpp" +%} + + +/***********************************************************************//** + * @class GFitsTableLogCol + * + * @brief SWIG interface for FITS table logical column + ***************************************************************************/ +class GFitsTableLogCol : public GFitsTableCol { +public: + // Constructors and destructors + GFitsTableLogCol(); + GFitsTableLogCol(const std::string& name, const int& length, + const int& size = 1); + GFitsTableLogCol(const GFitsTableLogCol& column); + virtual ~GFitsTableLogCol(); + + // Methods + std::string string(const int& row, const int& col = 0); + double real(const int& row, const int& col = 0); + int integer(const int& row, const int& col = 0); + char* data(void); + void set_nullval(const char* value); +}; + + +/***********************************************************************//** + * @brief GFitsTableLogCol class extension + ***************************************************************************/ +%extend GFitsTableLogCol { + char *__str__() { + static char str_buffer[1001]; + std::ostringstream buffer; + buffer << *self; + std::string str = buffer.str(); + strncpy(str_buffer, (char*)str.c_str(), 1001); + str_buffer[1000] = '\0'; + return str_buffer; + } + char get(const int& row) { + return (*self)(row); + } + char get(const int& row, const int& col) { + return (*self)(row, col); + } + void set(const int& row, const char& value) { + (*self)(row) = value; + } + void set(const int& row, const int& col, const char& value) { + (*self)(row, col) = value; + } + GFitsTableLogCol copy() { + return (*self); + } +}; diff --git a/pyext/gammalib.i b/pyext/gammalib.i index aa90f58..92c4023 100755 --- a/pyext/gammalib.i +++ b/pyext/gammalib.i @@ -23,6 +23,10 @@ #include "GResponse.i" #include "GLATResponse.i" +/* Observation classes */ +//#include "GObservation.i" +#include "GLATObservation.i" + /* FITS file class */ #include "GFits.i" #include "GFitsHDU.i" @@ -35,6 +39,7 @@ #include "GFitsAsciiTable.i" #include "GFitsBinTable.i" #include "GFitsTableCol.i" +#include "GFitsTableLogCol.i" #include "GFitsTableDblCol.i" #include "GFitsTableFltCol.i" #include "GFitsTableLngCol.i" -- libgit2 0.21.4