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