Ignore:
Timestamp:
10/04/11 14:15:54 (13 years ago)
Author:
Malte Marquarding
Message:

Ticket #249: scantbable schema was changed. This required an update to scantable version 4. I have added a class STUpgrade to handle all schema upgrades. This is handled transparently in the scantable constructor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Scantable.cpp

    r2290 r2321  
    6868#include "STPolLinear.h"
    6969#include "STPolStokes.h"
     70#include "STUpgrade.h"
    7071#include "Scantable.h"
    7172
     
    116117  uInt version = tab.keywordSet().asuInt("VERSION");
    117118  if (version != version_) {
    118     if ( version == 2 && version_ == 3 ) {
    119       // run asap2to3 command
     119      STUpgrade upgrader(version_);
    120120      LogIO os( LogOrigin( "Scantable" ) ) ;
    121       string command="asap2to3" ;
    122       string exec=command+" in="+name ;
    123       string outname=name ;
    124       if ( name.at(name.length()-1) == '/' )
    125         outname = outname.substr( 0, name.length()-1 ) ;
    126       outname += ".asap3" ;
    127121      os << LogIO::WARN
    128          << name << " is incompatible data format (Scantable v2)." << endl
    129          << "Running " << command << " to create " << outname << ", " << endl 
    130          << "which is identical to " << name << " but compatible " << endl
    131          << "data format with current software version (Scantable v3)."
     122         << name << " data format version " << version
     123         << " is deprecated" << endl
     124         << "Running upgrade."<< endl 
    132125         << LogIO::POST ; 
    133       int ret = system( string("which "+command+" > /dev/null 2>&1").c_str() ) ;
    134       if ( ret != 0 )
    135         throw(AipsError(command+" is not installed")) ;
     126      std::string outname = upgrader.upgrade(name);
    136127      os << LogIO::WARN
    137128         << "Data will be loaded from " << outname << " instead of "
    138129         << name << LogIO::POST ;
    139       int tmp = system( exec.c_str() ) ;
    140       (void) tmp;
    141130      tab = Table(outname, Table::Update ) ;
    142       //os << "tab.tableName()=" << tab.tableName() << LogIO::POST ;
    143     }
    144     else {
    145       throw(AipsError("Unsupported version of ASAP file."));
    146     }
    147131  }
    148132  if ( type_ == Table::Memory ) {
Note: See TracChangeset for help on using the changeset viewer.