GFitsTableCol.hpp
5.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/***************************************************************************
* GFitsTableCol.hpp - FITS table column abstract base class *
* ----------------------------------------------------------------------- *
* copyright (C) 2008-2012 by Juergen Knoedlseder *
* ----------------------------------------------------------------------- *
* *
* 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 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
/**
* @file GFitsTableCol.hpp
* @brief FITS table column abstract base class definition
* @author Juergen Knoedlseder
*/
#ifndef GFITSTABLECOL_HPP
#define GFITSTABLECOL_HPP
/* __ Includes ___________________________________________________________ */
#include <string>
#include <vector>
#include "GBase.hpp"
/***********************************************************************//**
* @class GFitsTableCol
*
* @brief Abstract interface for FITS table column
*
* This class implements a FITS table column. Vector columns are supported.
***************************************************************************/
class GFitsTableCol : public GBase {
// Friend classes
friend class GFitsTable;
public:
// Constructors and destructors
GFitsTableCol(void);
explicit GFitsTableCol(const std::string& name, const int& length,
const int& number, const int& width);
GFitsTableCol(const GFitsTableCol& column);
virtual ~GFitsTableCol(void);
// Operators
GFitsTableCol& operator= (const GFitsTableCol& column);
// Pure virtual Methods
virtual void clear(void) = 0;
virtual GFitsTableCol* clone(void) const = 0;
virtual std::string string(const int& row, const int& inx = 0) const = 0;
virtual double real(const int& row, const int& inx = 0) const = 0;
virtual int integer(const int& row, const int& inx = 0) const = 0;
virtual void insert(const int& rownum, const int& nrows) = 0;
virtual void remove(const int& rownum, const int& nrows) = 0;
// Base class Methods
void name(const std::string& name);
void unit(const std::string& unit);
void dim(const std::vector<int>& dim);
std::string name(void) const;
std::string unit(void) const;
std::vector<int> dim(void) const;
int colnum(void) const;
int type(void) const;
int repeat(void) const;
int width(void) const;
int number(void) const;
int length(void) const;
int anynul(void) const;
std::string print(void) const;
protected:
// Protected data area
std::string m_name; //!< Column name
std::string m_unit; //!< Column unit
std::vector<int> m_dim; //!< Column dimension
int m_colnum; //!< @brief Column number (starting from 1).
//!< This parameter is used to signal if a
//!< table column corresponds to a FITS file
//!< column. If it is set to 0 there is no
//!< correspondance.
int m_type; //!< Column type
int m_repeat; //!< Repeat value of column
int m_width; //!< Width of single column element
int m_number; //!< @brief Number of elements in column.
//!< m_number = m_repeat / m_width
int m_length; //!< Length of column
mutable int m_size; //!< Size of allocated data area (0 if not loaded)
int m_anynul; //!< Number of NULLs encountered
void* m_fitsfile; //!< FITS file pointer associated with column
// Protected pure virtual methods
virtual std::string ascii_format(void) const = 0;
virtual std::string binary_format(void) const = 0;
virtual void alloc_data(void) = 0;
virtual void init_data(void) = 0;
virtual void* ptr_data(void) = 0;
virtual void* ptr_nulval(void) = 0;
// Protected virtual methods
virtual void save(void);
virtual void fetch_data(void) const;
virtual void load_column(void);
virtual void save_column(void);
virtual int offset(const int& row, const int& inx) const;
protected:
// Private methods
void init_members(void);
void copy_members(const GFitsTableCol& column);
void free_members(void);
void connect(void* vptr);
};
#endif /* GFITSTABLECOL_HPP */