casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TableIndexProxy.h
Go to the documentation of this file.
1 //# TableIndexProxy.h: Proxy for table index access
2 //# Copyright (C) 2002,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: aips2-request@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 //# $Id$
27 
28 #ifndef TABLES_TABLEINDEXPROXY_H
29 #define TABLES_TABLEINDEXPROXY_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
36 
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# Forward Declarations
41 class TableProxy;
42 
43 
44 // <summary>
45 // Proxy for table index access.
46 // </summary>
47 
48 // <use visibility=export>
49 
50 // <reviewed reviewer="Paul Shannon" date="1995/09/15" tests="tgtable.g" demos="">
51 // </reviewed>
52 
53 // <prerequisite>
54 //# Classes you should understand before using this one.
55 // <li> class ColumnsIndex
56 // <li> class ColumnsIndexArray
57 // </prerequisite>
58 
59 // <synopsis>
60 // TableIndexProxy gives access to indexed access to tables, both for
61 // scalar columns and array columns.
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 TableIndexProxy object is usually created by class
67 // <linkto class=TableProxy>TableProxy</linkto>.
68 // </synopsis>
69 
71 {
72 public:
73  // Construct for the given columns in the table.
74  TableIndexProxy (const TableProxy& table,
75  const Vector<String>& columnNames, Bool noSort);
76 
77  // Copy constructor.
79 
81 
82  // Are all keys in the index unique?
83  Bool isUnique() const;
84 
85  // Return the names of the columns forming the index.
87 
88  // Something has changed in the table, so the index has to be recreated.
89  // An empty vector means that all columns have changed, otherwise
90  // only the given columns.
91  void setChanged (const Vector<String>& columnNames);
92 
93  // Find the row number matching the key. All keys have to be unique,
94  // otherwise an exception is thrown.
95  // If no match is found, -1 is returned.
96  Int getRowNumber (const Record& key);
97 
98  // Find the row numbers matching the key. It should be used instead
99  // of <src>getRowNumber</src> if the same key can exist multiple times.
100  Vector<Int> getRowNumbers (const Record& key);
101 
102  // Find the row numbers matching the key range. The boolean arguments
103  // tell if the lower and upper key are part of the range.
104  Vector<Int> getRowNumbersRange (const Record& lower, const Record& upper,
105  Bool lowerInclusive, Bool upperInclusive);
106 
107 private:
108  // Assignment is forbidden.
110 
111 
114 };
115 
116 
117 } //# NAMESPACE CASACORE - END
118 
119 
120 #endif
Bool isUnique() const
Are all keys in the index unique?
Index to one or more columns in a table.
Definition: ColumnsIndex.h:227
A 1-D Specialization of the Array class.
int Int
Definition: aipstype.h:50
High-level interface to tables.
Definition: TableProxy.h:103
void setChanged(const Vector< String > &columnNames)
Something has changed in the table, so the index has to be recreated.
TableIndexProxy(const TableProxy &table, const Vector< String > &columnNames, Bool noSort)
Construct for the given columns in the table.
Index to an array column in a table.
Int getRowNumber(const Record &key)
Find the row number matching the key.
Vector< Int > getRowNumbersRange(const Record &lower, const Record &upper, Bool lowerInclusive, Bool upperInclusive)
Find the row numbers matching the key range.
Proxy for table index access.
Vector< Int > getRowNumbers(const Record &key)
Find the row numbers matching the key.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Vector< String > columnNames() const
Return the names of the columns forming the index.
TableIndexProxy & operator=(const TableIndexProxy &)
Assignment is forbidden.
ColumnsIndexArray * arrIndex_p
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42