Changeset 860 for trunk/src


Ignore:
Timestamp:
03/01/06 14:00:04 (19 years ago)
Author:
mar637
Message:

reworked history table
added STHistory class

Location:
trunk/src
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Makefile

    r828 r860  
    9393             STWeather.o \
    9494             STFrequencies.o \
     95             STHistory.o \
    9596             STWriter.o \
    9697             RowAccumulator.o \
     
    113114             STFocus.h \
    114115             STWeather.h \
     116             STHistory.h \
    115117             STFrequencies.h \
    116118             STDefs.h \
  • trunk/src/Scantable.cpp

    r859 r860  
    7474  moleculeTable_ = STMolecules(*this);
    7575  table_.rwKeywordSet().defineTable("MOLECULES", moleculeTable_.table());
    76   setupHistoryTable();
     76  historyTable_ = STHistory(*this);
     77  table_.rwKeywordSet().defineTable("HISTORY", historyTable_.table());
    7778  setupFitTable();
    78   historyTable_ = table_.keywordSet().asTable("HISTORY");
    7979  fitTable_ = table_.keywordSet().asTable("FITS");
    8080  originalTable_ = table_;
     
    9999  attach();
    100100}
    101 
    102101
    103102Scantable::Scantable( const Scantable& other, bool clear )
     
    141140  tcalTable_ = STTcal(table_);
    142141  moleculeTable_ = STMolecules(table_);
     142  historyTable_ = STHistory(table_);
    143143}
    144144
     
    213213  originalTable_ = table_;
    214214
    215 }
    216 
    217 void Scantable::setupHistoryTable( )
    218 {
    219   TableDesc tdh("", "1", TableDesc::Scratch);
    220   tdh.addColumn(ScalarColumnDesc<String>("ITEM"));
    221   SetupNewTable histtab("history", tdh, Table::Scratch);
    222   Table histTable(histtab, Table::Memory);
    223   table_.rwKeywordSet().defineTable("HISTORY", histTable);
    224215}
    225216
     
    522513{
    523514  return polCol_(whichrow);
    524 }
    525 
    526 Table Scantable::getHistoryTable() const
    527 {
    528   return table_.keywordSet().asTable("HISTORY");
    529 }
    530 
    531 void Scantable::appendToHistoryTable(const Table& otherHist)
    532 {
    533   Table t = table_.rwKeywordSet().asTable("HISTORY");
    534 
    535   addHistory(asap::SEPERATOR);
    536   TableCopy::copyRows(t, otherHist, t.nrow(), 0, otherHist.nrow());
    537   addHistory(asap::SEPERATOR);
    538 }
    539 
    540 void Scantable::addHistory(const std::string& hist)
    541 {
    542   Table t = table_.rwKeywordSet().asTable("HISTORY");
    543   uInt nrow = t.nrow();
    544   t.addRow();
    545   ScalarColumn<String> itemCol(t, "ITEM");
    546   itemCol.put(nrow, hist);
    547 }
    548 
    549 std::vector<std::string> Scantable::getHistory() const
    550 {
    551   Vector<String> history;
    552   const Table& t = table_.keywordSet().asTable("HISTORY");
    553   uInt nrow = t.nrow();
    554   ROScalarColumn<String> itemCol(t, "ITEM");
    555   std::vector<std::string> stlout;
    556   String hist;
    557   for (uInt i=0; i<nrow; ++i) {
    558     itemCol.get(i, hist);
    559     stlout.push_back(hist);
    560   }
    561   return stlout;
    562515}
    563516
     
    678631  oss << endl;
    679632  String tmp;
    680   //table_.keywordSet().get("Observer", tmp);
    681   oss << setw(15) << "Observer:" << table_.keywordSet().asString("Observer") << endl;
     633  oss << setw(15) << "Observer:"
     634      << table_.keywordSet().asString("Observer") << endl;
    682635  oss << setw(15) << "Obs Date:" << getTime(-1,true) << endl;
    683636  table_.keywordSet().get("Project", tmp);
  • trunk/src/Scantable.h

    r859 r860  
    3838#include "STMolecules.h"
    3939#include "STSelector.h"
     40#include "STHistory.h"
    4041
    4142
     
    253254  void makePersistent(const std::string& filename);
    254255
    255   std::vector<std::string> getHistory() const;
    256   void addHistory(const std::string& hist);
    257 
    258   casa::Table getHistoryTable() const;
    259   void appendToHistoryTable(const casa::Table& otherHist);
     256  std::vector<std::string> getHistory() const
     257    { return historyTable_.getHistory(); };
     258
     259  void addHistory(const std::string& hist) { historyTable_.addEntry(hist); }
     260
     261  void appendToHistoryTable(const STHistory& otherhist)
     262    { historyTable_.append(otherhist); }
    260263
    261264  std::string summary(bool verbose=false);
     
    287290  STTcal& tcal() { return tcalTable_; }
    288291  STMolecules& molecules() { return moleculeTable_; }
     292  STHistory& history() { return historyTable_; }
    289293
    290294private:
     
    322326  void setupMainTable();
    323327
    324   void setupHistoryTable();
    325   void setupMoleculeTable();
    326328  void setupFitTable();
    327329
     
    349351  STFocus focusTable_;
    350352  STMolecules moleculeTable_;
     353  STHistory historyTable_;
     354
    351355  casa::Table fitTable_;
    352   casa::Table historyTable_;
    353356
    354357  // Cached Columns to avoid reconstructing them for each row get/put
Note: See TracChangeset for help on using the changeset viewer.