Commit ab6cfddbb8c8f159daad7c998b083ffbe4476801

Authored by knodlseder
1 parent e568245a

add logical FITS table column

pyext/GFitsTableLogCol.i 0 → 100644
  1 +/***************************************************************************
  2 + * GFitsTableLogCol.i - FITS table logical column class SWIG definition *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright : (C) 2008 by Jurgen Knodlseder *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software; you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation; either version 2 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + ***************************************************************************/
  13 +/**
  14 + * @file GFitsTableLogCol.i
  15 + * @brief GFitsTableLogCol class SWIG file.
  16 + * @author J. Knodlseder
  17 + */
  18 +%{
  19 +/* Put headers and other declarations here that are needed for compilation */
  20 +#include "GFitsTableLogCol.hpp"
  21 +%}
  22 +
  23 +
  24 +/***********************************************************************//**
  25 + * @class GFitsTableLogCol
  26 + *
  27 + * @brief SWIG interface for FITS table logical column
  28 + ***************************************************************************/
  29 +class GFitsTableLogCol : public GFitsTableCol {
  30 +public:
  31 + // Constructors and destructors
  32 + GFitsTableLogCol();
  33 + GFitsTableLogCol(const std::string& name, const int& length,
  34 + const int& size = 1);
  35 + GFitsTableLogCol(const GFitsTableLogCol& column);
  36 + virtual ~GFitsTableLogCol();
  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 + char* data(void);
  43 + void set_nullval(const char* value);
  44 +};
  45 +
  46 +
  47 +/***********************************************************************//**
  48 + * @brief GFitsTableLogCol class extension
  49 + ***************************************************************************/
  50 +%extend GFitsTableLogCol {
  51 + char *__str__() {
  52 + static char str_buffer[1001];
  53 + std::ostringstream buffer;
  54 + buffer << *self;
  55 + std::string str = buffer.str();
  56 + strncpy(str_buffer, (char*)str.c_str(), 1001);
  57 + str_buffer[1000] = '\0';
  58 + return str_buffer;
  59 + }
  60 + char get(const int& row) {
  61 + return (*self)(row);
  62 + }
  63 + char get(const int& row, const int& col) {
  64 + return (*self)(row, col);
  65 + }
  66 + void set(const int& row, const char& value) {
  67 + (*self)(row) = value;
  68 + }
  69 + void set(const int& row, const int& col, const char& value) {
  70 + (*self)(row, col) = value;
  71 + }
  72 + GFitsTableLogCol copy() {
  73 + return (*self);
  74 + }
  75 +};
... ...
pyext/gammalib.i
... ... @@ -23,6 +23,10 @@
23 23 #include "GResponse.i"
24 24 #include "GLATResponse.i"
25 25  
  26 +/* Observation classes */
  27 +//#include "GObservation.i"
  28 +#include "GLATObservation.i"
  29 +
26 30 /* FITS file class */
27 31 #include "GFits.i"
28 32 #include "GFitsHDU.i"
... ... @@ -35,6 +39,7 @@
35 39 #include "GFitsAsciiTable.i"
36 40 #include "GFitsBinTable.i"
37 41 #include "GFitsTableCol.i"
  42 +#include "GFitsTableLogCol.i"
38 43 #include "GFitsTableDblCol.i"
39 44 #include "GFitsTableFltCol.i"
40 45 #include "GFitsTableLngCol.i"
... ...