GammaLib
2.0.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
GFitsHeaderCard.hpp
Go to the documentation of this file.
1
/***************************************************************************
2
* GFitsHeaderCard.hpp - FITS header card class *
3
* ----------------------------------------------------------------------- *
4
* copyright (C) 2008-2018 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 GFitsHeaderCard.hpp
23
* @brief FITS header card class definition
24
* @author Juergen Knoedlseder
25
*/
26
27
#ifndef GFITSHEADERCARD_HPP
28
#define GFITSHEADERCARD_HPP
29
30
/* __ Includes ___________________________________________________________ */
31
#include <string>
32
#include "
GBase.hpp
"
33
34
35
/***********************************************************************/
/**
36
* @class GFitsHeaderCard
37
*
38
* @brief Implements FITS header card interface
39
*
40
* This class implements a FITS header card. A header card consists of a
41
* keyname (string), a value (string, floating point, integer or logical)
42
* and a comment (string). COMMENT or HISTORY cards do not have a value.
43
***************************************************************************/
44
class
GFitsHeaderCard
:
public
GBase
{
45
46
// Friend classes
47
friend
class
GFitsHeader
;
48
49
public
:
50
// Constructors & Destructors
51
GFitsHeaderCard
(
void
);
52
GFitsHeaderCard
(
const
std::string&
keyname
,
const
std::string&
value
,
53
const
std::string&
unit
,
const
std::string&
comment
);
54
GFitsHeaderCard
(
const
std::string&
keyname
,
const
std::string&
value
,
55
const
std::string&
comment
);
56
GFitsHeaderCard
(
const
std::string&
keyname
,
const
double
&
value
,
57
const
std::string&
comment
);
58
GFitsHeaderCard
(
const
std::string&
keyname
,
const
int
&
value
,
59
const
std::string&
comment
);
60
GFitsHeaderCard
(
const
std::string&
keyname
,
const
bool
&
value
,
61
const
std::string&
comment
);
62
GFitsHeaderCard
(
const
std::string&
keyname
,
const
char
*
value
,
63
const
std::string&
comment
);
64
GFitsHeaderCard
(
const
GFitsHeaderCard
& card);
65
virtual
~GFitsHeaderCard
(
void
);
66
67
// Operators
68
GFitsHeaderCard
&
operator=
(
const
GFitsHeaderCard
& card);
69
70
// Methods
71
void
clear
(
void
);
72
GFitsHeaderCard
*
clone
(
void
)
const
;
73
std::string
classname
(
void
)
const
;
74
void
keyname
(
const
std::string&
keyname
);
75
const
std::string&
keyname
(
void
)
const
;
76
void
value
(
const
std::string&
value
);
77
void
value
(
const
bool
&
value
);
78
void
value
(
const
float
&
value
);
79
void
value
(
const
double
&
value
);
80
void
value
(
const
unsigned
short
&
value
);
81
void
value
(
const
short
&
value
);
82
void
value
(
const
unsigned
int
&
value
);
83
void
value
(
const
int
&
value
);
84
void
value
(
const
long
&
value
);
85
void
value
(
const
unsigned
long
&
value
);
86
void
value
(
const
long
long
&
value
);
87
const
std::string&
value
(
void
)
const
;
88
const
int
&
decimals
(
void
)
const
;
89
void
unit
(
const
std::string&
unit
);
90
const
std::string&
unit
(
void
)
const
;
91
void
comment
(
const
std::string&
comment
);
92
const
std::string&
comment
(
void
)
const
;
93
std::string
string
(
void
)
const
;
94
double
real
(
void
)
const
;
95
int
integer
(
void
)
const
;
96
std::string
print
(
const
GChatter
& chatter =
NORMAL
)
const
;
97
98
private
:
99
// Private methods
100
void
init_members
(
void
);
101
void
copy_members
(
const
GFitsHeaderCard
& card);
102
void
free_members
(
void
);
103
void
set_members
(
const
std::string&
keyname
,
104
const
std::string&
value
,
105
const
std::string&
unit
,
106
const
std::string&
comment
);
107
void
copy_dtype
(
const
GFitsHeaderCard
& card);
108
void
free_dtype
(
void
);
109
void
set_dtype
(
const
std::string&
value
);
110
void
read
(
void
* vptr,
const
int
& keynum);
111
void
read
(
void
* fptr,
const
std::string&
keyname
);
112
void
write
(
void
* fptr)
const
;
113
114
// Private data area
115
std::string
m_keyname
;
//!< Name of the card
116
std::string
m_value
;
//!< Value of the card as read from file
117
std::string
m_unit
;
//!< Unit of the card value
118
std::string
m_comment
;
//!< Card comment
119
int
m_dtype
;
//!< Native data type
120
int
m_value_decimals
;
//!< Decimals of value (for float)
121
bool
m_comment_write
;
//!< Signals that comment should be written
122
void
*
m_value_dtype
;
//!< Value in native data type
123
};
124
125
126
/***********************************************************************/
/**
127
* @brief Return class name
128
*
129
* @return String containing the class name ("GFitsHeaderCard").
130
***************************************************************************/
131
inline
132
std::string
GFitsHeaderCard::classname
(
void
)
const
133
{
134
return
(
"GFitsHeaderCard"
);
135
}
136
137
138
/***********************************************************************/
/**
139
* @brief Set unit of header card value
140
*
141
* @param[in] unit Unit of header card.
142
***************************************************************************/
143
inline
144
void
GFitsHeaderCard::unit
(
const
std::string& unit)
145
{
146
m_unit
=
unit
;
147
return
;
148
}
149
150
151
/***********************************************************************/
/**
152
* @brief Set comment of header card
153
*
154
* @param[in] comment Header card comment.
155
***************************************************************************/
156
inline
157
void
GFitsHeaderCard::comment
(
const
std::string& comment)
158
{
159
m_comment
=
comment
;
160
return
;
161
}
162
163
164
/***********************************************************************/
/**
165
* @brief Return header card keyname
166
***************************************************************************/
167
inline
168
const
std::string&
GFitsHeaderCard::keyname
(
void
)
const
169
{
170
return
m_keyname
;
171
}
172
173
174
/***********************************************************************/
/**
175
* @brief Return header card value
176
***************************************************************************/
177
inline
178
const
std::string&
GFitsHeaderCard::value
(
void
)
const
179
{
180
return
m_value
;
181
}
182
183
184
/***********************************************************************/
/**
185
* @brief Return header card decimals
186
***************************************************************************/
187
inline
188
const
int
&
GFitsHeaderCard::decimals
(
void
)
const
189
{
190
return
m_value_decimals
;
191
}
192
193
194
/***********************************************************************/
/**
195
* @brief Return header card value unit
196
***************************************************************************/
197
inline
198
const
std::string&
GFitsHeaderCard::unit
(
void
)
const
199
{
200
return
m_unit
;
201
}
202
203
204
/***********************************************************************/
/**
205
* @brief Return header card comment
206
***************************************************************************/
207
inline
208
const
std::string&
GFitsHeaderCard::comment
(
void
)
const
209
{
210
return
m_comment
;
211
}
212
213
#endif
/* GFITSHEADERCARD_HPP */
GFitsHeaderCard::m_value_dtype
void * m_value_dtype
Value in native data type.
Definition:
GFitsHeaderCard.hpp:122
GFitsHeaderCard::string
std::string string(void) const
Return header card value as string.
Definition:
GFitsHeaderCard.cpp:594
GFitsHeaderCard::m_dtype
int m_dtype
Native data type.
Definition:
GFitsHeaderCard.hpp:119
GFitsHeaderCard::GFitsHeaderCard
GFitsHeaderCard(void)
Void constructor.
Definition:
GFitsHeaderCard.cpp:67
GFitsHeaderCard::keyname
const std::string & keyname(void) const
Return header card keyname.
Definition:
GFitsHeaderCard.hpp:168
GFitsHeaderCard::copy_dtype
void copy_dtype(const GFitsHeaderCard &card)
Copy dtype.
Definition:
GFitsHeaderCard.cpp:901
GFitsHeaderCard::clone
GFitsHeaderCard * clone(void) const
Clone header card.
Definition:
GFitsHeaderCard.cpp:326
GBase.hpp
Definition of interface for all GammaLib classes.
GFitsHeaderCard::copy_members
void copy_members(const GFitsHeaderCard &card)
Copy class members.
Definition:
GFitsHeaderCard.cpp:834
GFitsHeaderCard::free_dtype
void free_dtype(void)
Free dtype.
Definition:
GFitsHeaderCard.cpp:956
GFitsHeaderCard::print
std::string print(const GChatter &chatter=NORMAL) const
Print header card information.
Definition:
GFitsHeaderCard.cpp:700
GFitsHeaderCard::m_comment_write
bool m_comment_write
Signals that comment should be written.
Definition:
GFitsHeaderCard.hpp:121
GFitsHeaderCard::unit
const std::string & unit(void) const
Return header card value unit.
Definition:
GFitsHeaderCard.hpp:198
GFitsHeaderCard::m_value
std::string m_value
Value of the card as read from file.
Definition:
GFitsHeaderCard.hpp:116
GFitsHeaderCard::decimals
const int & decimals(void) const
Return header card decimals.
Definition:
GFitsHeaderCard.hpp:188
GFitsHeaderCard::operator=
GFitsHeaderCard & operator=(const GFitsHeaderCard &card)
Assignment operator.
Definition:
GFitsHeaderCard.cpp:278
GFitsHeaderCard
Implements FITS header card interface.
Definition:
GFitsHeaderCard.hpp:44
GFitsHeader
Interface for FITS header class.
Definition:
GFitsHeader.hpp:49
GFitsHeaderCard::m_comment
std::string m_comment
Card comment.
Definition:
GFitsHeaderCard.hpp:118
GBase
Interface class for all GammaLib classes.
Definition:
GBase.hpp:52
GFitsHeaderCard::comment
const std::string & comment(void) const
Return header card comment.
Definition:
GFitsHeaderCard.hpp:208
GFitsHeaderCard::set_dtype
void set_dtype(const std::string &value)
Set native data type from card string.
Definition:
GFitsHeaderCard.cpp:1018
NORMAL
Definition:
GTypemaps.hpp:36
GChatter
GChatter
Definition:
GTypemaps.hpp:33
GFitsHeaderCard::read
void read(void *vptr, const int &keynum)
Read header card from FITS file.
Definition:
GFitsHeaderCard.cpp:1125
GFitsHeaderCard::write
void write(void *fptr) const
Write header card.
Definition:
GFitsHeaderCard.cpp:1214
GFitsHeaderCard::classname
std::string classname(void) const
Return class name.
Definition:
GFitsHeaderCard.hpp:132
GFitsHeaderCard::real
double real(void) const
Return header card value as double precision.
Definition:
GFitsHeaderCard.cpp:631
GFitsHeaderCard::clear
void clear(void)
Clear header card.
Definition:
GFitsHeaderCard.cpp:308
GFitsHeaderCard::free_members
void free_members(void)
Delete class members.
Definition:
GFitsHeaderCard.cpp:855
GFitsHeaderCard::value
const std::string & value(void) const
Return header card value.
Definition:
GFitsHeaderCard.hpp:178
GFitsHeaderCard::m_value_decimals
int m_value_decimals
Decimals of value (for float)
Definition:
GFitsHeaderCard.hpp:120
GFitsHeaderCard::m_keyname
std::string m_keyname
Name of the card.
Definition:
GFitsHeaderCard.hpp:115
GFitsHeaderCard::integer
int integer(void) const
Return header card value as integer.
Definition:
GFitsHeaderCard.cpp:666
GFitsHeaderCard::set_members
void set_members(const std::string &keyname, const std::string &value, const std::string &unit, const std::string &comment)
Set card members.
Definition:
GFitsHeaderCard.cpp:876
GFitsHeaderCard::m_unit
std::string m_unit
Unit of the card value.
Definition:
GFitsHeaderCard.hpp:117
GFitsHeaderCard::~GFitsHeaderCard
virtual ~GFitsHeaderCard(void)
Destructor.
Definition:
GFitsHeaderCard.cpp:257
GFitsHeaderCard::init_members
void init_members(void)
Initialise class members.
Definition:
GFitsHeaderCard.cpp:812
include
GFitsHeaderCard.hpp
Generated on Mon Jun 6 2022 12:28:31 for GammaLib by
1.8.5