Changeset 2766 for trunk/external-alma
- Timestamp:
- 02/07/13 18:08:16 (12 years ago)
- Location:
- trunk/external-alma/atnf/PKSIO
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/atnf/PKSIO/NRODataset.cc
r2765 r2766 187 187 } 188 188 189 void NRODataset::convertEndian( NRODataRecord *r )190 { 191 convertEndian( r ->ISCAN ) ;192 convertEndian( r ->DSCX ) ;193 convertEndian( r ->DSCY ) ;194 convertEndian( r ->SCX ) ;195 convertEndian( r ->SCY ) ;196 convertEndian( r ->PAZ ) ;197 convertEndian( r ->PEL ) ;198 convertEndian( r ->RAZ ) ;199 convertEndian( r ->REL ) ;200 convertEndian( r ->XX ) ;201 convertEndian( r ->YY ) ;202 convertEndian( r ->TEMP ) ;203 convertEndian( r ->PATM ) ;204 convertEndian( r ->PH2O ) ;205 convertEndian( r ->VWIND ) ;206 convertEndian( r ->DWIND ) ;207 convertEndian( r ->TAU ) ;208 convertEndian( r ->TSYS ) ;209 convertEndian( r ->BATM ) ;210 convertEndian( r ->LINE ) ;189 void NRODataset::convertEndian( NRODataRecord &r ) 190 { 191 convertEndian( r.ISCAN ) ; 192 convertEndian( r.DSCX ) ; 193 convertEndian( r.DSCY ) ; 194 convertEndian( r.SCX ) ; 195 convertEndian( r.SCY ) ; 196 convertEndian( r.PAZ ) ; 197 convertEndian( r.PEL ) ; 198 convertEndian( r.RAZ ) ; 199 convertEndian( r.REL ) ; 200 convertEndian( r.XX ) ; 201 convertEndian( r.YY ) ; 202 convertEndian( r.TEMP ) ; 203 convertEndian( r.PATM ) ; 204 convertEndian( r.PH2O ) ; 205 convertEndian( r.VWIND ) ; 206 convertEndian( r.DWIND ) ; 207 convertEndian( r.TAU ) ; 208 convertEndian( r.TSYS ) ; 209 convertEndian( r.BATM ) ; 210 convertEndian( r.LINE ) ; 211 211 for ( int i = 0 ; i < 4 ; i++ ) 212 convertEndian( r ->IDMY1[i] ) ;213 convertEndian( r ->VRAD ) ;214 convertEndian( r ->FREQ0 ) ;215 convertEndian( r ->FQTRK ) ;216 convertEndian( r ->FQIF1 ) ;217 convertEndian( r ->ALCV ) ;212 convertEndian( r.IDMY1[i] ) ; 213 convertEndian( r.VRAD ) ; 214 convertEndian( r.FREQ0 ) ; 215 convertEndian( r.FQTRK ) ; 216 convertEndian( r.FQIF1 ) ; 217 convertEndian( r.ALCV ) ; 218 218 for ( int i = 0 ; i < 2 ; i++ ) 219 219 for ( int j = 0 ; j < 2 ; j++ ) 220 convertEndian( r ->OFFCD[i][j] ) ;221 convertEndian( r ->IDMY0 ) ;222 convertEndian( r ->IDMY2 ) ;223 convertEndian( r ->DPFRQ ) ;224 convertEndian( r ->SFCTR ) ;225 convertEndian( r ->ADOFF ) ;220 convertEndian( r.OFFCD[i][j] ) ; 221 convertEndian( r.IDMY0 ) ; 222 convertEndian( r.IDMY2 ) ; 223 convertEndian( r.DPFRQ ) ; 224 convertEndian( r.SFCTR ) ; 225 convertEndian( r.ADOFF ) ; 226 226 } 227 227 228 228 void NRODataset::releaseRecord() 229 229 { 230 if ( record_) {230 if ( !record_.null() ) { 231 231 record_ = NULL ; 232 232 } … … 248 248 249 249 if ( i == dataid_ ) { 250 return record_;250 return &(*record_) ; 251 251 } 252 252 … … 267 267 } 268 268 269 return record_;269 return &(*record_) ; 270 270 } 271 271 … … 285 285 //cout << "NRODataset::fillRecord() sizeof(NRODataRecord) = " << sizeof( NRODataRecord ) << " byte" << endl ; 286 286 fseek( fp_, offset, SEEK_SET ) ; 287 if ( (int)fread( record_, 1, SCAN_HEADER_SIZE, fp_ ) != SCAN_HEADER_SIZE ) {287 if ( (int)fread( &(*record_), 1, SCAN_HEADER_SIZE, fp_ ) != SCAN_HEADER_SIZE ) { 288 288 //cerr << "Failed to read scan header: " << i << endl ; 289 289 LogIO os( LogOrigin( "NRODataset", "fillRecord()", WHERE ) ) ; … … 299 299 300 300 if ( same_ == 0 ) { 301 convertEndian( record_ ) ;301 convertEndian( *record_ ) ; 302 302 } 303 303 … … 358 358 // 359 359 360 NRODataRecord *record = getRecord( i ) ;360 const NRODataRecord *record = getRecord( i ) ; 361 361 362 362 const int bit = IBIT ; // fixed to 12 bit … … 467 467 //cout << "NRODataset::getIndex() start" << endl ; 468 468 // 469 NRODataRecord *record = getRecord( irow ) ;470 string str = record->ARRYT ;469 const NRODataRecord *record = getRecord( irow ) ; 470 const string str = record->ARRYT ; 471 471 // DEBUG 472 472 //cout << "NRODataset::getIndex() str = " << str << endl ; … … 541 541 double NRODataset::getStartIntTime( int i ) 542 542 { 543 NRODataRecord *record = getRecord( i ) ;544 545 c har *t = record->LAVST ;543 const NRODataRecord *record = getRecord( i ) ; 544 545 const char *t = record->LAVST ; 546 546 return getMJD( t ) ; 547 547 } 548 548 549 double NRODataset::getMJD( c har *time )549 double NRODataset::getMJD( const char *time ) 550 550 { 551 551 // TODO: should be checked which time zone the time depends on … … 592 592 f[1] = f[1] - f[0] * f[2] ; 593 593 } 594 NRODataRecord *record = getRecord( i ) ;594 const NRODataRecord *record = getRecord( i ) ; 595 595 f[3] = record->FREQ0 ; 596 596 if ( v.size() == 0 ) { … … 629 629 vector<double> v( 3, 0.0 ) ; 630 630 631 NRODataRecord *record = getRecord( i ) ;631 const NRODataRecord *record = getRecord( i ) ; 632 632 string arryt = string( record->ARRYT ) ; 633 633 uInt ib = getArrayId( arryt ) ; -
trunk/external-alma/atnf/PKSIO/NRODataset.h
r2764 r2766 42 42 #include <casa/Logging/LogIO.h> 43 43 #include <casa/Containers/Record.h> 44 #include <casa/Utilities/CountedPtr.h> 44 45 #include <atnf/PKSIO/NRODataRecord.h> 45 46 #include <casa/namespace.h> … … 194 195 virtual double getStartIntTime( int i ) ; 195 196 virtual double getScanTime( int i ) ; 196 virtual double getMJD( c har *time ) ;197 virtual double getMJD( const char *time ) ; 197 198 virtual std::vector<bool> getIFs() ; 198 199 virtual std::vector<double> getFrequencies( int i ) ; … … 214 215 215 216 // Endian conversion for NRODataRecord 216 void convertEndian( NRODataRecord *r ) ;217 void convertEndian( NRODataRecord &r ) ; 217 218 218 219 // Read char data … … 500 501 501 502 // Data record 502 NRODataRecord *record_ ;503 CountedPtr<NRODataRecord> record_ ; 503 504 504 505 // input filename -
trunk/external-alma/atnf/PKSIO/NROFITSDataset.cc
r2763 r2766 1225 1225 vector<double> spec( chmax_, 0.0 ) ; 1226 1226 vector<double> specout( chmax_, 0.0 ) ; 1227 NRODataRecord *record = getRecord( i ) ;1227 const NRODataRecord *record = getRecord( i ) ; 1228 1228 double scale = record->SFCTR ; 1229 1229 double offset = record->ADOFF ; … … 1415 1415 int NROFITSDataset::getIndex( int irow ) 1416 1416 { 1417 NRODataRecord *record = getRecord( irow ) ;1417 const NRODataRecord *record = getRecord( irow ) ; 1418 1418 string str = record->ARRYT ; 1419 1419 string::size_type pos = str.find( " " ) ; -
trunk/external-alma/atnf/PKSIO/NROReader.cc
r2764 r2766 345 345 { 346 346 Vector<Double> v( 2 ) ; 347 NRODataRecord *record = dataset_->getRecord( i ) ;347 const NRODataRecord *record = dataset_->getRecord( i ) ; 348 348 char epoch[5] ; 349 349 strncpy( epoch, (dataset_->getEPOCH()).c_str(), 5 ) ; … … 479 479 freqref = freqRefFromVREF_ ? vref : "REST" ; 480 480 //cout << "freqref = " << freqref << endl ; 481 NRODataRecord *record = dataset_->getRecord( 0 ) ;481 const NRODataRecord *record = dataset_->getRecord( 0 ) ; 482 482 reffreq = record->FREQ0 ; // rest frequency 483 483 … … 520 520 string NROReader::getScanType( int i ) 521 521 { 522 NRODataRecord *record = dataset_->getRecord( i ) ;522 const NRODataRecord *record = dataset_->getRecord( i ) ; 523 523 string s = record->SCANTP ; 524 524
Note:
See TracChangeset
for help on using the changeset viewer.