Changeset 2918


Ignore:
Timestamp:
04/04/14 16:14:00 (11 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: test_tsdaverage etc.

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Replaced STIdxIterExAcc with STIdxIter2.


Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STIdxIter.cpp

    r2914 r2918  
    515515    index_(),
    516516    unique_(),
    517     pointer_()
     517    pointer_(),
     518    string_storage_()
    518519{
    519520}
     
    529530    index_(),
    530531    unique_(),
    531     pointer_()
     532    pointer_(),
     533    string_storage_()
    532534{
    533535  init();
     
    544546    index_(),
    545547    unique_(),
    546     pointer_()
     548    pointer_(),
     549    string_storage_()
    547550{
    548551  init();
     
    640643    addColumnToKey<Complex, TpComplex>(name);
    641644    break;
    642   // case TpString:
    643   //   addColumnToKey<String, TpString>(name);
    644   //   break;
     645  case TpString:
     646    addColumnToKeyTpString(name);
     647    break;
    645648  default:
    646649    deallocate();
     
    662665  pointer_.push_back(raw_storage);
    663666}
     667
     668void STIdxIter2::addColumnToKeyTpString(const string &name)
     669{
     670  ROScalarColumn<String> col(table_, name);
     671  String *storage = new String[num_row_];
     672  Vector<String> array(IPosition(1, num_row_), storage, TAKE_OVER);
     673  col.getColumn(array);
     674  sorter_.sortKey(storage, TpString, 0, Sort::Ascending);
     675  string_storage_.push_back(array);
     676}
     677
    664678} // namespace
    665679
  • trunk/src/STIdxIter.h

    r2911 r2918  
    176176  void addSortKey(const string &name);
    177177  template<class T, DataType U> void addColumnToKey(const string &name);
     178  void addColumnToKeyTpString(const string &name);
    178179  void deallocate();
    179180  vector<string> cols_;
     
    186187  Vector<uInt> unique_;
    187188  vector<void*> pointer_;
     189  vector<Vector<String> > string_storage_;
    188190} ;
    189191
  • trunk/src/STMath.cpp

    r2917 r2918  
    216216  }
    217217  uInt outrowCount = 0;
    218   // use STIdxIterExAcc instead of TableIterator
    219   STIdxIterExAcc iter( in[0], cols ) ;
     218  // use STIdxIter2 instead of TableIterator
     219  STIdxIter2 iter( in[0], cols ) ;
    220220//   double t2 = 0 ;
    221221//   double t3 = 0 ;
     
    230230      continue ;
    231231    }
    232     Vector<uInt> current = iter.current() ;
    233     String srcname = iter.getSrcName() ;
     232    Record current = iter.currentValue() ;
    234233    //Table subt = iter.table();
    235234    // copy the first row of this selection into the new table
     
    336335      static char const*const colNames1[] = { "IFNO", "BEAMNO", "POLNO" };
    337336      //uInt const values1[] = { rec.asuInt("IFNO"), rec.asuInt("BEAMNO"), rec.asuInt("POLNO") };
    338       uInt const values1[] = { current[1], current[0], current[2] };
     337      uInt const values1[] = { current.asuInt("IFNO"), current.asuInt("BEAMNO"), current.asuInt("POLNO") };
    339338      SingleTypeEqPredicate<uInt, 3> myPred(tin, colNames1, values1);
    340339      CustomTableExprNodeRep myNodeRep(tin, myPred);
     
    346345//                          && tin.col("IFNO") == Int(rec.asuInt("IFNO"))
    347346//                          && tin.col("POLNO") == Int(rec.asuInt("POLNO")) );
    348       Table basesubt = tin( tin.col("BEAMNO") == current[0]
    349                          && tin.col("IFNO") == current[1]
    350                          && tin.col("POLNO") == current[2] );
     347      Table basesubt = tin( tin.col("BEAMNO") == current.asuInt("BEAMNO")
     348                            && tin.col("IFNO") == current.asuInt("IFNO")
     349                            && tin.col("POLNO") == current.asuInt("POLNO") );
    351350#endif
    352351      Table subt;
    353352      if ( avmode == "SOURCE") {
    354353//         subt = basesubt( basesubt.col("SRCNAME") == rec.asString("SRCNAME"));
    355         subt = basesubt( basesubt.col("SRCNAME") == srcname );
     354        subt = basesubt( basesubt.col("SRCNAME") == current.asString("SRCNAME") );
    356355
    357356      } else if (avmode == "SCAN") {
    358357//         subt = basesubt( basesubt.col("SRCNAME") == rec.asString("SRCNAME")
    359358//                    && basesubt.col("SCANNO") == Int(rec.asuInt("SCANNO")) );
    360         subt = basesubt( basesubt.col("SRCNAME") == srcname
    361                       && basesubt.col("SCANNO") == current[4] );
     359        subt = basesubt( basesubt.col("SRCNAME") == current.asString("SRCNAME")
     360                         && basesubt.col("SCANNO") == current.asuInt("SCANNO") );
    362361      } else {
    363362        subt = basesubt;
Note: See TracChangeset for help on using the changeset viewer.