FACT++  1.0
bool fits::Table::Check ( const std::string &  key,
char  type,
const std::string &  value = "" 
) const
inline

Definition at line 135 of file fits.h.

References ___err___, gLog, and str.

136  {
137  const Keys::const_iterator it = keys.find(key);
138  if (it==keys.end())
139  {
140  std::ostringstream str;
141  str << "Key '" << key << "' not found.";
142 #ifdef __EXCEPTIONS
143  throw std::runtime_error(str.str());
144 #else
145  gLog << ___err___ << "ERROR - " << str.str() << std::endl;
146  return false;
147 #endif
148  }
149 
150  if (it->second.type!=type)
151  {
152  std::ostringstream str;
153  str << "Wrong type for key '" << key << "': expected " << type << ", found " << it->second.type << ".";
154 #ifdef __EXCEPTIONS
155  throw std::runtime_error(str.str());
156 #else
157  gLog << ___err___ << "ERROR - " << str.str() << std::endl;
158  return false;
159 #endif
160  }
161 
162  if (!value.empty() && it->second.value!=value)
163  {
164  std::ostringstream str;
165  str << "Wrong value for key '" << key << "': expected " << value << ", found " << it->second.value << ".";
166 #ifdef __EXCEPTIONS
167  throw std::runtime_error(str.str());
168 #else
169  gLog << ___err___ << "ERROR - " << str.str() << std::endl;
170  return false;
171 #endif
172  }
173 
174  return true;
175  }
char str[80]
Definition: test_client.c:7
#define gLog
Definition: fits.h:36
#define ___err___
Definition: fits.h:37
int type
Keys keys
Definition: fits.h:118