casacore
Loading...
Searching...
No Matches
PlainColumn.h
Go to the documentation of this file.
1//# PlainColumn.h: Base class for a column in a plain table
2//# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001
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_PLAINCOLUMN_H
27#define TABLES_PLAINCOLUMN_H
28
29
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Arrays/ArrayFwd.h>
33#include <casacore/tables/Tables/BaseColumn.h>
34#include <casacore/tables/Tables/ColumnSet.h>
35#include <casacore/tables/Tables/TableRecord.h>
36
37namespace casacore { //# NAMESPACE CASACORE - BEGIN
38
39//# Forward Declarations
40class TableAttr;
41class BaseColumnDesc;
42class DataManager;
43class DataManagerColumn;
44class AipsIO;
45class IPosition;
46
47
48// <summary>
49// Base class for a column in a plain table
50// </summary>
51
52// <use visibility=local>
53
54// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
55// </reviewed>
56
57// <prerequisite>
58//# Classes you should understand before using this one.
59// <li> BaseColumn
60// <li> PlainTable
61// </prerequisite>
62
63// <etymology>
64// PlainColumn represents any column in a plain table.
65// A plain table is a regular table, i.e. not a table like a
66// RefTable which is a view on a plain table.
67// </etymology>
68
69// <synopsis>
70// Abstract base class for all types of columns in a plain table.
71// It implements the common functionality for all columns in a plain
72// table. Furthermore it defines some virtual functions (on top of
73// the virtual functions defined in BaseColumn) which are specific for
74// plain columns.
75// </synopsis>
76
77// <todo asof="$DATE:$">
78//# A List of bugs, limitations, extensions or planned refinements.
79// </todo>
80
81
82class PlainColumn : public BaseColumn
83{
84public:
85
87
88 virtual ~PlainColumn();
89
90 // Test if the column is in principle writable.
91 // This does not test if the table itself is writable.
92 // That has to be done by the caller.
93 virtual Bool isWritable() const;
94
95 // Test if the column is stored (otherwise it is virtual).
96 virtual Bool isStored() const;
97
98 // Get access to the column keyword set.
99 // <group>
102 // </group>
103
104 // Get nr of rows in the column.
105 rownr_t nrow() const;
106
107 // Define the shape of all arrays in the column.
108 virtual void setShapeColumn (const IPosition& shape);
109
110 // Test if the column is bound to a storage manager or
111 // virtual column engine.
112 virtual Bool isBound() const;
113
114 // Bind the column to a data manager.
115 virtual void bind (DataManager*);
116
117 // Create a data manager column for a filled column.
118 virtual void createDataManagerColumn() = 0;
119
120 // Get the pointer to the data manager.
121 DataManager* dataManager() const;
122
123 // Get the pointer to the data manager column.
125
126 // Get a pointer to the underlying column cache.
128
129 // Set the maximum cache size (in bytes) to be used by a storage manager.
130 virtual void setMaximumCacheSize (uInt nbytes);
131
132 // Write the column.
133 void putFile (AipsIO&, const TableAttr&);
134
135 // Read the column.
136 void getFile (AipsIO&, const ColumnSet&, const TableAttr&);
137
138protected:
139 DataManager* dataManPtr_p; //# Pointer to data manager.
140 DataManagerColumn* dataColPtr_p; //# Pointer to column in data manager.
142 String originalName_p; //# Column name before any rename
143 Bool rtraceColumn_p; //# trace reads of the column?
144 Bool wtraceColumn_p; //# trace writes of the column?
145
146 // Get the trace-id of the table.
147 int traceId() const
148 { return colSetPtr_p->traceId(); }
149
150 // Write the column.
151 // The control information is written into the given AipsIO object,
152 // while the data is written by the storage manager.
153 virtual void putFileDerived (AipsIO&) = 0;
154
155 // Read the column back.
156 // The control information is read from the given AipsIO object.
157 // This is used to bind the column to the appropriate data manager.
158 virtual void getFileDerived (AipsIO&, const ColumnSet&) = 0;
159
160 // Check the length of a value.
161 // This a meant for String values for which a maximum length is defined.
162 // The void* version is a no-op for other values.
163 // <group>
164 void checkValueLength (const void*) const;
165 void checkValueLength (const String* value) const;
167 // </group>
168
169 // Lock the table before reading or writing.
170 // If manual or permanent locking is in effect, it checks if
171 // the table is locked.
172 // <group>
173 void checkReadLock (Bool wait) const;
174 void checkWriteLock (Bool wait) const;
175 // </group>
176
177 // Inspect the auto lock when the inspection interval has expired and
178 // release it when another process needs the lock.
179 void autoReleaseLock() const;
180};
181
182
184 { return dataManPtr_p; }
187
188inline void PlainColumn::checkValueLength (const void*) const
189 {}
190
191inline void PlainColumn::checkReadLock (Bool wait) const
192 { colSetPtr_p->checkReadLock (wait); }
193inline void PlainColumn::checkWriteLock (Bool wait) const
194 { colSetPtr_p->checkWriteLock (wait); }
197
198
199
200} //# NAMESPACE CASACORE - END
201
202#endif
virtual IPosition shape(rownr_t rownr) const
Get the shape of an array in a particular cell.
void autoReleaseLock()
Inspect the auto lock when the inspection interval has expired and release it when another process ne...
Definition ColumnSet.h:368
void checkReadLock(Bool wait)
Check if the table is locked for read or write.
Definition ColumnSet.h:349
int traceId() const
Get the trace-id of the table.
Definition ColumnSet.h:215
void checkWriteLock(Bool wait)
Definition ColumnSet.h:356
Abstract base class for a data manager.
DataManager * dataManager() const
Get the pointer to the data manager.
virtual Bool isStored() const
Test if the column is stored (otherwise it is virtual).
DataManager * dataManPtr_p
virtual Bool isBound() const
Test if the column is bound to a storage manager or virtual column engine.
virtual Bool isWritable() const
Test if the column is in principle writable.
virtual void bind(DataManager *)
Bind the column to a data manager.
virtual void putFileDerived(AipsIO &)=0
Write the column.
TableRecord & rwKeywordSet()
Get access to the column keyword set.
virtual void createDataManagerColumn()=0
Create a data manager column for a filled column.
virtual void setMaximumCacheSize(uInt nbytes)
Set the maximum cache size (in bytes) to be used by a storage manager.
PlainColumn(const BaseColumnDesc *, ColumnSet *)
ColumnSet * colSetPtr_p
virtual void getFileDerived(AipsIO &, const ColumnSet &)=0
Read the column back.
void autoReleaseLock() const
Inspect the auto lock when the inspection interval has expired and release it when another process ne...
TableRecord & keywordSet()
DataManagerColumn * dataColPtr_p
void checkReadLock(Bool wait) const
Lock the table before reading or writing.
virtual ColumnCache & columnCache()
Get a pointer to the underlying column cache.
void getFile(AipsIO &, const ColumnSet &, const TableAttr &)
Read the column.
void checkValueLength(const void *) const
Check the length of a value.
DataManagerColumn *& dataManagerColumn()
Get the pointer to the data manager column.
void checkWriteLock(Bool wait) const
int traceId() const
Get the trace-id of the table.
void checkValueLength(const Array< String > *value) const
void checkValueLength(const String *value) const
virtual void setShapeColumn(const IPosition &shape)
Define the shape of all arrays in the column.
void putFile(AipsIO &, const TableAttr &)
Write the column.
rownr_t nrow() const
Get nr of rows in the column.
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44