- Timestamp:
- 03/08/13 17:58:53 (12 years ago)
- Location:
- trunk/external-alma/atnf/PKSIO
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/atnf/PKSIO/ASTEDataset.cc
r2783 r2785 35 35 #include <iostream> 36 36 #include <cstring> 37 38 #define STRING2CHAR(s) const_cast<char *>((s).c_str()) 37 39 38 40 using namespace std ; … … 79 81 int arymax = arrayMax(); 80 82 81 string str120( 120, ' ' ) ;82 char c120[120] ;83 83 // make sure file pointer points a beginning of the file 84 84 fseek( fp_, 0, SEEK_SET ) ; … … 87 87 88 88 // specific part 89 strcpy( c120, str120.c_str() );90 if ( readHeader( c120, 116 ) == -1 ) {89 CDMY1.resize(116); 90 if ( readHeader( STRING2CHAR(CDMY1), 116 ) == -1 ) { 91 91 os << LogIO::WARN << "Error while reading data CDMY1." << LogIO::POST ; 92 92 return -1 ; 93 93 } 94 c120[116] = '\0' ;95 CDMY1 = string( c120 ) ;96 94 // DEBUG 97 95 //cout << "CDMY1 = " << CDMY1 << endl ; -
trunk/external-alma/atnf/PKSIO/NRODataset.cc
r2783 r2785 46 46 #include <fstream> 47 47 48 #define STRING2CHAR(s) const_cast<char *>((s).c_str()) 49 48 50 //#include <casa/namespace.h> 49 51 … … 195 197 } 196 198 197 // //scanNum_ = NSCAN + 1 ; // includes ZERO scan198 // scanLen_ = SCNLEN ;199 // dataLen_ = scanLen_ - SCAN_HEADER_SIZE ;200 // scanNum_ = getScanNum();201 // rowNum_ = scanNum_ * ARYNM ;202 // chmax_ = (int) ( dataLen_ * 8 / IBIT ) ;203 // record_->LDATA = new char[dataLen_] ;204 205 199 initArray(); 206 200 … … 215 209 216 210 int arymax = arrayMax() ; 217 218 string str4( 4, ' ' ) ;219 string str8( 8, ' ' ) ;220 string str16( 16, ' ' ) ;221 string str18( 18, ' ' ) ;222 string str24( 24, ' ' ) ;223 string str40( 40, ' ' ) ;224 string str120( 120, ' ' ) ;225 char c4[4] ;226 char c8[8] ;227 char c16[16] ;228 char c18[18] ;229 char c24[24] ;230 char c40[40] ;231 char c120[120] ;232 211 233 212 // make sure file pointer points a beginning of the file … … 235 214 236 215 // read data header 237 strcpy( c8, str8.c_str() );238 if ( readHeader( c8, 8 ) == -1 ) {216 LOFIL.resize(8); 217 if ( readHeader( STRING2CHAR(LOFIL), 8 ) == -1 ) { 239 218 os << LogIO::WARN << "Error while reading data LOFIL." << LogIO::POST ; 240 219 return -1 ; 241 220 } 242 LOFIL = string( c8 ) ;243 221 // DEBUG 244 222 //cout << "LOFIL = " << LOFIL << endl ; 245 223 // 246 strcpy( c8, str8.c_str() );247 if ( readHeader( c8, 8 ) == -1 ) {224 VER.resize(8); 225 if ( readHeader( STRING2CHAR(VER), 8 ) == -1 ) { 248 226 os << LogIO::WARN << "Error while reading data VER." << LogIO::POST ; 249 227 return -1 ; 250 228 } 251 VER = string( c8 ) ;252 229 // DEBUG 253 230 //cout << "VER = " << VER << endl ; 254 231 // 255 strcpy( c16, str16.c_str() );256 if ( readHeader( c16, 16 ) == -1 ) {232 GROUP.resize(16); 233 if ( readHeader( STRING2CHAR(GROUP), 16 ) == -1 ) { 257 234 os << LogIO::WARN << "Error while reading data GROUP." << LogIO::POST ; 258 235 return -1 ; 259 236 } 260 GROUP = string( c16 ) ;261 237 // DEBUG 262 238 //cout << "GROUP = " << GROUP << endl ; 263 239 // 264 strcpy( c16, str16.c_str() );265 if ( readHeader( c16, 16 ) == -1 ) {240 PROJ.resize(16); 241 if ( readHeader( STRING2CHAR(PROJ), 16 ) == -1 ) { 266 242 os << LogIO::WARN << "Error while reading data PROJ." << LogIO::POST ; 267 243 return -1 ; 268 244 } 269 PROJ = string( c16 ) ;270 245 // DEBUG 271 246 //cout << "PROJ = " << PROJ << endl ; 272 247 // 273 strcpy( c24, str24.c_str() );274 if ( readHeader( c24, 24 ) == -1 ) {248 SCHED.resize(24); 249 if ( readHeader( STRING2CHAR(SCHED), 24 ) == -1 ) { 275 250 os << LogIO::WARN << "Error while reading data SCHED." << LogIO::POST ; 276 251 return -1 ; 277 252 } 278 SCHED = string( c24 ) ;279 253 // DEBUG 280 254 //cout << "SCHED = " << SCHED << endl ; 281 255 // 282 strcpy( c40, str40.c_str() );283 if ( readHeader( c40, 40 ) == -1 ) {256 OBSVR.resize(40); 257 if ( readHeader( STRING2CHAR(OBSVR), 40 ) == -1 ) { 284 258 os << LogIO::WARN << "Error while reading data OBSVR." << LogIO::POST ; 285 259 return -1 ; 286 260 } 287 OBSVR = string( c40 ) ;288 261 // DEBUG 289 262 //cout << "OBSVR = " << OBSVR << endl ; 290 263 // 291 strcpy( c16, str16.c_str() );292 if ( readHeader( c16, 16 ) == -1 ) {264 LOSTM.resize(16); 265 if ( readHeader( STRING2CHAR(LOSTM), 16 ) == -1 ) { 293 266 os << LogIO::WARN << "Error while reading data LOSTM." << LogIO::POST ; 294 267 return -1 ; 295 268 } 296 LOSTM = string( c16 ) ;297 269 // DEBUG 298 270 //cout << "LOSTM = " << LOSTM << endl ; 299 271 // 300 strcpy( c16, str16.c_str() );301 if ( readHeader( c16, 16 ) == -1 ) {272 LOETM.resize(16); 273 if ( readHeader( STRING2CHAR(LOETM), 16 ) == -1 ) { 302 274 os << LogIO::WARN << "Error while reading data LOETM." << LogIO::POST ; 303 275 return -1 ; 304 276 } 305 LOETM = string( c16 ) ;306 277 // DEBUG 307 278 //cout << "LOETM = " << LOETM << endl ; … … 321 292 //cout << "NSCAN = " << NSCAN << endl ; 322 293 // 323 strcpy( c120, str120.c_str() );324 if ( readHeader( c120, 120 ) == -1 ) {294 TITLE.resize(120); 295 if ( readHeader( STRING2CHAR(TITLE), 120 ) == -1 ) { 325 296 os << LogIO::WARN << "Error while reading data TITLE." << LogIO::POST ; 326 297 return -1 ; 327 298 } 328 TITLE = string( c120 ) ;329 299 // DEBUG 330 300 //cout << "TITLE = " << TITLE << endl ; 331 301 // 332 strcpy( c16, str16.c_str() );333 if ( readHeader( c16, 16 ) == -1 ) {302 OBJ.resize(16); 303 if ( readHeader( STRING2CHAR(OBJ), 16 ) == -1 ) { 334 304 os << LogIO::WARN << "Error while reading data OBJ." << LogIO::POST ; 335 305 return -1 ; 336 306 } 337 OBJ = string( c16 ) ;338 307 // DEBUG 339 308 //cout << "OBJ = " << OBJ << endl ; 340 309 // 341 strcpy( c8, str8.c_str() );342 if ( readHeader( c8, 8 ) == -1 ) {310 EPOCH.resize(8); 311 if ( readHeader( STRING2CHAR(EPOCH), 8 ) == -1 ) { 343 312 os << LogIO::WARN << "Error while reading data EPOCH." << LogIO::POST ; 344 313 return -1 ; 345 314 } 346 EPOCH = string( c8 ) ;347 315 // DEBUG 348 316 //cout << "EPOCH = " << EPOCH << endl ; … … 390 358 //cout << "SCNCD = " << SCNCD << endl ; 391 359 // 392 strcpy( c120, str120.c_str() );393 if ( readHeader( c120, 120 ) == -1 ) {360 SCMOD.resize(120); 361 if ( readHeader( STRING2CHAR(SCMOD), 120 ) == -1 ) { 394 362 os << LogIO::WARN << "Error while reading data SCMOD." << LogIO::POST ; 395 363 return -1 ; 396 364 } 397 SCMOD = string( c120 ) ;398 365 // DEBUG 399 366 //cout << "SCMOD = " << SCMOD << endl ; … … 406 373 //cout << "URVEL = " << URVEL << endl ; 407 374 // 408 strcpy( c4, str4.c_str() );409 if ( readHeader( c4, 4 ) == -1 ) {375 VREF.resize(4); 376 if ( readHeader( STRING2CHAR(VREF), 4 ) == -1 ) { 410 377 os << LogIO::WARN << "Error while reading data VREF." << LogIO::POST ; 411 378 return -1 ; 412 379 } 413 VREF = string( c4 ) ;414 380 // DEBUG 415 381 //cout << "VREF = " << VREF << endl ; 416 382 // 417 strcpy( c4, str4.c_str() );418 if ( readHeader( c4, 4 ) == -1 ) {383 VDEF.resize(4); 384 if ( readHeader( STRING2CHAR(VDEF), 4 ) == -1 ) { 419 385 os << LogIO::WARN << "Error while reading data VDEF." << LogIO::POST ; 420 386 return -1 ; 421 387 } 422 VDEF = string( c4 ) ;423 388 // DEBUG 424 389 //cout << "VDEF = " << VDEF << endl ; 425 390 // 426 strcpy( c8, str8.c_str() );427 if ( readHeader( c8, 8 ) == -1 ) {391 SWMOD.resize(8); 392 if ( readHeader( STRING2CHAR(SWMOD), 8 ) == -1 ) { 428 393 os << LogIO::WARN << "Error while reading data SWMOD." << LogIO::POST ; 429 394 return -1 ; 430 395 } 431 SWMOD = string( c8 ) +"::OTF" ;396 SWMOD += "::OTF" ; 432 397 // DEBUG 433 398 //cout << "SWMOD = " << SWMOD << endl ; … … 489 454 //cout << "CMTI = " << CMTI << endl ; 490 455 // 491 strcpy( c24, str24.c_str() );492 if ( readHeader( c24, 24 ) == -1 ) {456 CMTTM.resize(24); 457 if ( readHeader( STRING2CHAR(CMTTM), 24 ) == -1 ) { 493 458 os << LogIO::WARN << "Error while reading data CMTTM." << LogIO::POST ; 494 459 return -1 ; 495 460 } 496 CMTTM = string( c24 ) ;497 461 // DEBUG 498 462 //cout << "CMTTM = " << CMTTM << endl ; … … 590 554 // 591 555 for ( int i = 0 ; i < arymax ; i++ ) { 592 strcpy( c18, str18.c_str() );593 if ( readHeader( c18, 16 ) == -1 ) {556 RX[i].resize(16); 557 if ( readHeader( STRING2CHAR(RX[i]), 16 ) == -1 ) { 594 558 os << LogIO::WARN << "Error while reading data RX[" << i << "]." << LogIO::POST ; 595 559 return -1 ; 596 560 } 597 c18[16] = '\0' ;598 RX[i] = string( c18 ) ;599 561 } 600 562 // DEBUG … … 656 618 // 657 619 for ( int i = 0 ; i < arymax ; i++) { 658 strcpy( c4, str4.c_str() );659 if ( readHeader( c4, 4 ) == -1 ) {620 HORN[i].resize(4); 621 if ( readHeader( STRING2CHAR(HORN[i]), 4 ) == -1 ) { 660 622 os << LogIO::WARN << "Error while reading data HORN[" << i << "]." << LogIO::POST ; 661 623 return -1 ; 662 624 } 663 HORN[i] = string( c4 ) ;664 625 } 665 626 // DEBUG … … 667 628 // 668 629 for ( int i = 0 ; i < arymax ; i++) { 669 strcpy( c4, str4.c_str() );670 if ( readHeader( c4, 4 ) == -1 ) {630 POLTP[i].resize(4); 631 if ( readHeader( STRING2CHAR(POLTP[i]), 4 ) == -1 ) { 671 632 os << LogIO::WARN << "Error while reading data POLTP[" << i << "]." << LogIO::POST ; 672 633 return -1 ; 673 634 } 674 POLTP[i] = string( c4 ) ;675 635 } 676 636 // DEBUG … … 705 665 // 706 666 for ( int i = 0 ; i < arymax ; i++) { 707 strcpy( c4, str4.c_str() );708 if ( readHeader( c4, 4 ) == -1 ) {667 SIDBD[i].resize(4); 668 if ( readHeader( STRING2CHAR(SIDBD[i]), 4 ) == -1 ) { 709 669 os << LogIO::WARN << "Error while reading data SIDBD[" << i << "]." << LogIO::POST ; 710 670 return -1 ; 711 671 } 712 SIDBD[i] = string( c4 ) ;713 672 } 714 673 // DEBUG … … 752 711 // 753 712 for ( int i = 0 ; i < arymax ; i++) { 754 strcpy( c8, str8.c_str() );755 if ( readHeader( c8, 8 ) == -1 ) {713 LAGWIND[i].resize(8); 714 if ( readHeader( STRING2CHAR(LAGWIND[i]), 8 ) == -1 ) { 756 715 os << LogIO::WARN << "Error while reading data LAGWIND[" << i << "]." << LogIO::POST ; 757 716 return -1 ; 758 717 } 759 LAGWIND[i] = string( c8 ) ;760 718 } 761 719 // DEBUG … … 870 828 //cout << "IBIT = " << IBIT << endl ; 871 829 // 872 strcpy( c8, str8.c_str() );873 if ( readHeader( c8, 8 ) == -1 ) {830 SITE.resize(8); 831 if ( readHeader( STRING2CHAR(SITE), 8 ) == -1 ) { 874 832 os << LogIO::WARN << "Error while reading data SITE." << LogIO::POST ; 875 833 return -1 ; 876 834 } 877 SITE = string( c8 ) ;878 835 // DEBUG 879 836 //cout << "SITE = " << SITE << endl ; -
trunk/external-alma/atnf/PKSIO/NROOTFDataset.cc
r2783 r2785 35 35 #include <iostream> 36 36 #include <cstring> 37 38 #define STRING2CHAR(s) const_cast<char *>((s).c_str()) 37 39 38 40 using namespace std ; … … 80 82 LogIO os( LogOrigin( "NROOTFDataset", "fillHeader()", WHERE ) ) ; 81 83 82 int arymax = arrayMax() ;83 84 string str256( 256, ' ' ) ;85 char c256[256] ;86 84 // make sure file pointer points a beginning of the file 87 85 fseek( fp_, 0, SEEK_SET ) ; … … 90 88 91 89 // specific part 92 strcpy( c256, str256.c_str() );93 if ( readHeader( c256, 180 ) == -1 ) {90 CDMY1.resize(180); 91 if ( readHeader( STRING2CHAR(CDMY1), 180 ) == -1 ) { 94 92 os << LogIO::WARN << "Error while reading data CDMY1." << LogIO::POST ; 95 93 return -1 ; 96 94 } 97 c256[180] = '\0' ;98 CDMY1 = string( c256 ) ;99 95 // DEBUG 100 96 //cout << "CDMY1 = " << CDMY1 << endl ;
Note:
See TracChangeset
for help on using the changeset viewer.