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