Last change
on this file since 2919 was 2919, checked in by Takeshi Nakazato, 11 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...
Refactoring.
|
File size:
1.2 KB
|
Line | |
---|
1 | #include <vector>
|
---|
2 |
|
---|
3 | #include <casa/Arrays/Vector.h>
|
---|
4 | #include <casa/BasicSL/String.h>
|
---|
5 | #include <casa/Utilities/CountedPtr.h>
|
---|
6 |
|
---|
7 | #include "Scantable.h"
|
---|
8 | #include "STTcal.h"
|
---|
9 | #include "STIdxIter.h"
|
---|
10 | #include "STSelector.h"
|
---|
11 |
|
---|
12 | using namespace casa;
|
---|
13 | using namespace asap;
|
---|
14 |
|
---|
15 | namespace {
|
---|
16 | vector<string> split(const string &str, char delim)
|
---|
17 | {
|
---|
18 | vector<string> result;
|
---|
19 | size_t current = 0;
|
---|
20 | size_t found;
|
---|
21 | while ((found = str.find_first_of(delim, current)) != string::npos) {
|
---|
22 | result.push_back(string(str, current, found - current));
|
---|
23 | current = found + 1;
|
---|
24 | }
|
---|
25 | result.push_back(string(str, current, str.size() - current));
|
---|
26 | return result;
|
---|
27 | }
|
---|
28 |
|
---|
29 | // Iteration Helper
|
---|
30 | template<class T>
|
---|
31 | class IterationHelper
|
---|
32 | {
|
---|
33 | public:
|
---|
34 | static void Iterate(T &processor, const string cols_list)
|
---|
35 | {
|
---|
36 | vector<string> cols = split(cols_list, ',');
|
---|
37 | // for (vector<string>::iterator i = cols.begin(); i != cols.end(); ++i)
|
---|
38 | // cout << *i << endl;
|
---|
39 | STIdxIter2 iter(processor.target(), cols);
|
---|
40 | STSelector sel ;
|
---|
41 | while ( !iter.pastEnd() ) {
|
---|
42 | const Record current = iter.currentValue() ;
|
---|
43 | Vector<uInt> rows = iter.getRows( SHARE ) ;
|
---|
44 | // any process
|
---|
45 | processor.Process(cols, current, rows);
|
---|
46 | // go next
|
---|
47 | iter.next() ;
|
---|
48 | }
|
---|
49 | }
|
---|
50 | };
|
---|
51 |
|
---|
52 |
|
---|
53 | } // anonymous namespace
|
---|
Note:
See
TracBrowser
for help on using the repository browser.