33 const KeyData<T>& thisKey =
dynamic_cast<const KeyData<T>&
>(*this);
34 val = thisKey.keyval();
36 catch (std::bad_cast&)
38 throw Keyword::WrongKeywordValueType(
name());
48 KeyData<T>& thisKey =
dynamic_cast<KeyData<T>&
>(*this);
49 thisKey.keyval(newValue);
52 catch (std::bad_cast&)
54 throw Keyword::WrongKeywordValueType(
name());
58 #if SPEC_TEMPLATE_IMP_DEFECT || SPEC_TEMPLATE_DECL_DEFECT
66 const KeyData<int>& thisKey =
static_cast<const KeyData<int>&
>(*this);
67 val = thisKey.keyval();
72 const KeyData<float>& thisKey =
static_cast<const KeyData<float>&
>(*this);
73 val = thisKey.keyval();
81 const KeyData<double>& thisKey =
static_cast<const KeyData<double>&
>(*this);
82 val = thisKey.keyval();
88 const KeyData<String>& thisKey =
static_cast<const KeyData<String>&
>(*this);
89 std::istringstream testStream(thisKey.keyval());
91 if (!(testStream >> stringInt) || !testStream.eof())
93 throw Keyword::WrongKeywordValueType(
name());
99 throw Keyword::WrongKeywordValueType(
name());
112 val =
static_cast<float>(
value(dval));
119 if (m_keytype == Tstring)
122 const KeyData<String>& thisKey =
static_cast<const KeyData<String>&
>(*this);
123 std::istringstream testStream(thisKey.keyval());
125 if (!(testStream >> stringInt) || !testStream.eof())
127 throw Keyword::WrongKeywordValueType(
name());
131 else if (m_keytype == Tint)
133 const KeyData<int>& thisKey =
static_cast<const KeyData<int>&
>(*this);
134 val = thisKey.keyval();
138 throw Keyword::WrongKeywordValueType(
name());
150 const KeyData<int>& thisKey =
static_cast<const KeyData<int>&
>(*this);
151 std::ostringstream oss;
152 oss << thisKey.keyval();
158 const KeyData<float>& thisKey =
static_cast<const KeyData<float>&
>(*this);
159 std::ostringstream oss;
160 oss << thisKey.keyval();
166 const KeyData<double>& thisKey =
static_cast<const KeyData<double>&
>(*this);
167 std::ostringstream oss;
168 oss << thisKey.keyval();
174 const KeyData<String>& thisKey =
static_cast<const KeyData<String>&
>(*this);
175 val = thisKey.keyval();
179 throw Keyword::WrongKeywordValueType(
name());
188 if (m_keytype == Tfloat)
190 KeyData<float>& thisKey =
static_cast<KeyData<float>&
>(*this);
191 thisKey.keyval(newValue);
194 else if (m_keytype == Tdouble)
196 KeyData<double>& thisKey =
static_cast<KeyData<double>&
>(*this);
197 thisKey.keyval(
static_cast<double>(newValue));
202 throw Keyword::WrongKeywordValueType(
name());
209 if (m_keytype == Tdouble)
211 KeyData<double>& thisKey =
static_cast<KeyData<double>&
>(*this);
212 thisKey.keyval(newValue);
215 else if (m_keytype == Tfloat)
218 KeyData<float>& thisKey =
static_cast<KeyData<float>&
>(*this);
219 thisKey.keyval(
static_cast<float>(newValue));
224 throw Keyword::WrongKeywordValueType(
name());
232 if (m_keytype == Tint)
234 KeyData<int>& thisKey =
static_cast<KeyData<int>&
>(*this);
235 thisKey.keyval(newValue);
238 else if (m_keytype == Tfloat)
240 KeyData<float>& thisKey =
static_cast<KeyData<float>&
>(*this);
241 thisKey.keyval(
static_cast<float>(newValue));
244 else if (m_keytype == Tdouble)
246 KeyData<double>& thisKey =
static_cast<KeyData<double>&
>(*this);
247 thisKey.keyval(
static_cast<double>(newValue));
250 else if (m_keytype == Tstring)
252 KeyData<String>& thisKey =
static_cast<KeyData<String>&
>(*this);
253 std::ostringstream oss;
255 thisKey.keyval(oss.str());
260 throw Keyword::WrongKeywordValueType(
name());
T & value(T &val) const
get the keyword value
Definition: KeywordT.h:29
const String & name() const
return the name of a keyword
Definition: Keyword.h:320
void setValue(const T &newValue)
modify the value of an existing Keyword and write it to the file
Definition: KeywordT.h:44
Namespace enclosing all CCfits classes and globals definitions.
Definition: AsciiTable.cxx:26