FACT++  1.0
bool DataWriteFits2::Close ( const EVT_CTRL2 )
virtual

Closes the file, and before this it write the TAIL data

Parameters
rtthe pointer to the RUN_TAIL data structure

Implements DataProcessorImp.

Definition at line 320 of file DataWriteFits2.cc.

References MessageImp::Error(), fFile, DataProcessorImp::fFileName, str, and WriteFooter().

Referenced by DataCalib::Close(), and GetDrsStep().

321 {
322  if (!fFile->is_open())
323  {
324  Error("DataWriteFits2::Close() called but file '"+fFileName+"' not open.");
325  return false;
326  }
327 
328  try
329  {
330  WriteFooter();
331  }
332  catch (const exception &e)
333  {
334  Error("ofits - Setting footer key values failed for '"+fFileName+"': "+e.what());
335  return false;
336  }
337 
338  try
339  {
340  fFile->close();
341  }
342  catch (const exception &e)
343  {
344  Error("ofits::close() failed for '"+fFileName+"': "+e.what());
345  return false;
346  }
347 
348  if (!(*fFile))
349  {
350  ostringstream str;
351  str << "ofstream::close() failed for '" << fFileName << "': " << strerror(errno) << " [errno=" << errno << "]";
352  Error(str);
353  return false;
354  }
355 
356  return true;
357 }
char str[80]
Definition: test_client.c:7
std::shared_ptr< ofits > fFile
std::string fFileName
int Error(const std::string &str)
Definition: MessageImp.h:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function: