Changeset 859


Ignore:
Timestamp:
03/01/06 11:51:18 (19 years ago)
Author:
mar637
Message:

reworked subtable handling
fixed bug in casa::Table construction, where Table::New was used instead of Table::Scratch

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Scantable.cpp

    r852 r859  
    7878  historyTable_ = table_.keywordSet().asTable("HISTORY");
    7979  fitTable_ = table_.keywordSet().asTable("FITS");
    80   cout << "DEBUG" << endl;
    81 
    8280  originalTable_ = table_;
    8381  attach();
    84   cout << "debug" << endl;
    8582}
    8683
     
    9895  else
    9996    table_ = tab;
    100   freqTable_ = STFrequencies(table_.keywordSet().asTable("FREQUENCIES"));
    101   focusTable_ = STFocus(table_.keywordSet().asTable("FOCUS"));
    102   weatherTable_ = STWeather(table_.keywordSet().asTable("WEATHER"));
    103   tcalTable_ = STTcal(table_.keywordSet().asTable("TCAL"));
    104   moleculeTable_ = STMolecules(table_.keywordSet().asTable("MOLECULES"));
     97  attachSubtables();
    10598  originalTable_ = table_;
    10699  attach();
     
    111104{
    112105  // with or without data
    113   if (clear) {
    114     table_ = TableCopy::makeEmptyMemoryTable(String(generateName()),
    115                                              other.table_, True);
     106  String newname = String(generateName());
     107  if ( other.table_.tableType() == Table::Memory ) {
     108      if ( clear ) {
     109        cout << "copy ctor memory clear" << endl;
     110        table_ = TableCopy::makeEmptyMemoryTable(newname,
     111                                                 other.table_, True);
     112      } else
     113        table_ = other.table_.copyToMemoryTable(newname);
    116114  } else {
    117     table_ = other.table_.copyToMemoryTable(String(generateName()));
    118   }
    119 
     115    if ( clear ) {
     116      cout << "copy ctor clear" << endl;
     117      other.table_.deepCopy(newname, Table::New);
     118      cout << "reading table" << endl;
     119      table_ = Table(newname, Table::Scratch);
     120      cout << "removing rows" << endl;
     121      table_.removeRow(table_.rowNumbers());
     122
     123    } else {
     124      cout << "copy ctor no clear" << endl;
     125      other.table_.deepCopy(newname, Table::Scratch);
     126      table_ = Table(newname, Table::Scratch);
     127    }
     128  }
     129  //table_.rwKeywordSet().renameTables(newname, table_.tableName());
     130  //cout << table_.keywordSet().asTable("TCAL").tableName() << endl;
     131  attachSubtables();
    120132  originalTable_ = table_;
    121133  attach();
     134}
     135
     136void Scantable::attachSubtables()
     137{
     138  freqTable_ = STFrequencies(table_);
     139  focusTable_ = STFocus(table_);
     140  weatherTable_ = STWeather(table_);
     141  tcalTable_ = STTcal(table_);
     142  moleculeTable_ = STMolecules(table_);
    122143}
    123144
     
    188209
    189210  // Now create Table SetUp from the description.
    190   SetupNewTable aNewTab(generateName(), td, Table::New);
     211  SetupNewTable aNewTab(generateName(), td, Table::Scratch);
    191212  table_ = Table(aNewTab, type_, 0);
    192213  originalTable_ = table_;
     
    198219  TableDesc tdh("", "1", TableDesc::Scratch);
    199220  tdh.addColumn(ScalarColumnDesc<String>("ITEM"));
    200   SetupNewTable histtab("history", tdh, Table::New);
     221  SetupNewTable histtab("history", tdh, Table::Scratch);
    201222  Table histTable(histtab, Table::Memory);
    202223  table_.rwKeywordSet().defineTable("HISTORY", histTable);
     
    212233  td.addColumn(ArrayColumnDesc<Bool>("PARMASK"));
    213234  td.addColumn(ArrayColumnDesc<String>("FRAMEINFO"));
    214   SetupNewTable aNewTab("fits", td, Table::New);
     235  SetupNewTable aNewTab("fits", td, Table::Scratch);
    215236  Table aTable(aNewTab, Table::Memory);
    216237  table_.rwKeywordSet().defineTable("FITS", aTable);
     
    238259
    239260  mfitidCol_.attach(table_,"FIT_ID");
    240   fitidCol_.attach(fitTable_,"FIT_ID");
     261  //fitidCol_.attach(fitTable_,"FIT_ID");
    241262
    242263  mfreqidCol_.attach(table_, "FREQ_ID");
     
    378399  Path path(inname);
    379400  inname = path.expandedName();
     401  //cout << table_.tableName() << endl;
     402  //cout << freqTable_.table().tableName() << endl;
    380403  table_.deepCopy(inname, Table::New);
     404  //Table t = Table(inname, Table::Update);
     405  //cout << t.keywordSet().asTable("FREQUENCIES").tableName() << endl;
    381406}
    382407
  • trunk/src/Scantable.h

    r852 r859  
    326326  void setupFitTable();
    327327
     328  void attachSubtables();
    328329  /**
    329330   * Convert an "old" asap1 style row index into a new index
Note: See TracChangeset for help on using the changeset viewer.