Instrument Neutral Distributed Interface INDI
2.2.5
libs
indibase
fitskeyword.cpp
Go to the documentation of this file.
1
19
20
#include "
fitskeyword.h
"
21
#include <cmath>
22
#include <sstream>
23
24
namespace
INDI
25
{
26
27
FITSRecord::FITSRecord
() :
28
val_int64
(0),
29
m_type(
VOID
)
30
{
31
}
32
33
FITSRecord::FITSRecord
(
const
char
*
key
,
const
char
*value,
const
char
*
comment
) :
34
m_key(
key
),
35
m_type(
STRING
)
36
{
37
if
(value)
38
val_str = std::string(value);
39
40
if
(
comment
)
41
m_comment = std::string(
comment
);
42
}
43
44
FITSRecord::FITSRecord
(
const
char
*
key
, int64_t value,
const
char
*
comment
) :
45
val_int64
(value),
46
val_str(
std
::to_string(value)),
47
m_key(
key
),
48
m_type(
LONGLONG
)
49
{
50
if
(
comment
)
51
m_comment = std::string(
comment
);
52
}
53
54
/*FITSRecord::FITSRecord(const char *key, uint64_t value, const char *comment) :
55
val_uint64(value),
56
val_str(std::to_string(value)),
57
m_key(key),
58
m_type(ULONGLONG)
59
{
60
if(comment)
61
m_comment = std::string(comment);
62
}*/
63
64
FITSRecord::FITSRecord
(
const
char
*
key
,
double
value,
int
decimal
,
const
char
*
comment
) :
65
val_double
(value),
66
m_key(
key
),
67
m_type(
DOUBLE
),
68
m_decimal(
decimal
)
69
{
70
std::stringstream ss;
71
ss.precision(
decimal
);
72
ss << value;
73
val_str = ss.str();
74
75
if
(
comment
)
76
m_comment = std::string(
comment
);
77
}
78
79
FITSRecord::FITSRecord
(
const
char
*
comment
) :
80
m_key(
"COMMENT"
),
81
m_type(
COMMENT
)
82
{
83
if
(
comment
)
84
m_comment = std::string(
comment
);
85
}
86
87
FITSRecord::Type
FITSRecord::type
()
const
88
{
89
return
m_type;
90
}
91
92
const
std::string &
FITSRecord::key
()
const
93
{
94
return
m_key;
95
}
96
97
const
std::string &
FITSRecord::valueString
()
const
98
{
99
return
val_str;
100
}
101
102
int64_t
FITSRecord::valueInt
()
const
103
{
104
if
(m_type ==
LONGLONG
)
105
return
val_int64
;
106
else
107
return
0;
108
}
109
110
/*uint64_t FITSRecord::valueUInt() const
111
{
112
if (m_type == ULONGLONG)
113
return val_uint64;
114
else
115
return 0;
116
}*/
117
118
double
FITSRecord::valueDouble
()
const
119
{
120
if
(m_type ==
DOUBLE
)
121
return
val_double
;
122
else
123
return
NAN;
124
}
125
126
const
std::string &
FITSRecord::comment
()
const
127
{
128
return
m_comment;
129
}
130
131
int
FITSRecord::decimal
()
const
132
{
133
return
m_decimal;
134
}
135
136
}
137
138
INDI::FITSRecord::decimal
int decimal() const
Definition
fitskeyword.cpp:131
INDI::FITSRecord::key
const std::string & key() const
Definition
fitskeyword.cpp:92
INDI::FITSRecord::valueDouble
double valueDouble() const
Definition
fitskeyword.cpp:118
INDI::FITSRecord::val_int64
int64_t val_int64
Definition
fitskeyword.h:58
INDI::FITSRecord::valueString
const std::string & valueString() const
Definition
fitskeyword.cpp:97
INDI::FITSRecord::valueInt
int64_t valueInt() const
Definition
fitskeyword.cpp:102
INDI::FITSRecord::type
Type type() const
Definition
fitskeyword.cpp:87
INDI::FITSRecord::comment
const std::string & comment() const
Definition
fitskeyword.cpp:126
INDI::FITSRecord::val_double
double val_double
Definition
fitskeyword.h:60
INDI::FITSRecord::Type
Type
Definition
fitskeyword.h:33
INDI::FITSRecord::VOID
@ VOID
Definition
fitskeyword.h:34
INDI::FITSRecord::STRING
@ STRING
Definition
fitskeyword.h:36
INDI::FITSRecord::DOUBLE
@ DOUBLE
Definition
fitskeyword.h:39
INDI::FITSRecord::LONGLONG
@ LONGLONG
Definition
fitskeyword.h:37
INDI::FITSRecord::COMMENT
@ COMMENT
Definition
fitskeyword.h:35
INDI::FITSRecord::FITSRecord
FITSRecord()
Definition
fitskeyword.cpp:27
fitskeyword.h
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition
pegasus_wifi.h:35
std
Definition
indijson.hpp:4973
Generated on
for Instrument Neutral Distributed Interface INDI by
1.15.0