Changeset 17035 for trunk/Mars/mcore
- Timestamp:
- 08/21/13 16:35:22 (11 years ago)
- Location:
- trunk/Mars/mcore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/fits.h
r16935 r17035 463 463 return it==cols.end() ? 0 : it->second.num; 464 464 } 465 466 465 467 466 468 // There may be a gap between the main table and the start of the heap: … … 660 662 // Check for table name. Skip until eof or requested table are found. 661 663 // skip the current table? 662 if (!tableName.empty() && tableName!=fTable.Get<string>("EXTNAME")) 664 if ((!tableName.empty() && tableName!=fTable.Get<string>("EXTNAME")) || 665 ( tableName.empty() && "ZDrsCellOffsets"==fTable.Get<string>("EXTNAME"))) 663 666 { 664 667 const streamoff skip = fTable.GetTotalBytes(); … … 711 714 fits(const string &fname, const string& tableName="", bool force=false) : izstream(fname.c_str()) 712 715 { 716 gLog << "Here..." <<endl; 713 717 Constructor(fname, "", tableName, force); 718 if ((fTable.is_compressed && !force) || 719 (fTable.name == "ZDrsCellOffsets" && !force)) 720 { 721 #ifdef __EXCEPTIONS 722 throw runtime_error("You are trying to read a compressed fits with the base fits class. Please use factfits instead."); 723 #else 724 gLog << ___err___ << "ERROR - You are trying to read a compressed fits with the base fits class. Please use factfits instead." << endl; 725 #endif 726 clear(rdstate()|ios::badbit); 727 } 714 728 } 715 729 716 730 fits(const string &fname, const string &fout, const string& tableName, bool force=false) : izstream(fname.c_str()) 717 731 { 732 gLog << "There..." << endl; 718 733 Constructor(fname, fout, tableName, force); 734 if ((fTable.is_compressed && !force) || 735 (fTable.name == "ZDrsCellOffsets" && !force)) 736 { 737 #ifdef __EXCEPTIONS 738 throw runtime_error("You are trying to read a compressed fits with the base fits class. Please use factfits instead."); 739 #else 740 gLog << ___err___ << "ERROR - You are trying to read a compressed fits with the base fits class. Please use factfits instead." << endl; 741 #endif 742 clear(rdstate()|ios::badbit); 743 } 744 } 745 746 fits() : izstream() 747 { 748 719 749 } 720 750 … … 999 1029 } 1000 1030 1001 size_t GetNumRows() const { return fTable.num_rows; }1031 // size_t GetNumRows() const { return fTable.num_rows; } 1002 1032 size_t GetRow() const { return fRow==(size_t)-1 ? 0 : fRow; } 1003 1033 … … 1011 1041 1012 1042 bool IsCompressedFITS() const { return fTable.is_compressed;} 1043 1044 virtual size_t GetNumRows() const 1045 { 1046 return fTable.Get<size_t>("NAXIS2"); 1047 } 1048 1049 virtual size_t GetBytesPerRow() const 1050 { 1051 return fTable.Get<size_t>("NAXIS1"); 1052 } 1013 1053 }; 1014 1054 -
trunk/Mars/mcore/zfits.h
r16898 r17035 37 37 38 38 // Basic constructor 39 zfits(const string& fname, const string& tableName="", 40 bool force=false) : fits(fname, tableName, force), 41 fNumTiles(0), 42 fNumRowsPerTile(0), 43 fCurrentRow(-1), 44 fHeapOff(0), 45 fTileSize(0) 46 { 39 zfits(const string& fname, const string& tableName="", bool force=false) : fits(), 40 fNumTiles(0), 41 fNumRowsPerTile(0), 42 fCurrentRow(-1), 43 fHeapOff(0), 44 fTileSize(0) 45 { 46 open(fname.c_str()); 47 Constructor(fname, "", tableName, force); 47 48 InitCompressionReading(); 48 49 } 49 50 50 51 // Alternative contstructor 51 zfits(const string& fname, const string& fout, const string& tableName, 52 bool force=false) : fits(fname, fout, tableName, force), 53 fNumTiles(0), 54 fNumRowsPerTile(0), 55 fCurrentRow(-1), 56 fHeapOff(0), 57 fTileSize(0) 58 { 52 zfits(const string& fname, const string& fout, const string& tableName, bool force=false) : fits(), 53 fNumTiles(0), 54 fNumRowsPerTile(0), 55 fCurrentRow(-1), 56 fHeapOff(0), 57 fTileSize(0) 58 { 59 open(fname.c_str()); 60 Constructor(fname, fout, tableName, force); 59 61 InitCompressionReading(); 60 62 } … … 83 85 return fits::IsFileOk() && rawsum; 84 86 }; 87 88 size_t GetNumRows() const 89 { 90 if (fTable.is_compressed) 91 return fTable.Get<size_t>("ZNAXIS2"); 92 else 93 return fTable.Get<size_t>("NAXIS2"); 94 } 95 size_t GetBytesPerRow() const 96 { 97 if (fTable.is_compressed) 98 return fTable.Get<size_t>("ZNAXIS1"); 99 else 100 return fTable.Get<size_t>("NAXIS1"); 101 } 85 102 86 103 protected:
Note:
See TracChangeset
for help on using the changeset viewer.