580 if (memcmp(simple,
"SIMPLE = ", 10))
582 clear(rdstate()|std::ios::badbit);
584 throw std::runtime_error(
"File is not a FITS file.");
586 gLog <<
___err___ <<
"ERROR - File is not a FITS file." << std::endl;
595 std::vector<std::string> block;
602 if (eof() && !bad() && !tableName.empty())
610 clear(rdstate()|std::ios::badbit);
612 throw std::runtime_error(
"FITS file corrupted.");
614 gLog <<
___err___ <<
"ERROR - FITS file corrupted." << std::endl;
623 clear(rdstate()|std::ios::badbit);
625 throw std::runtime_error(
"END keyword missing in FITS header.");
627 gLog <<
___err___ <<
"ERROR - END keyword missing in FITS file... file might be corrupted." << std::endl;
638 if (block[0].substr(0, 9)==
"SIMPLE =")
644 if (block[0].substr(0, 9)==
"XTENSION=")
646 fTable = Table(block, tellg());
651 clear(rdstate()|std::ios::badbit);
655 const std::string &tname =
fTable.
Get<std::string>(
"EXTNAME");
661 if ((!tableName.empty() && tableName!=tname) || (tableName.empty() &&
"ZDrsCellOffsets"==tname))
664 seekg(skip, std::ios_base::cur);
681 if (*fout.rbegin()==
'/')
683 const size_t p = fname.find_last_of(
'/');
684 fout.append(fname.substr(p+1));
690 clear(rdstate()|std::ios::badbit);
692 throw std::runtime_error(
"Could not open output file.");
694 gLog <<
___err___ <<
"ERROR - Failed to open output file." << std::endl;
699 const streampos p = tellg();
702 std::vector<char> buf(p);
705 fCopy.write(buf.data(), p);
707 clear(rdstate()|std::ios::badbit);
std::vector< char > fBufferDat
void EnableAddressExceptions(bool b=true)
bool ReadBlock(std::vector< std::string > &vec)
streamoff GetTotalBytes() const
T Get(const std::string &key) const
std::vector< char > fBufferRow
std::vector< std::string > fListOfTables