casacore
Loading...
Searching...
No Matches
TableIterProxy.h
Go to the documentation of this file.
1// # TableIterProxy.h: Proxy for table iterator access
2// # Copyright (C) 1994,1995,1996,1999,2005
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef TABLES_TABLEITERPROXY_H
27#define TABLES_TABLEITERPROXY_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/Tables/TableIter.h>
32#include <casacore/casa/Arrays/Vector.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36// # Forward Declarations
37class TableProxy;
38
39// <summary>
40// Proxy for table iterator access.
41// </summary>
42
43// <use visibility=export>
44
45// <reviewed reviewer="Paul Shannon" date="1995/09/15" tests="tgtable.g" demos="">
46// </reviewed>
47
48// <prerequisite>
49// # Classes you should understand before using this one.
50// <li> class TableIterator
51// </prerequisite>
52
53// <etymology>
54// TableIterProxy holds a TableIterator object for the table
55// glish client.
56// </etymology>
57
58// <synopsis>
59// TableIterProxy gives access to the table iterator functionality.
60// It is primarily meant to be used in classes that wrap access to it
61// from scripting languages (like Glish and Python).
62// However, it can also be used directly from other C++ code.
63//
64// A TableIterProxy object is usually created by class
65// <linkto class=TableProxy>TableProxy</linkto>.
66// </synopsis>
67
68// <example>
69// <srcblock>
70// // Get a table proxy.
71// TableProxy proxy("sometable");
72// Vector<String> columns(1, "SOMECOL");
73// TableIterProxy tgi (proxy, columns, "a", "q");
74// TableProxy subTable;
75// // Iterate through the table.
76// while (tgi.next (subTable)) {
77// ..use Table object subTable.table()
78// }
79// </srcblock>
80// </example>
81
83 public:
84 // Default constructor initializes to not open.
85 // This constructor is only needed for the Block container.
87
88 // Construct iterator for the given table column(s).
89 // Order and sortType are case-insentive strings and only the first
90 // character in it is important.
91 // <br>order[0]=a means ascending; d means descending.
92 // <br>sortType[0]=q means quicksort, i means insertion sort,
93 // n means nosort, h means heapsort, otherwise parsort
94 // <br>For each column an iteration interval can be given making it possible
95 // to iterate in e.g. time chunks of 1 minute. Not given or zero means
96 // no interval is given for that column, thus a normal comparison is done.
97 // It can only be used for numerical columns (not complex).
98 // However, if for a string column the interbval is set to non-zero, it
99 // means that case-insensitive comparison will be used.
100 TableIterProxy(const TableProxy& tab, const Vector<String>& columns, const String& order,
101 const String& sortType, const Vector<Double>& intervals = Vector<Double>());
102
103 // Copy constructor (copy semantics).
105
107
108 // Assignment (copy semantics).
110
111 // Is the internal iterator object null?
112 Bool isNull() const { return iter_p.isNull(); }
113
114 // Get the TableIterator object.
115 const TableIterator& iterator() const { return iter_p; }
116
117 // Get the next subtable and return it in the TableProxy argument.
118 // When no more subtables are available, it returns False.
120
121 // Iterate to the next part (for Python use).
122 // An IterError exception is thrown at the end of the loop.
124
125 // Reset the iterator (for Python use).
126 void reset();
127
128 private:
129 // Make an iterator where iteration intervals may have been given.
130 void makeStepIter(const Table& tab, const Block<String>& columns, const Vector<Double>& iterSteps,
132
133 // # Data members
135 Bool firstTime_p; // # True = first time
136};
137
138} // namespace casacore
139
140#endif
String: the storage and methods of handling collections of characters.
Definition String.h:355
const TableIterator & iterator() const
Get the TableIterator object.
void reset()
Reset the iterator (for Python use).
Bool isNull() const
Is the internal iterator object null?
TableIterProxy(const TableIterProxy &)
Copy constructor (copy semantics).
TableIterProxy & operator=(const TableIterProxy &)
Assignment (copy semantics).
Bool nextPart(TableProxy &table)
Get the next subtable and return it in the TableProxy argument.
TableIterProxy(const TableProxy &tab, const Vector< String > &columns, const String &order, const String &sortType, const Vector< Double > &intervals=Vector< Double >())
Construct iterator for the given table column(s).
void makeStepIter(const Table &tab, const Block< String > &columns, const Vector< Double > &iterSteps, TableIterator::Order order, TableIterator::Option sortType)
Make an iterator where iteration intervals may have been given.
TableProxy next()
Iterate to the next part (for Python use).
TableIterProxy()
Default constructor initializes to not open.
Order
Define the possible iteration orders.
Definition TableIter.h:117
Option
Define the possible sorts.
Definition TableIter.h:119
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
uInt order() const
What is the order of the polynomial, i.e.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40