Ignore:
Timestamp:
08/07/09 15:49:27 (15 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-729, CAS-1147

Ready to Release: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Use LogIO instead of std::cout and std::cerr.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/src/STFiller.cpp

    r1603 r1616  
    3535#include <casa/System/ProgressMeter.h>
    3636#include <atnf/PKSIO/NROReader.h>
     37#include <casa/Logging/LogIO.h>
    3738
    3839#include <time.h>
     
    470471  time( &t0 ) ;
    471472  tm *ttm = localtime( &t0 ) ;
    472  
    473   cout << "STFiller::openNRO()  Start time = " << t0
    474        << " ("
    475        << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday
    476        << " "
    477        << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec
    478        << ")" << endl ;
     473  LogIO os( LogOrigin( "STFiller", "openNRO()", WHERE ) ) ;
     474//   cout << "STFiller::openNRO()  Start time = " << t0
     475//        << " ("
     476//        << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday
     477//        << " "
     478//        << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec
     479//        << ")" << endl ;
     480  os << "Start time = " << t0
     481     << " ("
     482     << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday
     483     << " "
     484     << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec
     485     << ")" << LogIO::POST ;
    479486
    480487  // fill STHeader
     
    498505                                header_->epoch,
    499506                                header_->poltype ) ) {
    500     cout << "STFiller::openNRO()  Failed to get header information." << endl ;
    501     return ;
     507//     cout << "STFiller::openNRO()  Failed to get header information." << endl ;
     508//     return ;
     509    throw( AipsError("Failed to get header information.") ) ;
    502510  }
    503511
     
    526534  }
    527535
    528   // DEBUG
    529   //cout << "STFiller::openNRO()  nIF " << endl ;
    530   //
    531 
    532536  beamOffset_ = 0;
    533537  vector<Bool> beams = nreader_->getBeams() ;
     
    549553  }
    550554
    551   // DEBUG
    552   //cout << "STFiller::openNRO()  nBeam " << endl ;
    553   //
    554 
    555555  header_->nbeam = nBeam_ ;
    556556  header_->nif = nIF_ ;
     
    558558  // set header
    559559  table_->setHeader( *header_ ) ;
    560 
    561   // DEBUG
    562   //cout << "STFiller::openNRO() Velocity Definition = " << nheader->getVDEF() << endl ;
    563560
    564561  // DEBUG
     
    566563  time( &t1 ) ;
    567564  ttm = localtime( &t1 ) ;
    568   cout << "STFiller::openNRO()  End time = " << t1
    569        << " ("
    570        << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday
    571        << " "
    572        << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec
    573        << ")" << endl ;
    574   cout << "STFiller::openNRO()  Elapsed time = " << t1 - t0 << " sec" << endl ;
     565//   cout << "STFiller::openNRO()  End time = " << t1
     566//        << " ("
     567//        << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday
     568//        << " "
     569//        << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec
     570//        << ")" << endl ;
     571//   cout << "STFiller::openNRO()  Elapsed time = " << t1 - t0 << " sec" << endl ;
     572  os << "End time = " << t1
     573     << " ("
     574     << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday
     575     << " "
     576     << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec
     577     << ")" << endl ;
     578  os << "Elapsed time = " << t1 - t0 << " sec" << endl ;
     579  os.post() ;
    575580  //
    576581
     
    584589  time( &t0 ) ;
    585590  tm *ttm = localtime( &t0 ) ;
    586   cout << "STFiller::readNRO()  Start time = " << t0
    587        << " ("
    588        << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday
    589        << " "
    590        << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec
    591        << ")" << endl ;
     591  LogIO os( LogOrigin( "STFiller", "readNRO()", WHERE ) ) ;
     592//   cout << "STFiller::readNRO()  Start time = " << t0
     593//        << " ("
     594//        << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday
     595//        << " "
     596//        << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec
     597//        << ")" << endl ;
     598  os << "Start time = " << t0
     599     << " ("
     600     << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday
     601     << " "
     602     << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec
     603     << ")" << LogIO::POST ;
    592604  //
    593605
     
    630642  Array<Double> scanrate ;
    631643  for ( i = 0 ; i < imax ; i++ ) {
    632 //     if( nreader_->getDataset()->getRecord( i ) == NULL ) {
    633 //       cerr << "STFiller::readNRO()  error while reading row " << i << endl ;
    634 //       return -1 ;
    635 //     }
    636 
    637644    string scanType = nreader_->getScanType( i ) ;
    638645    Int srcType = -1 ;
    639646    if ( scanType.compare( 0, 2, "ON") == 0 ) {
    640       // cout << "ON srcType: " << i << endl ;
     647      // os << "ON srcType: " << i << LogIO::POST ;
    641648      srcType = 0 ;
    642649    }
    643650    else if ( scanType.compare( 0, 3, "OFF" ) == 0 ) {
    644       //cout << "OFF srcType: " << i << endl ;
     651      //os << "OFF srcType: " << i << LogIO::POST ;
    645652      srcType = 1 ;
    646653    }
    647654    else if ( scanType.compare( 0, 4, "ZERO" ) == 0 ) {
    648       //cout << "ZERO srcType: " << i << endl ;
     655      //os << "ZERO srcType: " << i << LogIO::POST ;
    649656      srcType = 2 ;
    650657    }
    651658    else {
    652       //cout << "Undefined srcType: " << i << endl ;
     659      //os << "Undefined srcType: " << i << LogIO::POST ;
    653660      srcType = 3 ;
    654661    }
     
    691698                                  srcdir,
    692699                                  scanrate ) ) {
    693         cerr << "STFiller::readNRO()  Failed to get scan information." << endl ;
    694         return 1 ;
     700//         cerr << "STFiller::readNRO()  Failed to get scan information." << endl ;
     701//         return 1 ;
     702        throw( AipsError("Failed to get scan information.") ) ;
    695703      }
    696704
     
    716724        int iadd = -1 ;
    717725        for ( uInt iif = 0 ; iif < freqs.size() ; iif++ ) {
    718           //cout << "STFiller::readNRO()  freqs[" << iif << "][1] = " << freqs[iif][1] << endl ;
     726          //os << "freqs[" << iif << "][1] = " << freqs[iif][1] << LogIO::POST ;
    719727          double fdiff = abs( freqs[iif][1] - fqs[1] ) / freqs[iif][1] ;
    720           //cout << "STFiller::readNRO()  fdiff = " << fdiff << endl ;
     728          //os << "fdiff = " << fdiff << LogIO::POST ;
    721729          if ( fdiff < 1.0e-8 ) {
    722730            iadd = iif ;
     
    798806    // DEBUG
    799807    //int rownum = nreader_->getRowNum() ;
    800     //cout << "STFiller::readNRO() Finished row " << i << "/" << rownum << endl ;
     808    //os << "Finished row " << i << "/" << rownum << LogIO::POST ;
    801809    //
    802810  }
     
    806814  time( &t1 ) ;
    807815  ttm = localtime( &t1 ) ;
    808   cout << "STFiller::readNRO()  Processed " << i << " rows" << endl ;
    809   cout << "STFiller::readNRO()  Added " << i - count << " rows (ignored "
    810        << count << " \"ZERO\" scans)" << endl ;
    811   cout << "STFiller::readNRO()  End time = " << t1
    812        << " ("
    813        << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday
    814        << " "
    815        << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec
    816        << ")" << endl ;
    817   cout << "STFiller::readNRO()  Elapsed time = " << t1 - t0 << " sec" << endl ;
     816//   cout << "STFiller::readNRO()  Processed " << i << " rows" << endl ;
     817//   cout << "STFiller::readNRO()  Added " << i - count << " rows (ignored "
     818//        << count << " \"ZERO\" scans)" << endl ;
     819//   cout << "STFiller::readNRO()  End time = " << t1
     820//        << " ("
     821//        << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday
     822//        << " "
     823//        << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec
     824//        << ")" << endl ;
     825//   cout << "STFiller::readNRO()  Elapsed time = " << t1 - t0 << " sec" << endl ;
     826  os << "Processed " << i << " rows" << endl ;
     827  os << "Added " << i - count << " rows (ignored "
     828     << count << " \"ZERO\" scans)" << endl ;
     829  os.post() ;
     830  os << "End time = " << t1
     831     << " ("
     832     << ttm->tm_year + 1900 << "/" << ttm->tm_mon + 1 << "/" << ttm->tm_mday
     833     << " "
     834     << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec
     835     << ")" << endl ;
     836  os << "Elapsed time = " << t1 - t0 << " sec" << endl ;
     837  os.post() ;
    818838  //
    819839
Note: See TracChangeset for help on using the changeset viewer.