Changeset 16890
- Timestamp:
- 06/22/13 16:28:00 (12 years ago)
- Location:
- trunk/Mars/mcore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/fits.h
r16889 r16890 100 100 off_t offset; 101 101 102 bool is Compressed;102 bool is_compressed; 103 103 104 104 string name; … … 124 124 125 125 Columns cols; 126 SortedColumns sorted Cols;126 SortedColumns sorted_cols; 127 127 Keys keys; 128 128 … … 249 249 Table() : offset(0) { } 250 250 Table(const vector<string> &vec, off_t off) : offset(off), 251 isCompressed(false), keys(ParseBlock(vec)) 252 { 253 if (HasKey("ZTABLE") && Check("ZTABLE", 'B', "T")) 254 isCompressed = true; 251 keys(ParseBlock(vec)) 252 { 253 is_compressed = HasKey("ZTABLE") && Check("ZTABLE", 'B', "T"); 255 254 256 255 if (!Check("XTENSION", 'T', "BINTABLE") || … … 264 263 return; 265 264 266 if (is Compressed)265 if (is_compressed) 267 266 { 268 267 if (!Check("ZNAXIS1", 'I') || … … 278 277 279 278 total_bytes = Get<size_t>("NAXIS1")*Get<size_t>("NAXIS2"); 280 bytes_per_row = is Compressed ? Get<size_t>("ZNAXIS1") : Get<size_t>("NAXIS1");281 num_rows = is Compressed ? Get<size_t>("ZNAXIS2") : Get<size_t>("NAXIS2");279 bytes_per_row = is_compressed ? Get<size_t>("ZNAXIS1") : Get<size_t>("NAXIS1"); 280 num_rows = is_compressed ? Get<size_t>("ZNAXIS2") : Get<size_t>("NAXIS2"); 282 281 num_cols = Get<size_t>("TFIELDS"); 283 datasum = is Compressed ? Get<int64_t>("ZDATASUM", -1) : Get<int64_t>("DATASUM", -1);282 datasum = is_compressed ? Get<int64_t>("ZDATASUM", -1) : Get<int64_t>("DATASUM", -1); 284 283 285 284 size_t bytes = 0; 286 285 287 const string tFormName = is Compressed ? "ZFORM" : "TFORM";286 const string tFormName = is_compressed ? "ZFORM" : "TFORM"; 288 287 for (size_t i=1; i<=num_cols; i++) 289 288 { 290 ostringstream num; 291 num << i; 292 293 if (!Check("TTYPE"+num.str(), 'T') || 294 !Check(tFormName+num.str(), 'T')) 289 const string num(to_string(i)); 290 291 if (!Check("TTYPE"+num, 'T') || 292 !Check(tFormName+num, 'T')) 295 293 return; 296 294 297 const string id = Get<string>("TTYPE"+num .str());298 const string fmt = Get<string>(tFormName+num .str());299 const string unit = Get<string>("TUNIT"+num .str(), "");300 const string comp = Get<string>("ZCTYP"+num .str(), "");295 const string id = Get<string>("TTYPE"+num); 296 const string fmt = Get<string>(tFormName+num); 297 const string unit = Get<string>("TUNIT"+num, ""); 298 const string comp = Get<string>("ZCTYP"+num, ""); 301 299 302 300 Compression_t compress = kCompUnknown; … … 346 344 347 345 cols[id] = col; 348 sorted Cols.push_back(col);346 sorted_cols.push_back(col); 349 347 bytes += n*size; 350 348 } … … 988 986 bool HasColumn(const string& col) const { return fTable.HasColumn(col);} 989 987 const Table::Columns &GetColumns() const { return fTable.GetColumns();} 990 const Table::SortedColumns& GetSortedColumns() const { return fTable.sorted Cols;}988 const Table::SortedColumns& GetSortedColumns() const { return fTable.sorted_cols;} 991 989 const Table::Keys &GetKeys() const { return fTable.GetKeys();} 992 990 … … 1012 1010 bool IsFileOk() const { return (fChkHeader+fChkData).valid(); } 1013 1011 1014 bool IsCompressedFITS() const { return fTable.is Compressed;}1012 bool IsCompressedFITS() const { return fTable.is_compressed;} 1015 1013 }; 1016 1014 -
trunk/Mars/mcore/zfits.h
r16888 r16890 63 63 bool SkipNextRow() 64 64 { 65 if (!fTable.is Compressed)65 if (!fTable.is_compressed) 66 66 return fits::SkipNextRow(); 67 67 … … 76 76 virtual void StageRow(size_t row, char* dest) 77 77 { 78 if (!fTable.is Compressed)78 if (!fTable.is_compressed) 79 79 { 80 80 fits::StageRow(row, dest); … … 122 122 void InitCompressionReading() 123 123 { 124 if (!fTable.is Compressed)124 if (!fTable.is_compressed) 125 125 return; 126 126 … … 129 129 return; 130 130 131 if (fTable.is Compressed)132 { 133 for (auto it=fTable.sorted Cols.begin(); it!= fTable.sortedCols.end(); it++)131 if (fTable.is_compressed) 132 { 133 for (auto it=fTable.sorted_cols.begin(); it!= fTable.sorted_cols.end(); it++) 134 134 { 135 135 if (it->comp == kCompFACT) … … 146 146 } 147 147 148 fColumnOrdering.resize(fTable.sorted Cols.size());148 fColumnOrdering.resize(fTable.sorted_cols.size()); 149 149 for (auto it=fColumnOrdering.begin(); it != fColumnOrdering.end(); it++) 150 150 (*it) = kOrderByRow; 151 151 //Get compressed specific keywords 152 fNumTiles = fTable.is Compressed ? GetInt("NAXIS2") : 0;153 fNumRowsPerTile = fTable.is Compressed ? GetInt("ZTILELEN") : 0;152 fNumTiles = fTable.is_compressed ? GetInt("NAXIS2") : 0; 153 fNumRowsPerTile = fTable.is_compressed ? GetInt("ZTILELEN") : 0; 154 154 155 155 //give it some space for uncompressing … … 166 166 void MoveColumnDataToUserSpace(char* dest, const char* src, const Table::Column& c) 167 167 { 168 if (!fTable.is Compressed)168 if (!fTable.is_compressed) 169 169 { 170 170 fits::MoveColumnDataToUserSpace(dest, src, c); … … 334 334 335 335 uint32_t i=0; 336 for (auto it=fTable.sorted Cols.begin(); it!=fTable.sortedCols.end(); it++, i++)336 for (auto it=fTable.sorted_cols.begin(); it!=fTable.sorted_cols.end(); it++, i++) 337 337 { 338 338 char *buffer = fBuffer.data() + it->offset; // pointer to column (destination buffer) … … 433 433 434 434 //uncompress column by column 435 for (uint32_t i=0; i<fTable.sorted Cols.size(); i++)436 { 437 const fits::Table::Column &col = fTable.sorted Cols[i];435 for (uint32_t i=0; i<fTable.sorted_cols.size(); i++) 436 { 437 const fits::Table::Column &col = fTable.sorted_cols[i]; 438 438 if (col.num == 0) 439 439 continue; … … 524 524 { 525 525 //zero sized column do not have headers. Skip it 526 if (fTable.sorted Cols[i].num == 0)526 if (fTable.sorted_cols[i].num == 0) 527 527 { 528 528 catalog.back().push_back(make_pair(0,0));
Note:
See TracChangeset
for help on using the changeset viewer.