Changeset 849 for trunk/src


Ignore:
Timestamp:
02/28/06 10:47:19 (19 years ago)
Author:
mar637
Message:

added assignment operator and additional constructor

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STFocus.cpp

    r839 r849  
    2828const casa::String STFocus::name_ = "FOCUS";
    2929
    30 STFocus::STFocus(casa::Table::TableType tt) :
    31   STSubTable( name_, tt )
     30STFocus::STFocus(const Scantable& parent ) :
     31  STSubTable( parent, name_ )
    3232{
    3333  setup();
    3434}
    3535
     36asap::STFocus::STFocus( casa::Table tab ) : STSubTable(tab)
     37{
     38  rotationCol_.attach(table_,"ROTATION");
     39  angleCol_.attach(table_,"ANGLE");
     40  tanCol_.attach(table_,"TAN");
     41}
    3642
    3743STFocus::~STFocus()
     
    3945}
    4046
     47STFocus & asap::STFocus::operator =( const STFocus & other )
     48{
     49  if (this != &other) {
     50    static_cast<STSubTable&>(*this) = other;
     51    rotationCol_.attach(table_,"ROTATION");
     52    angleCol_.attach(table_,"ANGLE");
     53    tanCol_.attach(table_,"TAN");
     54  }
     55  return *this;
     56}
    4157void asap::STFocus::setup( )
    4258{
     
    92108}
    93109
     110
    94111}
  • trunk/src/STFocus.h

    r839 r849  
    2929class STFocus : public STSubTable {
    3030public:
    31   STFocus( casa::Table::TableType tt = casa::Table::Memory);
     31  STFocus() {;}
     32  STFocus(casa::Table tab);
     33  STFocus( const Scantable& parent );
    3234
    3335  virtual ~STFocus();
     36
     37  STFocus& operator=(const STFocus& other);
    3438
    3539  casa::uInt addEntry( casa::Float rotation, casa::Float angle,
  • trunk/src/STFrequencies.cpp

    r847 r849  
    3535const String STFrequencies::name_ = "FREQUENCIES";
    3636
    37 STFrequencies::STFrequencies(Table::TableType tt) :
    38   STSubTable( name_, tt )
    39 {
     37STFrequencies::STFrequencies(const Scantable& parent) :
     38  STSubTable(parent, name_)
     39{
     40  cout << "STFrequencies(const Scantable& parent" << endl;
    4041  setup();
    41 }
    42 
     42  cout << "after setup" << endl;
     43}
     44
     45asap::STFrequencies::STFrequencies( casa::Table tab ) :
     46  STSubTable(tab)
     47{
     48  refpixCol_.attach(table_,"REFPIX");
     49  refvalCol_.attach(table_,"REFVAL");
     50  incrCol_.attach(table_,"INCREMENT");
     51
     52}
    4353
    4454STFrequencies::~STFrequencies()
    4555{
     56}
     57
     58STFrequencies & asap::STFrequencies::operator =( const STFrequencies & other )
     59{
     60  if ( this != &other ) {
     61    static_cast<STSubTable&>(*this) = other;
     62    refpixCol_.attach(table_,"REFPIX");
     63    refvalCol_.attach(table_,"REFVAL");
     64    incrCol_.attach(table_,"INCREMENT");
     65  }
     66  return *this;
    4667}
    4768
     
    326347}
    327348
     349
    328350} // namespace
  • trunk/src/STFrequencies.h

    r847 r849  
    3131class STFrequencies : public STSubTable {
    3232public:
    33     STFrequencies( casa::Table::TableType tt = casa::Table::Memory);
     33  STFrequencies() {;}
     34  STFrequencies(casa::Table tab);
     35  STFrequencies(const Scantable& parent);
    3436
    35     virtual ~STFrequencies();
     37  virtual ~STFrequencies();
     38
     39  STFrequencies& operator=(const STFrequencies& other);
     40
    3641  /**
    3742   * Add a new Entry to the Frequency subtable. This checks for duplicates.
  • trunk/src/STMolecules.cpp

    r847 r849  
    2828const casa::String STMolecules::name_ = "MOLECULES";
    2929
    30 STMolecules::STMolecules(casa::Table::TableType tt) :
    31   STSubTable( name_, tt )
     30STMolecules::STMolecules(const Scantable& parent) :
     31  STSubTable( parent, name_ )
    3232{
    3333  setup();
    3434}
    3535
     36asap::STMolecules::STMolecules( casa::Table tab ) : STSubTable(tab)
     37{
     38  restfreqCol_.attach(table_,"RESTFREQUENCY");
     39  nameCol_.attach(table_,"NAME");
     40  formattednameCol_.attach(table_,"FORMATTEDNAME");
     41}
    3642
    3743STMolecules::~STMolecules()
    3844{
     45}
     46
     47STMolecules & asap::STMolecules::operator =( const STMolecules & other )
     48{
     49  if ( this != &other ) {
     50    static_cast<STSubTable&>(*this) = other;
     51    restfreqCol_.attach(table_,"RESTFREQUENCY");
     52    nameCol_.attach(table_,"NAME");
     53    formattednameCol_.attach(table_,"FORMATTEDNAME");
     54  }
     55  return *this;
    3956}
    4057
     
    101118}
    102119
    103 } //namespace
     120
     121}//namespace
     122
  • trunk/src/STMolecules.h

    r847 r849  
    2929class STMolecules : public STSubTable {
    3030public:
    31   STMolecules( casa::Table::TableType tt = casa::Table::Memory);
     31  STMolecules() {;}
     32  STMolecules(casa::Table tab);
     33  STMolecules( const Scantable& parent);
    3234
    3335  virtual ~STMolecules();
     36
     37  STMolecules& operator=(const STMolecules& other);
    3438
    3539  casa::uInt addEntry( casa::Double restfreq, const casa::String& name="",
  • trunk/src/STSubTable.cpp

    r808 r849  
    1515#include <tables/Tables/ScaColDesc.h>
    1616
     17#include "Scantable.h"
    1718#include "STSubTable.h"
     19
    1820
    1921using namespace casa;
     
    2123namespace asap {
    2224
    23 STSubTable::STSubTable(const casa::String& name, casa::Table::TableType tt) :
    24   type_(tt)
    25 
     25STSubTable::STSubTable( const Scantable& parent, const casa::String& name )
    2626{
    2727  TableDesc td("", "1", TableDesc::Scratch);
    2828  td.addColumn(ScalarColumnDesc<uInt>("ID"));
    29   SetupNewTable aNewTab(name, td, Table::New);
    30   table_ = Table(aNewTab, tableType());
     29  String tabname = parent.table().tableName()+"/"+name;
     30  SetupNewTable aNewTab(tabname, td, Table::New);
     31  table_ = Table(aNewTab, parent.table().tableType());
    3132  idCol_.attach(table_,"ID");
    3233
    3334}
     35STSubTable::STSubTable(Table tab)
     36{
     37  table_ = tab;
     38  idCol_.attach(table_,"ID");
     39}
     40
    3441
    3542STSubTable::~STSubTable()
     
    3744}
    3845
     46STSubTable& asap::STSubTable::operator=( const STSubTable& other)
     47{
     48  if (&other != this) {
     49    this->table_ = other.table_;
     50    idCol_.attach(this->table_,"ID");
     51  }
     52  return *this;
    3953}
     54
     55
     56}
  • trunk/src/STSubTable.h

    r808 r849  
    2020namespace asap {
    2121
     22class Scantable;
    2223/**
    2324Abstract base class for all subtables in the Scantable class.
     
    2930class STSubTable : public SDLog {
    3031public:
    31   STSubTable( const casa::String& name,
    32               casa::Table::TableType tt = casa::Table::Memory );
     32  STSubTable() {;}
     33  STSubTable( casa::Table tab );
     34  STSubTable( const Scantable& parent,
     35              const casa::String& name );
    3336
    3437  virtual ~STSubTable();
     38
     39  STSubTable& operator=(const STSubTable& other);
     40
    3541
    3642
     
    5157  casa::Table table() { return table_; }
    5258
    53   casa::Table::TableType tableType() const { return type_; }
    54 
    5559protected:
    5660  casa::Table table_;
     
    5862
    5963private:
    60   casa::Table::TableType type_;
    61 
    6264};
    6365
  • trunk/src/STTcal.cpp

    r830 r849  
     1
    12//
    23// C++ Implementation: STTcal
     
    2930const casa::String STTcal::name_ = "TCAL";
    3031
    31 STTcal::STTcal(casa::Table::TableType tt) :
    32   STSubTable( name_, tt )
     32STTcal::STTcal(const Scantable& parent) :
     33  STSubTable( parent, name_ )
    3334{
    3435  setup();
    3536}
    3637
     38STTcal& asap::STTcal::operator =( const STTcal & other )
     39{
     40  if ( this != &other ) {
     41    static_cast<STSubTable&>(*this) = other;
     42    timeCol_.attach(table_,"TIME");
     43    tcalCol_.attach(table_,"TCAL");
     44  }
     45  return *this;
     46}
     47
     48asap::STTcal::STTcal( casa::Table tab ) : STSubTable(tab)
     49{
     50  timeCol_.attach(table_,"TIME");
     51  tcalCol_.attach(table_,"TCAL");
     52
     53}
    3754
    3855STTcal::~STTcal()
     
    91108
    92109} //namespace
    93 
  • trunk/src/STTcal.h

    r830 r849  
    3030class STTcal : public STSubTable {
    3131public:
    32   STTcal( casa::Table::TableType tt = casa::Table::Memory);
     32  STTcal() {;}
     33  STTcal(casa::Table tab);
     34  STTcal( const Scantable& parent);
    3335
    3436  virtual ~STTcal();
     37
     38  STTcal& operator=(const STTcal& other);
    3539
    3640  casa::uInt addEntry( const casa::String& time,
  • trunk/src/STWeather.cpp

    r830 r849  
    2828const casa::String STWeather::name_ = "WEATHER";
    2929
    30 STWeather::STWeather(casa::Table::TableType tt) :
    31   STSubTable( name_, tt )
     30STWeather::STWeather(const Scantable& parent) :
     31  STSubTable( parent, name_ )
    3232{
    3333  setup();
     
    3535
    3636
     37asap::STWeather::STWeather( casa::Table tab ) : STSubTable(tab)
     38{
     39  temperatureCol_.attach(table_,"TEMPERATURE");
     40  pressureCol_.attach(table_,"PRESSURE");
     41  humidityCol_.attach(table_,"HUMIDITY");
     42  windspeedCol_.attach(table_,"WINDSPEED");
     43  windazCol_.attach(table_,"WINDAZ");
     44
     45}
     46
    3747STWeather::~STWeather()
    3848{
    3949}
     50
     51STWeather & asap::STWeather::operator =( const STWeather & other )
     52{
     53  if ( this != &other ) {
     54    static_cast<STSubTable&>(*this) = other;
     55    temperatureCol_.attach(table_,"TEMPERATURE");
     56    pressureCol_.attach(table_,"PRESSURE");
     57    humidityCol_.attach(table_,"HUMIDITY");
     58    windspeedCol_.attach(table_,"WINDSPEED");
     59    windazCol_.attach(table_,"WINDAZ");
     60  }
     61  return *this;
     62}
     63
    4064
    4165void asap::STWeather::setup( )
  • trunk/src/STWeather.h

    r843 r849  
    2929class STWeather : public STSubTable {
    3030public:
    31   STWeather( casa::Table::TableType tt = casa::Table::Memory);
     31  STWeather() {;}
     32  STWeather(casa::Table tab);
     33  STWeather( const Scantable& parent);
    3234
    3335  virtual ~STWeather();
     36
     37  STWeather& operator=(const STWeather& other);
    3438
    3539  casa::uInt addEntry( casa::Float temperature, casa::Float pressure,
Note: See TracChangeset for help on using the changeset viewer.