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