Changeset 2921 for trunk/src/STIdxIter.h
- Timestamp:
- 04/07/14 10:28:37 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STIdxIter.h
r2920 r2921 32 32 33 33 namespace asap { 34 class IndexIterator35 {36 public:37 IndexIterator( IPosition &shape ) ;38 Block<uInt> current() { return idx_m ; } ;39 Bool pastEnd() ;40 void next() ;41 private:42 uInt nfield_m ;43 Block<uInt> prod_m ;44 Block<uInt> idx_m ;45 uInt niter_m ;46 uInt maxiter_m ;47 } ;48 49 class ArrayIndexIterator50 {51 public:52 ArrayIndexIterator( Matrix<uInt> &arr,53 vector< vector<uInt> > idlist=vector< vector<uInt> >() ) ;54 virtual ~ArrayIndexIterator() ;55 Vector<uInt> current() ;56 Bool pastEnd() ;57 virtual void next() = 0 ;58 virtual Vector<uInt> getRows( StorageInitPolicy policy=COPY ) = 0 ;59 protected:60 IndexIterator *iter_m ;61 uInt nrow_m ;62 uInt ncol_m ;63 Block<uInt> storage_m ;64 Matrix<uInt> arr_m ;65 IPosition pos_m ;66 Vector<uInt> current_m ;67 vector< vector<uInt> > idxlist_m ;68 } ;69 70 class ArrayIndexIteratorNormal : public ArrayIndexIterator71 {72 public:73 ArrayIndexIteratorNormal( Matrix<uInt> &arr,74 vector< vector<uInt> > idlist=vector< vector<uInt> >() ) ;75 void next() ;76 Vector<uInt> getRows( StorageInitPolicy policy=COPY ) ;77 } ;78 79 class ArrayIndexIteratorAcc : public ArrayIndexIterator80 {81 public:82 ArrayIndexIteratorAcc( Matrix<uInt> &arr,83 vector< vector<uInt> > idlist=vector< vector<uInt> >() ) ;84 void next() ;85 Vector<uInt> getRows( StorageInitPolicy policy=COPY ) ;86 private:87 Int isChanged( Block<uInt> &idx ) ;88 uInt *updateStorage( Int &icol, uInt *base, uInt &v ) ;89 90 Block<uInt> prev_m ;91 Block<uInt> len_m ;92 Block<Bool> skip_m ;93 } ;94 95 class STIdxIter96 {97 public:98 STIdxIter() ;99 STIdxIter( const string &name,100 const vector<string> &cols ) ;101 STIdxIter( const CountedPtr<Scantable> &s,102 const vector<string> &cols ) ;103 virtual ~STIdxIter() ;104 vector<uInt> currentSTL() { return tovector( iter_m->current() ) ; } ;105 Vector<uInt> current() { return iter_m->current() ; } ;106 Bool pastEnd() { return iter_m->pastEnd() ; } ;107 void next() { iter_m->next() ; } ;108 vector<uInt> getRowsSTL() { return tovector( iter_m->getRows() ) ; } ;109 // !!!you should not use policy=TAKE_OVER since it causes problem!!!110 Vector<uInt> getRows( StorageInitPolicy policy=COPY ) ;111 protected:112 ArrayIndexIterator *iter_m ;113 virtual void init( Table &t,114 const vector<string> &cols ) = 0 ;115 private:116 vector<uInt> tovector( Vector<uInt> v ) ;117 } ;118 119 class STIdxIterNormal : public STIdxIter120 {121 public:122 STIdxIterNormal() ;123 STIdxIterNormal( const string &name,124 const vector<string> &cols ) ;125 STIdxIterNormal( const CountedPtr<Scantable> &s,126 const vector<string> &cols ) ;127 ~STIdxIterNormal() ;128 protected:129 void init( Table &t,130 const vector<string> &cols ) ;131 } ;132 133 class STIdxIterAcc : public STIdxIter134 {135 public:136 STIdxIterAcc() ;137 STIdxIterAcc( const string &name,138 const vector<string> &cols ) ;139 STIdxIterAcc( const CountedPtr<Scantable> &s,140 const vector<string> &cols ) ;141 ~STIdxIterAcc() ;142 protected:143 virtual void init( Table &t,144 const vector<string> &cols ) ;145 } ;146 147 class STIdxIterExAcc : public STIdxIter148 {149 public:150 STIdxIterExAcc() ;151 STIdxIterExAcc( const string &name,152 const vector<string> &cols ) ;153 STIdxIterExAcc( const CountedPtr<Scantable> &s,154 const vector<string> &cols ) ;155 ~STIdxIterExAcc() ;156 Int getSrcType() ;157 String getSrcName() ;158 protected:159 virtual void init( Table &t,160 const vector<string> &cols ) ;161 private:162 void processIntCol( Vector<Int> &in,163 Vector<uInt> &out,164 Block<Int> &val ) ;165 void processStrCol( Vector<String> &in,166 Vector<uInt> &out,167 Block<String> &val ) ;168 Block<Int> srctype_m ;169 Block<String> srcname_m ;170 Int srctypeid_m ;171 Int srcnameid_m ;172 } ;173 174 34 class STIdxIter2 175 35 {
Note: See TracChangeset
for help on using the changeset viewer.