GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GFitsTableCDoubleCol.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GFitsTableCDoubleCol.hpp - FITS table double precision complex column *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2008-2017 by Juergen Knoedlseder *
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 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/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file GFitsTableCDoubleCol.hpp
23  * @brief FITS table double complex column class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GFITSTABLECDOUBLECOL_HPP
28 #define GFITSTABLECDOUBLECOL_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GFits.hpp"
33 #include "GFitsTableCol.hpp"
34 
35 
36 /***********************************************************************//**
37  * @class GFitsTableCDoubleCol
38  *
39  * @brief FITS table double complex column
40  *
41  * This class implements a FITS table double complex column.
42  ***************************************************************************/
44 
45 public:
46  // Constructors and destructors
48  GFitsTableCDoubleCol(const std::string& name, const int& nrows,
49  const int& size = 1);
51  virtual ~GFitsTableCDoubleCol(void);
52 
53  // Operators
55  GFits::cdouble& operator()(const int& row, const int& inx = 0);
56  const GFits::cdouble& operator()(const int& row, const int& inx = 0) const;
57 
58  // Implement virtual methods
59  virtual void clear(void);
60  virtual GFitsTableCDoubleCol* clone(void) const;
61  virtual std::string classname(void) const;
62  virtual std::string string(const int& row, const int& col = 0) const;
63  virtual double real(const int& row, const int& col = 0) const;
64  virtual int integer(const int& row, const int& col = 0) const;
65  virtual void insert(const int& row, const int& nrows);
66  virtual void remove(const int& row, const int& nrows);
67  virtual bool is_loaded(void) const;
68 
69  // Other methods
70  GFits::cdouble* data(void);
71  GFits::cdouble* nulval(void);
72  void nulval(const GFits::cdouble* value);
73 
74 private:
75  // Private methods
76  void init_members(void);
77  void copy_members(const GFitsTableCDoubleCol& column);
78  void free_members(void);
79  void alloc_nulval(const GFits::cdouble* value);
80 
81  // Implemented virtual base class methods
82  virtual void alloc_data(void);
83  virtual void init_data(void);
84  virtual void fetch_data(void) const;
85  virtual void resize_data(const int& index, const int& number);
86  virtual void release_data(void);
87  virtual void* ptr_data(const int& index = 0);
88  virtual void* ptr_nulval(void);
89  virtual std::string ascii_format(void) const;
90 
91  // Private data area
92  GFits::cdouble* m_data; //!< Data vector
93  GFits::cdouble* m_nulval; //!< NULL value
94 };
95 
96 
97 /***********************************************************************//**
98  * @brief Return class name
99  *
100  * @return String containing the class name ("GFitsTableCDoubleCol").
101  ***************************************************************************/
102 inline
103 std::string GFitsTableCDoubleCol::classname(void) const
104 {
105  return ("GFitsTableCDoubleCol");
106 }
107 
108 
109 /***********************************************************************//**
110  * @brief Checks if column has been loaded
111  *
112  * @return True if column has been loaded, false otherwise
113  ***************************************************************************/
114 inline
116 {
117  return (m_data != NULL);
118 }
119 
120 
121 /***********************************************************************//**
122  * @brief Returns pointer to column data
123  *
124  * @return Pointer to column data.
125  ***************************************************************************/
126 inline
128 {
129  return m_data;
130 }
131 
132 
133 /***********************************************************************//**
134  * @brief Returns pointer to nul value
135  *
136  * @return Pointer to nul value.
137  ***************************************************************************/
138 inline
140 {
141  return m_nulval;
142 }
143 
144 
145 /***********************************************************************//**
146  * @brief Returns void pointer to column data
147  *
148  * @return Void pointer to column data.
149  ***************************************************************************/
150 inline
151 void* GFitsTableCDoubleCol::ptr_data(const int& index)
152 {
153  return (m_data+index);
154 }
155 
156 
157 /***********************************************************************//**
158  * @brief Returns void pointer to nul value
159  *
160  * @return Void pointer to nul value.
161  ***************************************************************************/
162 inline
164 {
165  return m_nulval;
166 }
167 
168 #endif /* GFITSTABLECDOUBLECOL_HPP */
virtual void insert(const int &row, const int &nrows)
Insert rows in column.
virtual std::string string(const int &row, const int &col=0) const
Get string value.
const std::string & name(void) const
Returns column name.
FITS table double complex column.
GFits::cdouble * data(void)
Returns pointer to column data.
GFitsTableCDoubleCol(void)
Constructor.
FITS file class interface definition.
virtual void resize_data(const int &index, const int &number)
Resize column data.
FITS table column abstract base class definition.
virtual int integer(const int &row, const int &col=0) const
Get integer value (real part)
GFits::cdouble * m_nulval
NULL value.
virtual void * ptr_nulval(void)
Returns void pointer to nul value.
const int & number(void) const
Returns number of elements in column.
virtual void fetch_data(void) const
Fetch column data.
Abstract interface for FITS table column.
GFits::cdouble & operator()(const int &row, const int &inx=0)
Column data access operator.
virtual std::string ascii_format(void) const
Returns format string of ASCII table.
virtual GFitsTableCDoubleCol * clone(void) const
Clone column.
GFitsTableCDoubleCol & operator=(const GFitsTableCDoubleCol &column)
Assignment operator.
virtual void alloc_data(void)
Allocates column data.
GFits::cdouble * m_data
Data vector.
virtual double real(const int &row, const int &col=0) const
Get double precision value (real part)
virtual ~GFitsTableCDoubleCol(void)
Destructor.
GFits::cdouble * nulval(void)
Returns pointer to nul value.
virtual bool is_loaded(void) const
Checks if column has been loaded.
void free_members(void)
Delete class members.
virtual void init_data(void)
Initialise column data.
virtual void release_data(void)
Release column data.
void copy_members(const GFitsTableCDoubleCol &column)
Copy class members.
virtual void clear(void)
Clear instance.
void alloc_nulval(const GFits::cdouble *value)
Allocates null value.
const int & nrows(void) const
Returns number of rows in column.
virtual std::string classname(void) const
Return class name.
void init_members(void)
Initialise class members.
virtual void * ptr_data(const int &index=0)
Returns void pointer to column data.