casacore
Loading...
Searching...
No Matches
ScaRecordColData.h
Go to the documentation of this file.
1// # ScaRecordColData.h: Access to a table column containing scalar records
2// # Copyright (C) 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_SCARECORDCOLDATA_H
27#define TABLES_SCARECORDCOLDATA_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/ArrayFwd.h>
32#include <casacore/tables/Tables/PlainColumn.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36// # Forward Declarations
37class ColumnSet;
39class AipsIO;
40
41// <summary>
42// Access to a table column containing scalar records.
43// </summary>
44
45// <use visibility=local>
46
47// <reviewed reviewer="Wim Brouw" date="1998/12/09" tests="tRecordColumn.cc">
48// </reviewed>
49
50// <prerequisite>
51// # Classes you should understand before using this one.
52// <li> <linkto class=PlainColumn>PlainColumn</linkto>
53// <li> <linkto class=ScalarRecordColumnDesc>ScalarRecordColumnDesc</linkto>
54// <li> <linkto class=Table>Table</linkto>
55// </prerequisite>
56
57// <etymology>
58// ScalarRecordColumnData represents a table column containing scalars.
59// </etymology>
60
61// <synopsis>
62// The class ScalarRecordColumnData is derived from PlainColumn.
63// It implements the virtual functions accessing a table column
64// containing scalars holding records.
65// <br>
66// It is possible to access an scalar in an individual cell (i.e. table row)
67// or in the entire column.
68// <p>
69// The main task of this class is to communicate with the data manager
70// column object. This consists of:
71// <ul>
72// <li> Binding itself to a data manager.
73// <li> Letting the data manager create its column object.
74// <li> Closing the data manager column object (in putFileDerived).
75// <li> Reconstructing the data manager object for an existing table
76// (in getFileDerived).
77// <li> Transferring get/put calls to the data manager column object.
78// </ul>
79//
80// The class is hidden from the user by the envelope class ScalarColumn.
81// If used directly by other Table classes, it should be done with care.
82// It assumes that the arrays in the various get and put functions have
83// the correct length. ScalarColumn does that check.
84// </synopsis>
85
86// <todo asof="$DATE:$">
87// # A List of bugs, limitations, extensions or planned refinements.
88// <li> Introduce a class ArrayRecordColumnData to support arrays of records.
89// </todo>
90
92 public:
93 // Construct a scalar column object from the given description
94 // in the given column set.
95 // This constructor is used by ScalarRecordColumnDesc::makeColumn.
97
99
100 // Copy constructor cannot be used.
102
103 // Assignment cannot be used.
105
106 // Initialize the rows from startRownr till endRownr (inclusive)
107 // with the default value defined in the column description.
108 virtual void initialize(rownr_t startRownr, rownr_t endRownr);
109
110 // Test if the given cell contains a defined value.
111 virtual Bool isDefined(rownr_t rownr) const;
112
113 // Get the value from a particular cell.
114 virtual void get(rownr_t rownr, void*) const;
115
116 // Get the array of all values in the column.
117 // The length of the buffer pointed to by dataPtr must match
118 // the actual length. This is checked by ScalarColumn.
119 virtual void getScalarColumn(ArrayBase& dataPtr) const;
120
121 // Get the array of some values in the column (on behalf of RefColumn).
122 // The length of the buffer pointed to by dataPtr must match
123 // the actual length. This is checked by ScalarColumn.
124 virtual void getScalarColumnCells(const RefRows& rownrs, ArrayBase& dataPtr) const;
125
126 // Put the value in a particular cell.
127 // The length of the buffer pointed to by dataPtr must match
128 // the actual length. This is checked by ScalarColumn.
129 virtual void put(rownr_t rownr, const void* dataPtr);
130
131 // Put the array of all values in the column.
132 // The length of the buffer pointed to by dataPtr must match
133 // the actual length. This is checked by ScalarColumn.
134 virtual void putScalarColumn(const ArrayBase& dataPtr);
135
136 // Put the array of some values in the column (on behalf on RefColumn).
137 // The length of the buffer pointed to by dataPtr must match
138 // the actual length. This is checked by ScalarColumn.
139 virtual void putScalarColumnCells(const RefRows& rownrs, const ArrayBase& dataPtr);
140
141 // Add this column and its data to the Sort object.
142 // Sorting on records is not supported, so an exception is thrown.
143 // <group>
144 virtual void makeSortKey(Sort&, std::shared_ptr<BaseCompare>& cmpObj, Int order,
145 std::shared_ptr<ArrayBase>& dataSave);
146 // Do it only for the given row numbers.
147 virtual void makeRefSortKey(Sort&, std::shared_ptr<BaseCompare>& cmpObj, Int order,
148 const Vector<rownr_t>& rownrs, std::shared_ptr<ArrayBase>& dataSave);
149 // </group>
150
151 // Allocate value buffers for the table iterator.
152 // Iteration based on records is not supported, so an exception is thrown.
153 virtual void allocIterBuf(void*& lastVal, void*& curVal, std::shared_ptr<BaseCompare>& cmpObj);
154
155 // Free the value buffers allocated by allocIterBuf.
156 virtual void freeIterBuf(void*& lastVal, void*& curVal);
157
158 // Create a data manager column object for this column.
160
161 private:
162 // Write the column data.
163 // The control information is written into the given AipsIO object,
164 // while the data is written/flushed by the data manager.
165 virtual void putFileDerived(AipsIO&);
166
167 // Read the column data back.
168 // The control information is read from the given AipsIO object.
169 // This is used to bind the column to the appropriate data manager.
170 // Thereafter the data manager gets opened.
171 virtual void getFileDerived(AipsIO&, const ColumnSet&);
172
173 // Handle getting and putting a record.
174 // It is stored as a Vector of uChar.
175 // <group>
176 void getRecord(rownr_t rownr, TableRecord& rec) const;
177 void putRecord(rownr_t rownr, const TableRecord& rec);
178 // </group>
179};
180
181} // namespace casacore
182
183#endif
Non-templated base class for templated Array class.
Definition ArrayBase.h:69
PlainColumn(const BaseColumnDesc *, ColumnSet *)
virtual void getScalarColumnCells(const RefRows &rownrs, ArrayBase &dataPtr) const
Get the array of some values in the column (on behalf of RefColumn).
virtual void putFileDerived(AipsIO &)
Write the column data.
virtual void getFileDerived(AipsIO &, const ColumnSet &)
Read the column data back.
virtual void putScalarColumn(const ArrayBase &dataPtr)
Put the array of all values in the column.
ScalarRecordColumnData(const ScalarRecordColumnData &)=delete
Copy constructor cannot be used.
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 void putScalarColumnCells(const RefRows &rownrs, const ArrayBase &dataPtr)
Put the array of some values in the column (on behalf on RefColumn).
virtual 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 put(rownr_t rownr, const void *dataPtr)
Put the value in a particular cell.
virtual Bool isDefined(rownr_t rownr) const
Test if the given cell contains a defined value.
ScalarRecordColumnData & operator=(const ScalarRecordColumnData &)=delete
Assignment cannot be used.
virtual void freeIterBuf(void *&lastVal, void *&curVal)
Free the value buffers allocated by allocIterBuf.
virtual void getScalarColumn(ArrayBase &dataPtr) const
Get the array of all values in the column.
virtual void allocIterBuf(void *&lastVal, void *&curVal, std::shared_ptr< BaseCompare > &cmpObj)
Allocate value buffers for the table iterator.
virtual void makeRefSortKey(Sort &, std::shared_ptr< BaseCompare > &cmpObj, Int order, const Vector< rownr_t > &rownrs, std::shared_ptr< ArrayBase > &dataSave)
Do it only for the given row numbers.
void getRecord(rownr_t rownr, TableRecord &rec) const
Handle getting and putting a record.
virtual void get(rownr_t rownr, void *) const
Get the value from a particular cell.
void putRecord(rownr_t rownr, const TableRecord &rec)
virtual void createDataManagerColumn()
Create a data manager column object for this column.
ScalarRecordColumnData(const ScalarRecordColumnDesc *, ColumnSet *)
Construct a scalar column object from the given description in the given column set.
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
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