Changeset 16889 for trunk/Mars/mcore
- Timestamp:
- 06/22/13 15:31:46 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/fits.h
r16882 r16889 71 71 //I know I know, you're going to yiell that this does not belong here. 72 72 //It will belong in the global scope eventually, and it makes the coding of zfits much simpler this way. 73 typedef enum74 { 75 UNKNOWN,76 FACT77 } FitsCompression;73 enum Compression_t 74 { 75 kCompUnknown, 76 kCompFACT 77 }; 78 78 79 79 struct Entry … … 116 116 char type; 117 117 string unit; 118 FitsCompressioncomp;118 Compression_t comp; 119 119 }; 120 120 … … 199 199 string com; 200 200 string val = Trim(vec[i].substr(10)); 201 201 202 if (val[0]=='\'') 202 203 { … … 216 217 217 218 // Set value, comment and type 218 if (ppp==string::npos) 219 com = ""; 220 else 221 {// comments could be just spaces. take care of this. 222 if (val.size() == ppp+1) 223 com = ""; 224 else 225 com = Trim(val.substr(ppp+1)); 226 } 227 // com = ppp==string::npos ? "" : Trim(val.substr(ppp+1)); 219 // comments could be just spaces. take care of this. 220 if (ppp!=string::npos && val.size() != ppp+1) 221 com = Trim(val.substr(ppp+1)); 222 228 223 val = Trim(val.substr(1, p-2)); 229 224 type = 'T'; … … 233 228 const size_t p = val.find_first_of('/'); 234 229 235 if (val.size() == p+1) 236 com = ""; 237 else 230 if (val.size() != p+1) 238 231 com = Trim(val.substr(p+2)); 232 239 233 val = Trim(val.substr(0, p)); 240 234 … … 246 240 247 241 const Entry e = { type, val, com, vec[i] }; 242 248 243 rc[key] = e; 249 244 } … … 253 248 254 249 Table() : offset(0) { } 255 Table(const vector<string> &vec, off_t off) : 256 offset(off),isCompressed(false), keys(ParseBlock(vec))250 Table(const vector<string> &vec, off_t off) : offset(off), 251 isCompressed(false), keys(ParseBlock(vec)) 257 252 { 258 253 if (HasKey("ZTABLE") && Check("ZTABLE", 'B', "T")) … … 289 284 290 285 size_t bytes = 0; 291 string tFormName = isCompressed ? "ZFORM" : "TFORM"; 286 287 const string tFormName = isCompressed ? "ZFORM" : "TFORM"; 292 288 for (size_t i=1; i<=num_cols; i++) 293 289 { … … 304 300 const string comp = Get<string>("ZCTYP"+num.str(), ""); 305 301 306 FitsCompression compress = UNKNOWN;302 Compression_t compress = kCompUnknown; 307 303 if (comp == "FACT") 308 compress = FACT;304 compress = kCompFACT; 309 305 310 306 istringstream sin(fmt); … … 664 660 } 665 661 666 // Check for table name. Skip until eof or requested table are found.662 // Check for table name. Skip until eof or requested table are found. 667 663 // skip the current table? 668 664 if (!tableName.empty() && tableName!=fTable.Get<string>("EXTNAME")) … … 676 672 } 677 673 678 //fTable.PrintKeys();679 680 674 fBufferRow.resize(fTable.bytes_per_row + 8-fTable.bytes_per_row%4); 681 675 fBufferDat.resize(fTable.bytes_per_row);
Note:
See TracChangeset
for help on using the changeset viewer.