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());
151 const KeyData<int>& thisKey =
static_cast<const KeyData<int>&
>(*this);
152 std::ostringstream oss;
153 oss << thisKey.keyval();
159 const KeyData<float>& thisKey =
static_cast<const KeyData<float>&
>(*this);
160 std::ostringstream oss;
161 oss << thisKey.keyval();
167 const KeyData<double>& thisKey =
static_cast<const KeyData<double>&
>(*this);
168 std::ostringstream oss;
169 oss << thisKey.keyval();
175 const KeyData<String>& thisKey =
static_cast<const KeyData<String>&
>(*this);
176 val = thisKey.keyval();
180 throw Keyword::WrongKeywordValueType(
name());
189 if (m_keytype == Tfloat)
191 KeyData<float>& thisKey =
static_cast<KeyData<float>&
>(*this);
192 thisKey.keyval(newValue);
195 else if (m_keytype == Tdouble)
197 KeyData<double>& thisKey =
static_cast<KeyData<double>&
>(*this);
198 thisKey.keyval(static_cast<double>(newValue));
203 throw Keyword::WrongKeywordValueType(
name());
210 if (m_keytype == Tdouble)
212 KeyData<double>& thisKey =
static_cast<KeyData<double>&
>(*this);
213 thisKey.keyval(newValue);
216 else if (m_keytype == Tfloat)
219 KeyData<float>& thisKey =
static_cast<KeyData<float>&
>(*this);
220 thisKey.keyval(static_cast<float>(newValue));
225 throw Keyword::WrongKeywordValueType(
name());
233 if (m_keytype == Tint)
235 KeyData<int>& thisKey =
static_cast<KeyData<int>&
>(*this);
236 thisKey.keyval(newValue);
239 else if (m_keytype == Tfloat)
241 KeyData<float>& thisKey =
static_cast<KeyData<float>&
>(*this);
242 thisKey.keyval(static_cast<float>(newValue));
245 else if (m_keytype == Tdouble)
247 KeyData<double>& thisKey =
static_cast<KeyData<double>&
>(*this);
248 thisKey.keyval(static_cast<double>(newValue));
251 else if (m_keytype == Tstring)
253 KeyData<String>& thisKey =
static_cast<KeyData<String>&
>(*this);
254 std::ostringstream oss;
256 thisKey.keyval(oss.str());
261 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:314
Namespace enclosing all CCfits classes and globals definitions.
Definition: AsciiTable.cxx:26
void setValue(const T &newValue)
modify the value of an existing Keyword and write it to the file
Definition: KeywordT.h:44