33 const KeyData<T>& thisKey =
dynamic_cast<const KeyData<T>&
>(*this);
34 val = thisKey.keyval();
38 throw Keyword::WrongKeywordValueType(
name());
48 KeyData<T>& thisKey =
dynamic_cast<KeyData<T>&
>(*this);
49 thisKey.keyval(newValue);
54 throw Keyword::WrongKeywordValueType(
name());
59 #if SPEC_TEMPLATE_IMP_DEFECT || SPEC_TEMPLATE_DECL_DEFECT
67 const KeyData<int>& thisKey =
static_cast<const KeyData<int>&
>(*this);
68 val = thisKey.keyval();
73 const KeyData<float>& thisKey =
static_cast<const KeyData<float>&
>(*this);
74 val = thisKey.keyval();
82 const KeyData<double>& thisKey =
static_cast<const KeyData<double>&
>(*this);
83 val = thisKey.keyval();
89 const KeyData<String>& thisKey =
static_cast<const KeyData<String>&
>(*this);
90 std::istringstream testStream(thisKey.keyval());
92 if (!(testStream >> stringInt) || !testStream.eof())
94 throw Keyword::WrongKeywordValueType(
name());
100 throw Keyword::WrongKeywordValueType(
name());
113 val =
static_cast<float>(
value(dval));
120 if (m_keytype == Tstring)
123 const KeyData<String>& thisKey =
static_cast<const KeyData<String>&
>(*this);
124 std::istringstream testStream(thisKey.keyval());
126 if (!(testStream >> stringInt) || !testStream.eof())
128 throw Keyword::WrongKeywordValueType(
name());
132 else if (m_keytype == Tint)
134 const KeyData<int>& thisKey =
static_cast<const KeyData<int>&
>(*this);
135 val = thisKey.keyval();
139 throw Keyword::WrongKeywordValueType(
name());
148 if (m_keytype == Tfloat)
150 KeyData<float>& thisKey =
static_cast<KeyData<float>&
>(*this);
151 thisKey.keyval(newValue);
154 else if (m_keytype == Tdouble)
156 KeyData<double>& thisKey =
static_cast<KeyData<double>&
>(*this);
157 thisKey.keyval(static_cast<double>(newValue));
162 throw Keyword::WrongKeywordValueType(
name());
169 if (m_keytype == Tdouble)
171 KeyData<double>& thisKey =
static_cast<KeyData<double>&
>(*this);
172 thisKey.keyval(newValue);
175 else if (m_keytype == Tfloat)
178 KeyData<float>& thisKey =
static_cast<KeyData<float>&
>(*this);
179 thisKey.keyval(static_cast<float>(newValue));
184 throw Keyword::WrongKeywordValueType(
name());
192 if (m_keytype == Tint)
194 KeyData<int>& thisKey =
static_cast<KeyData<int>&
>(*this);
195 thisKey.keyval(newValue);
198 else if (m_keytype == Tfloat)
200 KeyData<float>& thisKey =
static_cast<KeyData<float>&
>(*this);
201 thisKey.keyval(static_cast<float>(newValue));
204 else if (m_keytype == Tdouble)
206 KeyData<double>& thisKey =
static_cast<KeyData<double>&
>(*this);
207 thisKey.keyval(static_cast<double>(newValue));
210 else if (m_keytype == Tstring)
212 KeyData<String>& thisKey =
static_cast<KeyData<String>&
>(*this);
213 std::ostringstream oss;
215 thisKey.keyval(oss.str());
220 throw Keyword::WrongKeywordValueType(
name());
const String & name() const
return the name of a keyword
Definition: Keyword.h:312
Namespace enclosing all CCfits classes and globals definitions.
Definition: AsciiTable.cxx:26
T & value(T &val) const
get the keyword value
Definition: KeywordT.h:29
void setValue(const T &newValue)
modify the value of an existing Keyword and write it to the file
Definition: KeywordT.h:44