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
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/tables/Tables/TableIter.h>
33#include <casacore/casa/Arrays/Vector.h>
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37//# Forward Declarations
38class TableProxy;
39
40
41// <summary>
42// Proxy for table iterator access.
43// </summary>
44
45// <use visibility=export>
46
47// <reviewed reviewer="Paul Shannon" date="1995/09/15" tests="tgtable.g" demos="">
48// </reviewed>
49
50// <prerequisite>
51//# Classes you should understand before using this one.
52// <li> class TableIterator
53// </prerequisite>
54
55// <etymology>
56// TableIterProxy holds a TableIterator object for the table
57// glish client.
58// </etymology>
59
60// <synopsis>
61// TableIterProxy gives access to the table iterator functionality.
62// It is primarily meant to be used in classes that wrap access to it
63// from scripting languages (like Glish and Python).
64// However, it can also be used directly from other C++ code.
65//
66// A TableIterProxy object is usually created by class
67// <linkto class=TableProxy>TableProxy</linkto>.
68// </synopsis>
69
70// <example>
71// <srcblock>
72// // Get a table proxy.
73// TableProxy proxy("sometable");
74// Vector<String> columns(1, "SOMECOL");
75// TableIterProxy tgi (proxy, columns, "a", "q");
76// TableProxy subTable;
77// // Iterate through the table.
78// while (tgi.next (subTable)) {
79// ..use Table object subTable.table()
80// }
81// </srcblock>
82// </example>
83
85{
86public:
87 // Default constructor initializes to not open.
88 // This constructor is only needed for the Block container.
90
91 // Construct iterator for the given table column(s).
92 // Order and sortType are case-insentive strings and only the first
93 // character in it is important.
94 // <br>order[0]=a means ascending; d means descending.
95 // <br>sortType[0]=q means quicksort, i means insertion sort,
96 // n means nosort, h means heapsort, otherwise parsort
97 // <br>For each column an iteration interval can be given making it possible
98 // to iterate in e.g. time chunks of 1 minute. Not given or zero means
99 // no interval is given for that column, thus a normal comparison is done.
100 // It can only be used for numerical columns (not complex).
101 // However, if for a string column the interbval is set to non-zero, it
102 // means that case-insensitive comparison will be used.
103 TableIterProxy (const TableProxy& tab, const Vector<String>& columns,
104 const String& order, const String& sortType,
105 const Vector<Double>& intervals = Vector<Double>());
106
107 // Copy constructor (copy semantics).
109
111
112 // Assignment (copy semantics).
114
115 // Is the internal iterator object null?
116 Bool isNull() const
117 { return iter_p.isNull(); }
118
119 // Get the TableIterator object.
120 const TableIterator& iterator() const
121 { return iter_p; }
122
123 // Get the next subtable and return it in the TableProxy argument.
124 // When no more subtables are available, it returns False.
126
127 // Iterate to the next part (for Python use).
128 // An IterError exception is thrown at the end of the loop.
130
131 // Reset the iterator (for Python use).
132 void reset();
133
134
135private:
136 // Make an iterator where iteration intervals may have been given.
137 void makeStepIter (const Table& tab,
138 const Block<String>& columns,
139 const Vector<Double>& iterSteps,
141 TableIterator::Option sortType);
142
143 //# Data members
145 Bool firstTime_p; //# True = first time
146};
147
148
149} //# NAMESPACE CASACORE - END
150
151
152#endif
simple 1-D array
Definition Block.h:198
String: the storage and methods of handling collections of characters.
Definition String.h:223
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:120
Option
Define the possible sorts.
Definition TableIter.h:122
Bool isNull() const
Test if the object is null, i.e.
Definition TableIter.h:194
this file contains all the compiler specific defines
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40