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// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/ArrayFwd.h>
32#include <casacore/tables/Tables/BaseColumn.h>
33#include <casacore/tables/Tables/ColumnSet.h>
34#include <casacore/tables/Tables/TableRecord.h>
35
36namespace casacore { // # NAMESPACE CASACORE - BEGIN
37
38// # Forward Declarations
39class TableAttr;
40class BaseColumnDesc;
41class DataManager;
43class AipsIO;
44class IPosition;
45
46// <summary>
47// Base class for a column in a plain 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> BaseColumn
58// <li> PlainTable
59// </prerequisite>
60
61// <etymology>
62// PlainColumn represents any column in a plain table.
63// A plain table is a regular table, i.e. not a table like a
64// RefTable which is a view on a plain table.
65// </etymology>
66
67// <synopsis>
68// Abstract base class for all types of columns in a plain table.
69// It implements the common functionality for all columns in a plain
70// table. Furthermore it defines some virtual functions (on top of
71// the virtual functions defined in BaseColumn) which are specific for
72// plain columns.
73// </synopsis>
74
75// <todo asof="$DATE:$">
76// # A List of bugs, limitations, extensions or planned refinements.
77// </todo>
78
79class PlainColumn : public BaseColumn {
80 public:
82
83 virtual ~PlainColumn();
84
85 // Test if the column is in principle writable.
86 // This does not test if the table itself is writable.
87 // That has to be done by the caller.
88 virtual Bool isWritable() const;
89
90 // Test if the column is stored (otherwise it is virtual).
91 virtual Bool isStored() const;
92
93 // Get access to the column keyword set.
94 // <group>
97 // </group>
98
99 // Get nr of rows in the column.
100 rownr_t nrow() const;
101
102 // Define the shape of all arrays in the column.
103 virtual void setShapeColumn(const IPosition& shape);
104
105 // Test if the column is bound to a storage manager or
106 // virtual column engine.
107 virtual Bool isBound() const;
108
109 // Bind the column to a data manager.
110 virtual void bind(DataManager*);
111
112 // Create a data manager column for a filled column.
113 virtual void createDataManagerColumn() = 0;
114
115 // Get the pointer to the data manager.
116 DataManager* dataManager() const;
117
118 // Get the pointer to the data manager column.
120
121 // Get a pointer to the underlying column cache.
123
124 // Set the maximum cache size (in bytes) to be used by a storage manager.
125 virtual void setMaximumCacheSize(uInt nbytes);
126
127 // Write the column.
128 void putFile(AipsIO&, const TableAttr&);
129
130 // Read the column.
131 void getFile(AipsIO&, const ColumnSet&, const TableAttr&);
132
133 protected:
134 DataManager* dataManPtr_p; // # Pointer to data manager.
135 DataManagerColumn* dataColPtr_p; // # Pointer to column in data manager.
137 String originalName_p; // # Column name before any rename
138 Bool rtraceColumn_p; // # trace reads of the column?
139 Bool wtraceColumn_p; // # trace writes of the column?
140
141 // Get the trace-id of the table.
142 int traceId() const { return colSetPtr_p->traceId(); }
143
144 // Write the column.
145 // The control information is written into the given AipsIO object,
146 // while the data is written by the storage manager.
147 virtual void putFileDerived(AipsIO&) = 0;
148
149 // Read the column back.
150 // The control information is read from the given AipsIO object.
151 // This is used to bind the column to the appropriate data manager.
152 virtual void getFileDerived(AipsIO&, const ColumnSet&) = 0;
153
154 // Check the length of a value.
155 // This a meant for String values for which a maximum length is defined.
156 // The void* version is a no-op for other values.
157 // <group>
158 void checkValueLength(const void*) const;
159 void checkValueLength(const String* value) const;
161 // </group>
162
163 // Lock the table before reading or writing.
164 // If manual or permanent locking is in effect, it checks if
165 // the table is locked.
166 // <group>
167 void checkReadLock(Bool wait) const;
168 void checkWriteLock(Bool wait) const;
169 // </group>
170
171 // Inspect the auto lock when the inspection interval has expired and
172 // release it when another process needs the lock.
173 void autoReleaseLock() const;
174};
175
178
179inline void PlainColumn::checkValueLength(const void*) const {}
180
181inline void PlainColumn::checkReadLock(Bool wait) const { colSetPtr_p->checkReadLock(wait); }
182inline void PlainColumn::checkWriteLock(Bool wait) const { colSetPtr_p->checkWriteLock(wait); }
183inline void PlainColumn::autoReleaseLock() const { colSetPtr_p->autoReleaseLock(); }
184
185} // namespace casacore
186
187#endif
virtual IPosition shape(rownr_t rownr) const
Get the shape of an array in a particular cell.
BaseColumn(const BaseColumnDesc *)
Construct it using the given column description.
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:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:360
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44