source: branches/hpc33/src/STIdxIter.h @ 2533

Last change on this file since 2533 was 2533, checked in by Takeshi Nakazato, 12 years ago

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...

Changed structure of ArrayIndexIterator?.
Index list, which was the attribute of IndexIterator? before, is now
belonging to ArrayIndexIterator?.


File size: 3.5 KB
Line 
1#ifndef _ASAP_INDEX_ITERATOR_H_
2#define _ASAP_INDEX_ITERATOR_H_
3
4#include <vector>
5#include <casa/Containers/Block.h>
6#include <casa/Arrays/Vector.h>
7#include <casa/Arrays/Matrix.h>
8#include <casa/Arrays/IPosition.h>
9
10#include "Scantable.h"
11
12using namespace std ;
13using namespace casa ;
14
15namespace asap {
16class IndexIterator
17{
18public:
19  IndexIterator( IPosition &shape ) ;
20  Block<uInt> current() { return idx_m ; } ;
21  Bool pastEnd() ;
22  void next() ;
23private:
24  uInt nfield_m ;
25  Block<uInt> prod_m ;
26  Block<uInt> idx_m ;
27  uInt niter_m ;
28  uInt maxiter_m ;
29} ;
30
31class ArrayIndexIterator
32{
33public:
34  ArrayIndexIterator( Matrix<uInt> &arr,
35                      vector< vector<uInt> > idlist=vector< vector<uInt> >() ) ;
36  virtual ~ArrayIndexIterator() ;
37  Vector<uInt> current() ;
38  Bool pastEnd() ;
39  virtual void next() = 0 ;
40  virtual Vector<uInt> getRows( StorageInitPolicy policy=COPY ) = 0 ;
41protected:
42  IndexIterator *iter_m ;
43  uInt nrow_m ;
44  uInt ncol_m ;
45  Block<uInt> storage_m ;
46  Matrix<uInt> arr_m ;
47  IPosition pos_m ;
48  Vector<uInt> current_m ;
49  vector< vector<uInt> > idxlist_m ;
50} ;
51
52class ArrayIndexIteratorNormal : public ArrayIndexIterator
53{
54public:
55  ArrayIndexIteratorNormal( Matrix<uInt> &arr,
56                            vector< vector<uInt> > idlist=vector< vector<uInt> >() ) ;
57  void next() ;
58  Vector<uInt> getRows( StorageInitPolicy policy=COPY ) ;
59// private:
60//   Block<uInt> storage_m ;
61//   IPosition pos_m ;
62} ;
63
64class ArrayIndexIteratorAcc : public ArrayIndexIterator
65{
66public:
67  ArrayIndexIteratorAcc( Matrix<uInt> &arr,
68                         vector< vector<uInt> > idlist=vector< vector<uInt> >() ) ;
69  void next() ;
70  Vector<uInt> getRows( StorageInitPolicy policy=COPY ) ;
71private:
72  Int isChanged( Vector<uInt> &idx ) ;
73  uInt *updateStorage( Int &icol, uInt *base, uInt &v ) ;
74
75  Vector<uInt> prev_m ;
76//   Block<uInt> storage_m ;
77//   IPosition pos_m ;
78  Block<uInt> len_m ;
79} ;
80
81class STIdxIter
82{
83public:
84  STIdxIter() ;
85  STIdxIter( const string &name,
86                             const vector<string> &cols ) ;
87  STIdxIter( const CountedPtr<Scantable> &s,
88                          const vector<string> &cols ) ;
89  virtual ~STIdxIter() ;
90  vector<uInt> currentSTL() { return tovector( iter_m->current() ) ; } ;
91  Vector<uInt> current() { return iter_m->current() ; } ;
92  Bool pastEnd() { return iter_m->pastEnd() ; } ;
93  void next() { iter_m->next() ; } ;
94  vector<uInt> getRowsSTL() { return tovector( iter_m->getRows() ) ; } ;
95  Vector<uInt> getRows( StorageInitPolicy policy=COPY ) ;
96protected:
97  ArrayIndexIterator *iter_m ;
98  virtual void init( Table &t,
99                     const vector<string> &cols ) = 0 ;
100private:
101  vector<uInt> tovector( Vector<uInt> v ) ;
102} ;
103
104class STIdxIterNormal : public STIdxIter
105{
106public:
107  STIdxIterNormal() ;
108  STIdxIterNormal( const string &name,
109                                const vector<string> &cols ) ;
110  STIdxIterNormal( const CountedPtr<Scantable> &s,
111                                const vector<string> &cols ) ;
112  ~STIdxIterNormal() ;
113protected:
114  void init( Table &t,
115             const vector<string> &cols ) ;
116} ;
117
118class STIdxIterAcc : public STIdxIter
119{
120public:
121  STIdxIterAcc() ;
122  STIdxIterAcc( const string &name,
123                             const vector<string> &cols ) ;
124  STIdxIterAcc( const CountedPtr<Scantable> &s,
125                             const vector<string> &cols ) ;
126  ~STIdxIterAcc() ;
127protected:
128  void init( Table &t,
129             const vector<string> &cols ) ;
130} ;
131
132} // namespace
133#endif /* _ASAP_INDEX_ITERATOR_H_ */
Note: See TracBrowser for help on using the repository browser.