Changeset 148 for trunk


Ignore:
Timestamp:
12/26/04 14:58:22 (20 years ago)
Author:
kil064
Message:

check this !=&other in assignment operator
assign all state in assignment operator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMemTable.cc

    r138 r148  
    7575
    7676SDMemTable::SDMemTable(const SDMemTable& other, Bool clear) {
    77   this->IFSel_= other.IFSel_;
    78   this->beamSel_= other.beamSel_;
    79   this->polSel_= other.polSel_;
    80   this->chanMask_ = other.chanMask_;
    81   this->table_ = other.table_.copyToMemoryTable(String("dummy"));
     77  IFSel_= other.IFSel_;
     78  beamSel_= other.beamSel_;
     79  polSel_= other.polSel_;
     80  chanMask_ = other.chanMask_;
     81  table_ = other.table_.copyToMemoryTable(String("dummy"));
    8282  // clear all rows()
    8383  if (clear) {
    84     this->table_.removeRow(this->table_.rowNumbers());
     84    table_.removeRow(this->table_.rowNumbers());
    8585  } else {
    86     this->IFSel_ = other.IFSel_;
    87     this->beamSel_ = other.beamSel_;
    88     this->polSel_ = other.polSel_;
     86    IFSel_ = other.IFSel_;
     87    beamSel_ = other.beamSel_;
     88    polSel_ = other.polSel_;
    8989  }
    9090}
     
    111111
    112112SDMemTable &SDMemTable::operator=(const SDMemTable& other) {
    113   // reset "cursor"
    114   IFSel_ = 0;
    115   beamSel_ = 0;
    116   polSel_ = 0;
    117   table_ = other.table().copyToMemoryTable("dummy");
     113  if (this != &other) {
     114     IFSel_= other.IFSel_;
     115     beamSel_= other.beamSel_;
     116     polSel_= other.polSel_;
     117     chanMask_.resize(0);
     118     chanMask_ = other.chanMask_;
     119     table_ = other.table_.copyToMemoryTable(String("dummy"));
     120   }
    118121  return *this;
    119122}
Note: See TracChangeset for help on using the changeset viewer.