Changeset 2920 for trunk/src/STIdxIter.h


Ignore:
Timestamp:
04/07/14 10:04:18 (10 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: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here..

Merged IterationHelper? into STIdxIter2.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STIdxIter.h

    r2918 r2920  
    1515using namespace std ;
    1616using namespace casa ;
     17
     18namespace {
     19vector<string> split(const string &str, char delim)
     20{
     21  vector<string> result;
     22  size_t current = 0;
     23  size_t found;
     24  while ((found = str.find_first_of(delim, current)) != string::npos) {
     25    result.push_back(string(str, current, found - current));
     26    current = found + 1;
     27  }
     28  result.push_back(string(str, current, str.size() - current));
     29  return result;
     30}
     31} // anonymous namespace
    1732
    1833namespace asap {
     
    160175{
    161176public:
     177  template<class T>
     178  static void Iterate(T &processor, const string cols_list)
     179  {
     180    vector<string> cols = split(cols_list, ',');
     181    // for (vector<string>::iterator i = cols.begin(); i != cols.end(); ++i)
     182    //   cout << *i << endl;
     183    STIdxIter2 iter(processor.target(), cols);
     184    STSelector sel ;
     185    while ( !iter.pastEnd() ) {
     186      const Record current = iter.currentValue() ;
     187      Vector<uInt> rows = iter.getRows( SHARE ) ;
     188      // any process
     189      processor.Process(cols, current, rows);
     190      // go next
     191      iter.next() ;
     192    }   
     193  }
    162194  STIdxIter2() ;
    163195  STIdxIter2( const string &name,
Note: See TracChangeset for help on using the changeset viewer.