GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GFitsTableCFloatCol.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GFitsTableCFloatCol.hpp - FITS table single 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 GFitsTableCFloatCol.hpp
23  * @brief FITS table float complex column class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GFITSTABLECFLOATCOL_HPP
28 #define GFITSTABLECFLOATCOL_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GFits.hpp"
33 #include "GFitsTableCol.hpp"
34 
35 
36 /***********************************************************************//**
37  * @class GFitsTableCFloatCol
38  *
39  * @brief FITS table float complex column
40  *
41  * This class implements a FITS table float complex column.
42  ***************************************************************************/
44 
45 public:
46  // Constructors and destructors
47  GFitsTableCFloatCol(void);
48  GFitsTableCFloatCol(const std::string& name, const int& nrows,
49  const int& size = 1);
51  virtual ~GFitsTableCFloatCol(void);
52 
53  // Operators
55  GFits::cfloat& operator()(const int& row, const int& inx = 0);
56  const GFits::cfloat& operator()(const int& row, const int& inx = 0) const;
57 
58  // Implement virtual methods
59  virtual void clear(void);
60  virtual GFitsTableCFloatCol* 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::cfloat* data(void);
71  GFits::cfloat* nulval(void);
72  void nulval(const GFits::cfloat* value);
73 
74 private:
75  // Private methods
76  void init_members(void);
77  void copy_members(const GFitsTableCFloatCol& column);
78  void free_members(void);
79  void alloc_nulval(const GFits::cfloat* 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::cfloat* m_data; //!< Data vector
93  GFits::cfloat* m_nulval; //!< NULL value
94 };
95 
96 
97 /***********************************************************************//**
98  * @brief Return class name
99  *
100  * @return String containing the class name ("GFitsTableCFloatCol").
101  ***************************************************************************/
102 inline
103 std::string GFitsTableCFloatCol::classname(void) const
104 {
105  return ("GFitsTableCFloatCol");
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* GFitsTableCFloatCol::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 /* GFITSTABLECFLOATCOL_HPP */
virtual void insert(const int &row, const int &nrows)
Insert rows in column.
const std::string & name(void) const
Returns column name.
virtual void alloc_data(void)
Allocates column data.
virtual void init_data(void)
Initialise column data.
FITS file class interface definition.
virtual void release_data(void)
Release column data.
GFits::cfloat * data(void)
Returns pointer to column data.
virtual double real(const int &row, const int &col=0) const
Get double precision value (real part)
FITS table column abstract base class definition.
GFits::cfloat & operator()(const int &row, const int &inx=0)
Column data access operator.
virtual int integer(const int &row, const int &col=0) const
Get integer value (real part)
virtual std::string classname(void) const
Return class name.
const int & number(void) const
Returns number of elements in column.
virtual void fetch_data(void) const
Fetch column data.
void copy_members(const GFitsTableCFloatCol &column)
Copy class members.
virtual ~GFitsTableCFloatCol(void)
Destructor.
void alloc_nulval(const GFits::cfloat *value)
Allocates null value.
virtual void clear(void)
Clear instance.
Abstract interface for FITS table column.
virtual std::string ascii_format(void) const
Returns format string of ASCII table.
virtual std::string string(const int &row, const int &col=0) const
Get string value.
virtual void * ptr_nulval(void)
Returns void pointer to nul value.
GFitsTableCFloatCol(void)
Constructor.
virtual GFitsTableCFloatCol * clone(void) const
Clone column.
GFits::cfloat * m_data
Data vector.
virtual bool is_loaded(void) const
Checks if column has been loaded.
GFitsTableCFloatCol & operator=(const GFitsTableCFloatCol &column)
Assignment operator.
GFits::cfloat * m_nulval
NULL value.
virtual void * ptr_data(const int &index=0)
Returns void pointer to column data.
virtual void resize_data(const int &index, const int &number)
Resize column data.
GFits::cfloat * nulval(void)
Returns pointer to nul value.
const int & nrows(void) const
Returns number of rows in column.
FITS table float complex column.
void free_members(void)
Delete class members.
void init_members(void)
Initialise class members.