FACT++  1.0
bool FitsFile::OpenTable ( const string &  tablename)

Definition at line 159 of file FitsFile.cc.

References Error().

Referenced by AddColumn().

160 {
161  if (!fFile)
162  {
163  Error("FitsFile::OpenTable - No file open.");
164  return false;
165  }
166  if (fTable)
167  {
168  Error("FitsFile::OpenTable - Table already open.");
169  return false;
170  }
171 
172  //actually create the table
173  CCfits::Table *table = 0;
174  try
175  {
176  table = fFile->addTable(tablename, 0, fColNames, fColTypes, fColUnits);
177  }
178  catch (const CCfits::FitsException &e)
179  {
180  Error("CCfits::Table::addTable failed for '"+tablename+"' in '"+fFile->name()+"': "+e.message());
181  return false;
182  }
183 
184  if (table->rows() != 0)
185  {
186  Error("FITS table '"+tablename+"' created in '"+fFile->name()+"' on the fly looks non-empty.");
187  return false;
188  }
189 
190  // Set this as last - we use it for IsOpen()
191  fTable = table;
192  fNumRows = 0;
193 
194  return true;
195 }
size_t fNumRows
The pointer to the CCfits binary table.
Definition: FitsFile.h:21
CCfits::Table * fTable
The pointer to the CCfits FITS file.
Definition: FitsFile.h:19
CCfits::FITS * fFile
Definition: FitsFile.h:18
int Error(const std::string &str)
Definition: MessageImp.h:49
std::vector< std::string > fColTypes
Definition: FitsFile.h:15
std::vector< std::string > fColUnits
Definition: FitsFile.h:16
std::vector< std::string > fColNames
Definition: FitsFile.h:14

+ Here is the call graph for this function:

+ Here is the caller graph for this function: