Changeset 3097 for trunk/external-alma/atnf/PKSIO
- Timestamp:
- 03/29/16 19:56:26 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/atnf/PKSIO/NROReader.cc
r3066 r3097 56 56 57 57 using namespace std ; 58 59 namespace { 60 // to limit template argument to specified type 61 template<class T> 62 constexpr inline bool type_guard() { 63 return false; 64 } 65 template<> 66 constexpr inline bool type_guard<string>() { 67 return true; 68 } 69 template<> 70 constexpr inline bool type_guard<String>() { 71 return true; 72 } 73 74 // T must be std::string or casa::String 75 template<class T> 76 inline String trim_nro_string(T const &s) { 77 static_assert(type_guard<T>(), ""); 78 return s.substr(0, s.find_first_of('\0')); 79 } 80 } 58 81 59 82 // … … 469 492 npol = getPolarizationNum() ; 470 493 //cout << "npol = " << npol << endl ; 471 observer = dataset_->getOBSVR() ;472 //cout << "observer = " << observer<< endl ;473 project = dataset_->getPROJ() ;474 //cout << "project = " << project<< endl ;475 obstype = dataset_->getSWMOD() ;476 //cout << "obstype = " << obstype<< endl ;477 antname = dataset_->getSITE() ;478 //cout << "antname = " << antname<< endl ;494 observer = trim_nro_string(dataset_->getOBSVR()) ; 495 //cout << "observer = \"" << observer << "\" (size " << observer.size() << ")" << endl ; 496 project = trim_nro_string(dataset_->getPROJ()) ; 497 //cout << "project = \"" << project << "\" (size " << project.size() << ")" << endl ; 498 obstype = trim_nro_string(dataset_->getSWMOD()) ; 499 //cout << "obstype = \"" << obstype << "\" (size " << obstype.size() << ")" << endl ; 500 antname = trim_nro_string(dataset_->getSITE()) ; 501 //cout << "antname = \"" << antname << "\" (size " << antname.size() << ")" << endl ; 479 502 // TODO: should be investigated antenna position since there are 480 503 // no corresponding information in the header … … 514 537 //freqref = "LSRK" ; 515 538 //freqref = "REST" ; 516 freqref = freqRefFromVREF_ ? vref : "REST" ;517 //cout << "freqref = " << freqref<< endl ;539 freqref = freqRefFromVREF_ ? trim_nro_string(vref) : "REST" ; 540 //cout << "freqref = \"" << freqref << "\" (size " << freqref.size() << ")" << endl ; 518 541 const NRODataRecord *record = dataset_->getRecord( 0 ) ; 519 542 reffreq = record->FREQ0 ; // rest frequency … … 528 551 epoch = "UTC" ; 529 552 //cout << "epoch = " << epoch << endl ; 530 string poltp = dataset_->getPOLTP()[0];531 //cout << "poltp = '" << poltp << "'" << endl ;553 string poltp = trim_nro_string(dataset_->getPOLTP()[0]) ; 554 //cout << "poltp = \"" << poltp << "\" (size " << poltp.size() << ")" << endl ; 532 555 if ( poltp.empty() || poltp[0] == ' ' || poltp[0] == '\0' ) 533 556 //poltp = "None" ; … … 660 683 661 684 // srcname 662 srcname = String( dataset_->getOBJ() ) ;663 //cout << "srcname = " << srcname<< endl ;685 srcname = trim_nro_string( dataset_->getOBJ() ) ; 686 //cout << "srcname = \"" << srcname << "\" (size " << srcname.size() << ")" << endl ; 664 687 665 688 // fieldname 666 fieldname = String( dataset_->getOBJ() ) ;667 //cout << "fieldname = " << fieldname<< endl ;689 fieldname = trim_nro_string( dataset_->getOBJ() ) ; 690 //cout << "fieldname = \"" << fieldname << "\" (size " << fieldname.size() << ")" << endl ; 668 691 669 692 // spectra
Note:
See TracChangeset
for help on using the changeset viewer.