Changeset 17777
- Timestamp:
- 05/05/14 09:44:50 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/fits.h
r17750 r17777 23 23 #endif 24 24 25 #ifndef __MARS__ 25 #if defined(__MARS__) || defined(__CINT__) 26 #include "MLog.h" 27 #include "MLogManip.h" 28 #define ___err___ err 29 #define ___warn___ warn 30 #define ___all___ all 31 #else 26 32 #include <vector> 27 33 #include <iomanip> … … 33 39 #define ___all___ "" 34 40 #endif 35 #else36 #include "MLog.h"37 #include "MLogManip.h"38 #define ___err___ err39 #define ___warn___ warn40 #define ___all___ all41 41 #endif 42 42 … … 49 49 #endif 50 50 51 #include "FITS.h" 51 52 #include "checksum.h" 52 53 … … 171 172 Keys ParseBlock(const std::vector<std::string> &vec) const 172 173 { 173 std::map<std::string,Entry>rc;174 Keys rc; 174 175 175 176 for (unsigned int i=0; i<vec.size(); i++) … … 203 204 // Set value, comment and type 204 205 // comments could be just spaces. take care of this. 205 if (ppp!=std::string::npos && val.size() !=ppp+1)206 if (ppp!=std::string::npos && val.size()!=ppp+1) 206 207 com = Trim(val.substr(ppp+1)); 207 208 … … 213 214 const size_t p = val.find_first_of('/'); 214 215 215 if ( val.size() !=p+1)216 if (p!=std::string::npos && val.size()!=p+1) 216 217 com = Trim(val.substr(p+2)); 217 218 … … 265 266 num_rows = is_compressed ? Get<size_t>("ZNAXIS2") : Get<size_t>("NAXIS2"); 266 267 num_cols = Get<size_t>("TFIELDS"); 267 datasum = is_compressed ? Get<int64_t>("DATASUM", -1) : Get<int64_t>("DATASUM", -1); 268 //cout << "IS COMPRESSED =-========= " << is_compressed << " " << Get<size_t>("NAXIS1") << endl; 268 datasum = Get<int64_t>("DATASUM", -1); 269 269 size_t bytes = 0; 270 270 … … 329 329 330 330 cols[id] = col; 331 sorted_cols. push_back(col);331 sorted_cols.emplace_back(col); 332 332 bytes += n*size; 333 333 } … … 353 353 for (Keys::const_iterator it=keys.cbegin(); it!=keys.cend(); it++) 354 354 { 355 if (!display_all && 356 (it->first.substr(0, 6)=="TTYPE" || 357 it->first.substr(0, 6)=="TFORM" || 358 it->first.substr(0, 6)=="TUNIT" || 359 it->first=="TFIELDS" || 360 it->first=="XTENSION" || 361 it->first=="NAXIS" || 362 it->first=="BITPIX" || 363 it->first=="PCOUNT" || 364 it->first=="GCOUNT") 365 ) 355 if (!display_all && FITS::IsReservedKeyWord(it->first)) 366 356 continue; 367 357 368 358 gLog << ___all___ << std::setw(2) << it->second.type << '|' << it->first << '=' << it->second.value << '/' << it->second.comment << '|' << std::endl; 369 }} 359 } 360 } 370 361 371 362 void PrintColumns() const … … 423 414 T Get(const std::string &key) const 424 415 { 425 const std::map<std::string,Entry>::const_iterator it = keys.find(key);416 const Keys::const_iterator it = keys.find(key); 426 417 if (it==keys.end()) 427 418 { … … 442 433 T Get(const std::string &key, const T &deflt) const 443 434 { 444 const std::map<std::string,Entry>::const_iterator it = keys.find(key);435 const Keys::const_iterator it = keys.find(key); 445 436 return it==keys.end() ? deflt :it->second.Get<T>(); 446 437 } … … 543 534 } 544 535 545 vec. push_back(str);536 vec.emplace_back(str); 546 537 } 547 538 … … 1023 1014 operator bool() const { return fTable && fTable.offset!=0; } 1024 1015 1025 void PrintKeys( ) const { fTable.PrintKeys(); }1016 void PrintKeys(bool all_keys=false) const { fTable.PrintKeys(all_keys); } 1026 1017 void PrintColumns() const { fTable.PrintColumns(); } 1027 1018
Note:
See TracChangeset
for help on using the changeset viewer.