casacore
Loading...
Searching...
No Matches
RefColumn.h
Go to the documentation of this file.
1// # RefColumn.h: A column in a reference table
2// # Copyright (C) 1994,1995,1996,1997,1998
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_REFCOLUMN_H
27#define TABLES_REFCOLUMN_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/Tables/BaseColumn.h>
32#include <casacore/tables/Tables/ColumnCache.h>
33#include <casacore/casa/Arrays/ArrayFwd.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward Declarations
38class RefTable;
39class BaseColumnDesc;
40class TableRecord;
41class Slicer;
42class IPosition;
43
44// <summary>
45// A column in a reference table
46// </summary>
47
48// <use visibility=local>
49
50// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
51// </reviewed>
52
53// <prerequisite>
54// # Classes you should understand before using this one.
55// <li> RefTable
56// <li> BaseColumn
57// </prerequisite>
58
59// <etymology>
60// RefTable represents a column in a RefTable. A RefTable is a table
61// referencing another table, usually as the result of a select, etc..
62// </etymology>
63
64// <synopsis>
65// RefColumn handles the access of a column in a RefTable.
66// It calls the corresponding function in the referenced column
67// while converting the given row number to the row number in the
68// referenced table.
69// </synopsis>
70
71// <motivation>
72// This class is untyped, i.e. not templated.
73// Every call is sent to the underlying referenced BaseColumn which
74// is typed by the virtual function mechanism.
75// A RefColumn can never be used directly. A user always has to
76// construct a typed ArrayColumn or ScalarColumn object to access a column.
77// This means everyting is fully type safe.
78// </motivation>
79
80// <todo asof="$DATE:$">
81// # A List of bugs, limitations, extensions or planned refinements.
82// <li> Act upon removal of rows or the underlying column
83// </todo>
84
85class RefColumn : public BaseColumn {
86 public:
87 // Construct the RefColumn. It will point to the given column
88 // description, RefTable and referenced column.
89 // The RefTable will be used to convert the rownr to the rownr
90 // in the referenced column.
91 RefColumn(const BaseColumnDesc*, RefTable*, BaseColumn* referencedColumn);
92
94
95 // Test if the column is writable in the parent table.
96 virtual Bool isWritable() const;
97
98 // Test if the column is stored (otherwise it is virtual).
99 virtual Bool isStored() const;
100
101 // Get access to the column keyword set.
102 // This is the keyword set in the referenced column.
103 // <group>
106 // </group>
107
108 // Get nr of rows in the column.
109 virtual rownr_t nrow() const;
110
111 // Test if a value in a particular cell has been defined.
112 virtual Bool isDefined(rownr_t rownr) const;
113
114 // Set the shape of the array in the given row.
115 virtual void setShape(rownr_t rownr, const IPosition& shape);
116
117 // Set the shape and tile shape of the array in the given row.
118 virtual void setShape(rownr_t rownr, const IPosition& shape, const IPosition& tileShape);
119
120 // Get the global #dimensions of an array (i.e. for all rows).
121 virtual uInt ndimColumn() const;
122
123 // Get the global shape of an array (i.e. for all rows).
124 virtual IPosition shapeColumn() const;
125
126 // Get the #dimensions of an array in a particular cell.
127 virtual uInt ndim(rownr_t rownr) const;
128
129 // Get the shape of an array in a particular cell.
130 virtual IPosition shape(rownr_t rownr) const;
131
132 // It can change shape if the underlying column can.
133 virtual Bool canChangeShape() const;
134
135 // Initialize the rows from startRownr till endRownr (inclusive)
136 // with the default value defined in the column description (if defined).
137 void initialize(rownr_t startRownr, rownr_t endRownr);
138
139 // Get the value from a particular cell.
140 // This can be a scalar or an array.
141 virtual void get(rownr_t rownr, void* dataPtr) const;
142
143 // Get an array from a particular cell.
144 virtual void getArray(rownr_t rownr, ArrayBase& dataPtr) const;
145
146 // Get a slice of an N-dimensional array in a particular cell.
147 virtual void getSlice(rownr_t rownr, const Slicer&, ArrayBase& dataPtr) const;
148
149 // Get the vector of all scalar values in a column.
150 virtual void getScalarColumn(ArrayBase& dataPtr) const;
151
152 // Get the array of all array values in a column.
153 // If the column contains n-dim arrays, the resulting array is (n+1)-dim.
154 // The arrays in the column have to have the same shape in all cells.
155 virtual void getArrayColumn(ArrayBase& dataPtr) const;
156
157 // Get subsections from all arrays in the column.
158 // If the column contains n-dim arrays, the resulting array is (n+1)-dim.
159 // The arrays in the column have to have the same shape in all cells.
160 virtual void getColumnSlice(const Slicer&, ArrayBase& dataPtr) const;
161
162 // Get the vector of some scalar values in a column.
163 virtual void getScalarColumnCells(const RefRows& rownrs, ArrayBase& dataPtr) const;
164
165 // Get the array of some array values in a column.
166 // If the column contains n-dim arrays, the resulting array is (n+1)-dim.
167 // The arrays in the column have to have the same shape in all cells.
168 virtual void getArrayColumnCells(const RefRows& rownrs, ArrayBase& dataPtr) const;
169
170 // Get subsections from some arrays in the column.
171 // If the column contains n-dim arrays, the resulting array is (n+1)-dim.
172 // The arrays in the column have to have the same shape in all cells.
173 virtual void getColumnSliceCells(const RefRows& rownrs, const Slicer&, ArrayBase& dataPtr) const;
174
175 // Put the value in a particular cell.
176 // This can be a scalar or an array.
177 virtual void put(rownr_t rownr, const void* dataPtr);
178
179 // Put the array value in a particular cell.
180 virtual void putArray(rownr_t rownr, const ArrayBase& dataPtr);
181
182 // Put a slice of an N-dimensional array in a particular cell.
183 virtual void putSlice(rownr_t rownr, const Slicer&, const ArrayBase& dataPtr);
184
185 // Put the vector of all scalar values in the column.
186 virtual void putScalarColumn(const ArrayBase& dataPtr);
187
188 // Put the array of all array values in the column.
189 // If the column contains n-dim arrays, the source array is (n+1)-dim.
190 // The arrays in the column have to have the same shape in all cells.
191 virtual void putArrayColumn(const ArrayBase& dataPtr);
192
193 // Put into subsections of all table arrays in the column.
194 // If the column contains n-dim arrays, the source array is (n+1)-dim.
195 // The arrays in the column have to have the same shape in all cells.
196 virtual void putColumnSlice(const Slicer&, const ArrayBase& dataPtr);
197
198 // Get the vector of some scalar values in a column.
199 virtual void putScalarColumnCells(const RefRows& rownrs, const ArrayBase& dataPtr);
200
201 // Get the array of some array values in a column.
202 // If the column contains n-dim arrays, the resulting array is (n+1)-dim.
203 // The arrays in the column have to have the same shape in all cells.
204 virtual void putArrayColumnCells(const RefRows& rownrs, const ArrayBase& dataPtr);
205
206 // Put subsections of some arrays in the column.
207 // If the column contains n-dim arrays, the source array is (n+1)-dim.
208 // The arrays in the column have to have the same shape in all cells.
209 virtual void putColumnSliceCells(const RefRows& rownrs, const Slicer&, const ArrayBase& dataPtr);
210
211 // Get the underlying column cache.
213
214 // Set the maximum cache size (in bytes) to be used by a storage manager.
215 virtual void setMaximumCacheSize(uInt nbytes);
216
217 // Add this column and its data to the Sort object.
218 // It may allocate some storage on the heap, which will be saved
219 // in the argument dataSave.
220 // The function freeSortKey must be called to free this storage.
221 virtual void makeSortKey(Sort&, std::shared_ptr<BaseCompare>& cmpObj, Int order,
222 std::shared_ptr<ArrayBase>& dataSave);
223
224 // Allocate value buffers for the table iterator.
225 // Also get a comparison functiuon if undefined.
226 // The function freeIterBuf must be called to free the buffers.
227 virtual void allocIterBuf(void*& lastVal, void*& curVal, std::shared_ptr<BaseCompare>& cmpObj);
228
229 // Free the value buffers allocated by allocIterBuf.
230 virtual void freeIterBuf(void*& lastVal, void*& curVal);
231
232 protected:
236};
237
238} // namespace casacore
239
240#endif
Non-templated base class for templated Array class.
Definition ArrayBase.h:69
virtual IPosition tileShape(rownr_t rownr) const
Get the tile shape of an array in a particular cell.
BaseColumn(const BaseColumnDesc *)
Construct it using the given column description.
virtual ColumnCache & columnCache()
Get the underlying column cache.
virtual TableRecord & keywordSet()
RefTable * refTabPtr_p
Definition RefColumn.h:233
virtual void setShape(rownr_t rownr, const IPosition &shape)
Set the shape of the array in the given row.
virtual void setShape(rownr_t rownr, const IPosition &shape, const IPosition &tileShape)
Set the shape and tile shape of the array in the given row.
virtual void put(rownr_t rownr, const void *dataPtr)
Put the value in a particular cell.
virtual void putSlice(rownr_t rownr, const Slicer &, const ArrayBase &dataPtr)
Put a slice of an N-dimensional array in a particular cell.
virtual void putColumnSliceCells(const RefRows &rownrs, const Slicer &, const ArrayBase &dataPtr)
Put subsections of some arrays in the column.
virtual uInt ndimColumn() const
Get the global #dimensions of an array (i.e.
virtual void get(rownr_t rownr, void *dataPtr) const
Get the value from a particular cell.
BaseColumn * colPtr_p
Definition RefColumn.h:234
virtual void getSlice(rownr_t rownr, const Slicer &, ArrayBase &dataPtr) const
Get a slice of an N-dimensional array in a particular cell.
void initialize(rownr_t startRownr, rownr_t endRownr)
Initialize the rows from startRownr till endRownr (inclusive) with the default value defined in the c...
virtual void freeIterBuf(void *&lastVal, void *&curVal)
Free the value buffers allocated by allocIterBuf.
virtual uInt ndim(rownr_t rownr) const
Get the #dimensions of an array in a particular cell.
virtual void putArrayColumnCells(const RefRows &rownrs, const ArrayBase &dataPtr)
Get the array of some array values in a column.
virtual void setMaximumCacheSize(uInt nbytes)
Set the maximum cache size (in bytes) to be used by a storage manager.
virtual void getArrayColumnCells(const RefRows &rownrs, ArrayBase &dataPtr) const
Get the array of some array values in a column.
virtual void allocIterBuf(void *&lastVal, void *&curVal, std::shared_ptr< BaseCompare > &cmpObj)
Allocate value buffers for the table iterator.
virtual void getScalarColumnCells(const RefRows &rownrs, ArrayBase &dataPtr) const
Get the vector of some scalar values in a column.
virtual void putScalarColumnCells(const RefRows &rownrs, const ArrayBase &dataPtr)
Get the vector of some scalar values in a column.
virtual void getScalarColumn(ArrayBase &dataPtr) const
Get the vector of all scalar values in a column.
ColumnCache colCache_p
Definition RefColumn.h:235
virtual void getColumnSliceCells(const RefRows &rownrs, const Slicer &, ArrayBase &dataPtr) const
Get subsections from some arrays in the column.
virtual TableRecord & rwKeywordSet()
Get access to the column keyword set.
virtual Bool isStored() const
Test if the column is stored (otherwise it is virtual).
virtual void getColumnSlice(const Slicer &, ArrayBase &dataPtr) const
Get subsections from all arrays in the column.
virtual IPosition shape(rownr_t rownr) const
Get the shape of an array in a particular cell.
virtual void putArray(rownr_t rownr, const ArrayBase &dataPtr)
Put the array value in a particular cell.
virtual Bool canChangeShape() const
It can change shape if the underlying column can.
virtual void putColumnSlice(const Slicer &, const ArrayBase &dataPtr)
Put into subsections of all table arrays in the column.
RefColumn(const BaseColumnDesc *, RefTable *, BaseColumn *referencedColumn)
Construct the RefColumn.
virtual void getArray(rownr_t rownr, ArrayBase &dataPtr) const
Get an array from a particular cell.
virtual Bool isWritable() const
Test if the column is writable in the parent table.
virtual Bool isDefined(rownr_t rownr) const
Test if a value in a particular cell has been defined.
virtual rownr_t nrow() const
Get nr of rows in the column.
virtual void getArrayColumn(ArrayBase &dataPtr) const
Get the array of all array values in a column.
virtual void putScalarColumn(const ArrayBase &dataPtr)
Put the vector of all scalar values in the column.
virtual void makeSortKey(Sort &, std::shared_ptr< BaseCompare > &cmpObj, Int order, std::shared_ptr< ArrayBase > &dataSave)
Add this column and its data to the Sort object.
virtual IPosition shapeColumn() const
Get the global shape of an array (i.e.
virtual void putArrayColumn(const ArrayBase &dataPtr)
Put the array of all array values in the column.
Sort on one or more keys, ascending and/or descending.
Definition Sort.h:239
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
uInt order() const
What is the order of the polynomial, i.e.
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44