casacore
BaseTable.h
Go to the documentation of this file.
1 //# BaseTable.h: Abstract base class for tables
2 //# Copyright (C) 1994,1995,1996,1997,1998,2000,2001,2002,2003
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: aips2-request@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 //# $Id$
27 
28 #ifndef TABLES_BASETABLE_H
29 #define TABLES_BASETABLE_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/tables/Tables/TableInfo.h>
35 #include <casacore/tables/Tables/TableDesc.h>
36 #include <casacore/tables/Tables/StorageOption.h>
37 #include <casacore/casa/Utilities/Compare.h>
38 #include <casacore/casa/Utilities/CountedPtr.h>
39 #include <casacore/casa/BasicSL/String.h>
40 #include <casacore/casa/IO/FileLocker.h>
41 
42 namespace casacore { //# NAMESPACE CASACORE - BEGIN
43 
44 //# Forward Declarations
45 class RefTable;
46 // class TableDesc; !Forward declaration not recognized SGI compiler
47 class TableLock;
48 class BaseColumn;
49 class ColumnDesc;
50 class TableRecord;
51 class Record;
52 class TableExprNode;
53 class BaseTableIterator;
54 class DataManager;
55 class IPosition;
56 template<class T> class Vector;
57 template<class T> class Block;
58 template<class T> class PtrBlock;
59 class AipsIO;
60 
61 
62 // <summary>
63 // Abstract base class for tables
64 // </summary>
65 
66 // <use visibility=local>
67 
68 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
69 // </reviewed>
70 
71 // <prerequisite>
72 //# Classes you should understand before using this one.
73 // <li> Table
74 // <li> Sort
75 // <li> TableExprNode
76 // </prerequisite>
77 
78 // <etymology>
79 // BaseTable is the (abstract) base class for different kind of tables.
80 // </etymology>
81 
82 // <synopsis>
83 // BaseTables defines many virtual functions, which are actually
84 // implemented in the underlying table classes like PlainTable and
85 // RefTable. Other functions like sort and select are implemented
86 // in BaseTable itself.
87 //
88 // The functions in BaseTable and its derived classes can only be
89 // used by the table system classes. All user access is via the
90 // envelope class Table, which references (counted) BaseTable.
91 // </synopsis>
92 
93 // <todo asof="$DATE:$">
94 //# A List of bugs, limitations, extensions or planned refinements.
95 // <li> Implement function renameColumn, removeColumn.
96 // </todo>
97 
98 
99 class BaseTable
100 {
101 public:
102 
103  // Initialize the object.
104  BaseTable (const String& tableName, int tableOption, uInt nrrow);
105 
106  virtual ~BaseTable();
107 
108  // Link to this BaseTable object (i.e. increase reference count).
109  void link();
110 
111  // Unlink from a BaseTable.
112  // Delete it if no more references.
113  static void unlink (BaseTable*);
114 
115  // Is the table a null table?
116  // By default it is not.
117  virtual Bool isNull() const;
118 
119  // Reopen the table for read/write.
120  virtual void reopenRW() = 0;
121 
122  // Is the table stored in big or little endian format?
123  virtual Bool asBigEndian() const = 0;
124 
125  // Get the storage option used for the table.
126  virtual const StorageOption& storageOption() const = 0;
127 
128  // Is the table in use (i.e. open) in another process?
129  // If <src>checkSubTables</src> is set, it is also checked if
130  // a subtable is used in another process.
131  virtual Bool isMultiUsed(Bool checkSubTables) const = 0;
132 
133  // Get the locking info.
134  virtual const TableLock& lockOptions() const = 0;
135 
136  // Merge the given lock info with the existing one.
137  virtual void mergeLock (const TableLock& lockOptions) = 0;
138 
139  // Has this process the read or write lock, thus can the table
140  // be read or written safely?
141  virtual Bool hasLock (FileLocker::LockType) const = 0;
142 
143  // Try to lock the table for read or write access.
144  virtual Bool lock (FileLocker::LockType, uInt nattempts) = 0;
145 
146  // Unlock the table. This will also synchronize the table data,
147  // thus force the data to be written to disk.
148  virtual void unlock() = 0;
149 
150  // Flush the table, i.e. write it to disk.
151  virtual void flush (Bool fsync, Bool recursive) = 0;
152 
153  // Resync the Table object with the table file.
154  virtual void resync() = 0;
155 
156  // Get the modify counter.
157  virtual uInt getModifyCounter() const = 0;
158 
159  // Set the table to being changed. By default it does nothing.
160  virtual void setTableChanged();
161 
162  // Do not write the table (used in in case of exceptions).
163  void doNotWrite()
164  { noWrite_p = True; }
165 
166  // Test if this table is writable.
167  // This tells if values can be put into a column.
168  virtual Bool isWritable() const = 0;
169 
170  // Test if the given column is writable.
171  // <group>
172  Bool isColumnWritable (const String& columnName) const;
173  Bool isColumnWritable (uInt columnIndex) const;
174  // </group>
175 
176  // Test if the given column is stored (otherwise it is virtual).
177  // <group>
178  Bool isColumnStored (const String& columnName) const;
179  Bool isColumnStored (uInt columnIndex) const;
180  // </group>
181 
182  // Get the table name.
183  const String& tableName() const
184  { return name_p; }
185 
186  // Get the names of the tables this table consists of.
187  // The default implementation adds the name of this table to the block.
188  virtual void getPartNames (Block<String>& names, Bool recursive) const;
189 
190  // Rename the table.
191  // The following options can be given:
192  // <dl>
193  // <dt> Table::Update
194  // <dd> A table with this name must already exists, which will be
195  // overwritten. When succesfully renamed, the table is unmarked
196  // for delete (if necessary).
197  // <dt> Table::New
198  // <dd> When a table with this name exists, it will be overwritten.
199  // When succesfully renamed, the table is unmarked
200  // for delete (if necessary).
201  // <dt> Table::NewNoReplace
202  // <dd> When a table with this name already exists, an exception
203  // is thrown. When succesfully renamed, the table
204  // is unmarked for delete (if necessary).
205  // <dt> Table::Scratch
206  // <dd> Same as Table::New, but followed by markForDelete().
207  // </dl>
208  // The rename function in this base class renames the table file.
209  // In a derived class (e.g. PlainTable) the function should also
210  // be implemented to rename subtables in its keywords.
211  virtual void rename (const String& newName, int tableOption);
212 
213  // Copy the table and all its subtables.
214  // The default implementation of deepCopy is to call copy.
215  // The following options can be given:
216  // <dl>
217  // <dt> Table::New
218  // <dd> When a table with this name exists, it will be overwritten.
219  // <dt> Table::NewNoReplace
220  // <dd> When a table with this name already exists, an exception
221  // is thrown.
222  // <dt> Table::Scratch
223  // <dd> Same as Table::New, but followed by markForDelete().
224  // </dl>
225  // <group>
226  virtual void copy (const String& newName, int tableOption) const;
227  virtual void deepCopy (const String& newName,
228  const Record& dataManagerInfo,
229  int tableOption,
230  Bool valueCopy,
231  int endianFormat,
232  Bool noRows) const;
233  // </group>
234 
235  // Get the table type.
236  // By default it returns Table::Plain.
237  virtual int tableType() const;
238 
239  // Get the table option.
240  int tableOption() const
241  { return option_p; }
242 
243  // Mark the table for delete.
244  // This means that the underlying table gets deleted when it is
245  // actually destructed.
246  // The scratchCallback function is called when needed.
247  void markForDelete (Bool callback, const String& oldName);
248 
249  // Unmark the table for delete.
250  // This means the underlying table does not get deleted when destructed.
251  // The scratchCallback function is called when needed.
252  void unmarkForDelete (Bool callback, const String& oldName);
253 
254  // Test if the table is marked for delete.
256  { return delete_p; }
257 
258  // Get the table description.
259  const TableDesc& tableDesc() const
260  { return (tdescPtr_p == 0 ? makeTableDesc() : *tdescPtr_p); }
261 
262  // Get the actual table description.
263  virtual TableDesc actualTableDesc() const = 0;
264 
265  // Get the data manager info.
266  virtual Record dataManagerInfo() const = 0;
267 
268  // Show the table structure (implementation of Table::showStructure).
269  void showStructure (std::ostream&,
270  Bool showDataMan,
271  Bool showColumns,
272  Bool showSubTables,
273  Bool sortColumns);
274 
275  // Get readonly access to the table keyword set.
276  virtual TableRecord& keywordSet() = 0;
277 
278  // Get read/write access to the table keyword set.
279  // This requires that the table is locked (or it gets locked
280  // when using AutoLocking mode).
281  virtual TableRecord& rwKeywordSet() = 0;
282 
283  // Get access to the TableInfo object.
285  { return info_p; }
286 
287  // Get the table info of the table with the given name.
288  // An empty object is returned when the table is unknown.
289  static TableInfo tableInfo (const String& tableName);
290 
291  // Write the TableInfo object.
292  virtual void flushTableInfo();
293 
294  // Get number of rows.
295  uInt nrow() const
296  { return nrrow_p; }
297 
298  // Get a column object using its index.
299  virtual BaseColumn* getColumn (uInt columnIndex) const = 0;
300 
301  // Get a column object using its name.
302  virtual BaseColumn* getColumn (const String& columnName) const = 0;
303 
304  // Test if it is possible to add a row to this table.
305  virtual Bool canAddRow() const;
306 
307  // Add one or more rows and possibly initialize them.
308  // This will fail for tables not supporting addition of rows.
309  virtual void addRow (uInt nrrow = 1, Bool initialize = True);
310 
311  // Test if it is possible to remove a row from this table.
312  virtual Bool canRemoveRow() const;
313 
314  // Remove rows.
315  // This will fail for tables not supporting removal of rows.
316  // <note role=tip>
317  // The following code fragments do NOT have the same result:
318  // <srcblock>
319  // tab.removeRow (10); // remove row 10
320  // tab.removeRow (20); // remove row 20, which was 21
321  //
322  // Vector<uInt> vec(2);
323  // vec(0) = 10;
324  // vec(1) = 20;
325  // tab.removeRow (vec); // remove row 10 and 20
326  // </srcblock>
327  // because in the first fragment removing row 10 turns the former
328  // row 21 into row 20.
329  // </note>
330  // <group>
331  virtual void removeRow (uInt rownr);
332  void removeRow (const Vector<uInt>& rownrs);
333  // </group>
334 
335  // Find the data manager with the given name or for the given column.
336  virtual DataManager* findDataManager (const String& name,
337  Bool byColumn) const = 0;
338 
339  // Select rows using the given expression (which can be null).
340  // Skip first <src>offset</src> matching rows.
341  // Return at most <src>maxRow</src> matching rows.
342  BaseTable* select (const TableExprNode&, uInt maxRow, uInt offset);
343 
344  // Select maxRow rows and skip first offset rows. maxRow=0 means all.
345  BaseTable* select (uInt maxRow, uInt offset);
346 
347  // Select rows using a vector of row numbers.
348  BaseTable* select (const Vector<uInt>& rownrs);
349 
350  // Select rows using a mask block.
351  // The length of the block must match the number of rows in the table.
352  // If True, the corresponding row will be selected.
353  BaseTable* select (const Block<Bool>& mask);
354 
355  // Project the given columns (i.e. select the columns).
356  BaseTable* project (const Block<String>& columnNames);
357 
358  //# Virtually concatenate all tables in this column.
359  //# The column cells must contain tables with the same description.
360 //#// BaseTable* concatenate (const String& columnName);
361 
362  // Do logical operations on a table.
363  // <group>
364  // intersection with another table
366  // union with another table
368  // subtract another table
370  // xor with another table
372  // take complement
373  BaseTable* tabNot ();
374  // </group>
375 
376  // Sort a table on one or more columns of scalars.
377  BaseTable* sort (const Block<String>& columnNames,
378  const Block<CountedPtr<BaseCompare> >& compareObjects,
379  const Block<Int>& sortOrder, int sortOption);
380 
381  // Create an iterator.
382  BaseTableIterator* makeIterator (const Block<String>& columnNames,
384  const Block<Int>& orders, int option);
385 
386  // Add one or more columns to the table.
387  // The default implementation throws an "invalid operation" exception.
388  // <group>
389  virtual void addColumn (const ColumnDesc& columnDesc, Bool addToParent);
390  virtual void addColumn (const ColumnDesc& columnDesc,
391  const String& dataManager, Bool byName,
392  Bool addToParent);
393  virtual void addColumn (const ColumnDesc& columnDesc,
394  const DataManager& dataManager, Bool addToParent);
395  virtual void addColumn (const TableDesc& tableDesc,
396  const DataManager& dataManager, Bool addToParent);
397  // </group>
398 
399  // Add one or more columns to the table.
400  // The data manager to use is described in the record.
401  void addColumns (const TableDesc& tableDesc, const Record& dmInfo,
402  Bool addToParent);
403 
404  // Test if columns can be removed.
405  virtual Bool canRemoveColumn (const Vector<String>& columnNames) const = 0;
406 
407  // Remove columns.
408  virtual void removeColumn (const Vector<String>& columnNames) = 0;
409 
410  // Check if the set of columns can be removed.
411  // It checks if columns have not been specified twice and it
412  // checks if they exist.
413  // If the flag is set an exception is thrown if errors are found.
414  Bool checkRemoveColumn (const Vector<String>& columnNames,
415  Bool throwException) const;
416 
417  // Test if a column can be renamed.
418  virtual Bool canRenameColumn (const String& columnName) const = 0;
419 
420  // Rename a column.
421  virtual void renameColumn (const String& newName,
422  const String& oldName) = 0;
423 
424  // Rename a hypercolumn.
425  virtual void renameHypercolumn (const String& newName,
426  const String& oldName) = 0;
427 
428  // Get a vector of row numbers.
429  // By default it returns the row numbers 0..nrrow()-1.
430  // It needs to be implemented for RefTable only.
431  virtual Vector<uInt> rowNumbers() const;
432 
433  // Get pointer to root table (i.e. parent of a RefTable).
434  // Default it is this table.
435  // It is meant for the reference tables after a select or sort which
436  // can then still name their parent as the root.
437  virtual BaseTable* root();
438 
439  // Tell if the table is in row order.
440  // By default it is, since normally a table is always in row order.
441  // It is meant for RefTable-s, where the rows can be in
442  // another (sorted) order.
443  virtual Bool rowOrder() const;
444 
445  // By the default the table cannot return the storage of rownrs.
446  // That can only be done by a RefTable, where it is implemented.
447  virtual Vector<uInt>* rowStorage();
448 
449  // Adjust the row numbers to be the actual row numbers in the
450  // root table. This is, for instance, used when a RefTable is sorted.
451  // Optionally it also determines if the resulting rows are in order.
452  virtual Bool adjustRownrs (uInt nrrow, Vector<uInt>& rownrs,
453  Bool determineOrder) const;
454 
455  // Do the actual sort.
456  // The default implementation is suitable for almost all cases.
457  // Only in RefTable a smarter implementation is provided.
460  const Block<Int>& sortOrder,
461  int sortOption);
462 
463  // Create a RefTable object.
464  RefTable* makeRefTable (Bool rowOrder, uInt initialNrrow);
465 
466  // Check if the row number is valid.
467  // It throws an exception if out of range.
468  void checkRowNumber (uInt rownr) const
469  { if (rownr >= nrrow_p + nrrowToAdd_p) checkRowNumberThrow (rownr); }
470 
471  // Get the table's trace-id.
472  int traceId() const
473  { return itsTraceId; }
474 
475 
476 protected:
477  uInt nrlink_p; //# #references to this table
478  uInt nrrow_p; //# #rows in this table
479  uInt nrrowToAdd_p; //# #rows to be added
480  TableDesc* tdescPtr_p; //# Pointer to table description
481  String name_p; //# table name
482  int option_p; //# Table constructor option
483  Bool noWrite_p; //# False = do not write the table
484  Bool delete_p; //# True = delete when destructed
485  TableInfo info_p; //# Table information (type, etc.)
486  Bool madeDir_p; //# True = table dir has been created
487  int itsTraceId; //# table-id for TableTrace tracing
488 
489 
490  // Do the callback for scratch tables (if callback is set).
491  void scratchCallback (Bool isScratch, const String& oldName) const;
492 
493  // Create the table directory when needed (and possible).
494  // When the file already exists, check if it is a directory.
495  // It returns True when it actually created the directory.
496  Bool makeTableDir();
497 
498  // Make a true deep copy of the table.
499  void trueDeepCopy (const String& newName,
500  const Record& dataManagerInfo,
501  int tableOption,
502  int endianFormat,
503  Bool noRows) const;
504 
505  // Prepare for copying or renaming a table.
506  // It checks if the target table already exists and removes it
507  // when necessary.
508  void prepareCopyRename (const String& newName, int tableOption) const;
509 
510  // Rename the subtables (used by rename function).
511  virtual void renameSubTables (const String& newName,
512  const String& oldName);
513 
514  // Check if the table already exists.
515  // Throw an exception if so.
516  void throwIfTableExists();
517 
518  // Test if the table is opened for write.
519  Bool openedForWrite() const;
520 
521  // Start writing a table. It does a putstart and writes <src>nrrow_p</src>.
522  // It should be ended by calling <src>writeEnd</src>.
523  void writeStart (AipsIO&, Bool bigEndian);
524 
525  // End writing a table.
526  void writeEnd (AipsIO&);
527 
528  // Should the table be written.
529  // This flag is False if an exception was thrown.
531  { return noWrite_p; }
532 
533  // Read the TableInfo object.
534  void getTableInfo();
535 
536 private:
537  // Copy constructor is forbidden, because copying a table requires
538  // some more knowledge (like table name of result).
539  // Declaring it private, makes it unusable.
540  BaseTable (const BaseTable&);
541 
542  // Assignment is forbidden, because copying a table requires
543  // some more knowledge (like table name of result).
544  // Declaring it private, makes it unusable.
545  BaseTable& operator= (const BaseTable&);
546 
547  // Show a possible extra table structure header.
548  // It is used by e.g. RefTable to show which table is referenced.
549  virtual void showStructureExtra (std::ostream&) const;
550 
551  // Show the info of the given columns.
552  // Sort the columns if needed.
553  void showColumnInfo (ostream& os, const TableDesc&, uInt maxNameLength,
554  const Array<String>& columnNames, Bool sort) const;
555 
556  // Throw an exception for checkRowNumber.
557  void checkRowNumberThrow (uInt rownr) const;
558 
559  // Check if the tables combined in a logical operation have the
560  // same root.
561  void logicCheck (BaseTable* that);
562 
563  // Get the rownrs of the table in ascending order to be
564  // used in the logical operation on the table.
565  uInt logicRows (uInt*& rownrs, Bool& allocated);
566 
567  // Make an empty table description.
568  // This is used if one asks for the description of a NullTable.
569  // Creating an empty TableDesc in the NullTable takes too much time.
570  // Furthermore it causes static initialization order problems.
571  const TableDesc& makeTableDesc() const;
572 
573  // Make the name absolute.
574  // It first checks if the name contains valid characters (not only . and /).
575  String makeAbsoluteName (const String& name) const;
576 };
577 
578 
579 
580 
581 } //# NAMESPACE CASACORE - END
582 
583 #endif
BaseTable * select(const TableExprNode &, uInt maxRow, uInt offset)
Select rows using the given expression (which can be null).
virtual void renameHypercolumn(const String &newName, const String &oldName)=0
Rename a hypercolumn.
TableInfo info_p
Definition: BaseTable.h:485
virtual const StorageOption & storageOption() const =0
Get the storage option used for the table.
virtual DataManager * findDataManager(const String &name, Bool byColumn) const =0
Find the data manager with the given name or for the given column.
int tableOption() const
Get the table option.
Definition: BaseTable.h:240
Bool isColumnWritable(const String &columnName) const
Test if the given column is writable.
virtual Bool isNull() const
Is the table a null table? By default it is not.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
virtual void mergeLock(const TableLock &lockOptions)=0
Merge the given lock info with the existing one.
virtual int tableType() const
Get the table type.
AipsIO is the object persistency mechanism of Casacore.
Definition: AipsIO.h:168
virtual Bool canRenameColumn(const String &columnName) const =0
Test if a column can be renamed.
void checkRowNumberThrow(uInt rownr) const
Throw an exception for checkRowNumber.
Bool isColumnStored(const String &columnName) const
Test if the given column is stored (otherwise it is virtual).
virtual void reopenRW()=0
Reopen the table for read/write.
Handle class for a table column expression tree.
Definition: ExprNode.h:578
void trueDeepCopy(const String &newName, const Record &dataManagerInfo, int tableOption, int endianFormat, Bool noRows) const
Make a true deep copy of the table.
BaseTable * tabXor(BaseTable *)
xor with another table
Envelope class for the description of a table column.
Definition: ColumnDesc.h:131
virtual BaseTable * doSort(PtrBlock< BaseColumn * > &, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &sortOrder, int sortOption)
Do the actual sort.
virtual const TableLock & lockOptions() const =0
Get the locking info.
virtual void addRow(uInt nrrow=1, Bool initialize=True)
Add one or more rows and possibly initialize them.
virtual Bool adjustRownrs(uInt nrrow, Vector< uInt > &rownrs, Bool determineOrder) const
Adjust the row numbers to be the actual row numbers in the root table.
void unmarkForDelete(Bool callback, const String &oldName)
Unmark the table for delete.
Base class for table iterator.
Definition: BaseTabIter.h:83
BaseTable * tabOr(BaseTable *)
union with another table
virtual uInt getModifyCounter() const =0
Get the modify counter.
virtual TableDesc actualTableDesc() const =0
Get the actual table description.
BaseTable * tabSub(BaseTable *)
subtract another table
void scratchCallback(Bool isScratch, const String &oldName) const
Do the callback for scratch tables (if callback is set).
virtual void rename(const String &newName, int tableOption)
Rename the table.
void getTableInfo()
Read the TableInfo object.
virtual Bool lock(FileLocker::LockType, uInt nattempts)=0
Try to lock the table for read or write access.
virtual void renameSubTables(const String &newName, const String &oldName)
Rename the subtables (used by rename function).
void writeEnd(AipsIO &)
End writing a table.
uInt logicRows(uInt *&rownrs, Bool &allocated)
Get the rownrs of the table in ascending order to be used in the logical operation on the table...
virtual void getPartNames(Block< String > &names, Bool recursive) const
Get the names of the tables this table consists of.
virtual Vector< uInt > rowNumbers() const
Get a vector of row numbers.
Bool makeTableDir()
Create the table directory when needed (and possible).
void markForDelete(Bool callback, const String &oldName)
Mark the table for delete.
Options defining how table files are organized.
Definition: StorageOption.h:71
RefTable * makeRefTable(Bool rowOrder, uInt initialNrrow)
Create a RefTable object.
virtual BaseTable * root()
Get pointer to root table (i.e.
virtual Vector< uInt > * rowStorage()
By the default the table cannot return the storage of rownrs.
BaseTableIterator * makeIterator(const Block< String > &columnNames, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &orders, int option)
Create an iterator.
BaseTable & operator=(const BaseTable &)
Assignment is forbidden, because copying a table requires some more knowledge (like table name of res...
Referenced counted pointer for constant data.
Definition: CountedPtr.h:86
Abstract base class for tables.
Definition: BaseTable.h:99
Class for a table as a view of another table.
Definition: RefTable.h:104
virtual TableRecord & rwKeywordSet()=0
Get read/write access to the table keyword set.
static void unlink(BaseTable *)
Unlink from a BaseTable.
Bool openedForWrite() const
Test if the table is opened for write.
const String & tableName() const
Get the table name.
Definition: BaseTable.h:183
String makeAbsoluteName(const String &name) const
Make the name absolute.
void checkRowNumber(uInt rownr) const
Check if the row number is valid.
Definition: BaseTable.h:468
virtual void removeColumn(const Vector< String > &columnNames)=0
Remove columns.
BaseTable * tabAnd(BaseTable *)
Do logical operations on a table.
virtual void copy(const String &newName, int tableOption) const
Copy the table and all its subtables.
virtual void unlock()=0
Unlock the table.
A hierarchical collection of named fields of various types.
Definition: Record.h:181
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:39
virtual Bool isWritable() const =0
Test if this table is writable.
virtual void removeRow(uInt rownr)
Remove rows.
BaseTable * project(const Block< String > &columnNames)
Project the given columns (i.e.
void logicCheck(BaseTable *that)
Check if the tables combined in a logical operation have the same root.
int traceId() const
Get the table&#39;s trace-id.
Definition: BaseTable.h:472
Table type, subtype and further info.
Definition: TableInfo.h:130
virtual BaseColumn * getColumn(uInt columnIndex) const =0
Get a column object using its index.
Class to hold table lock options.
Definition: TableLock.h:65
const TableDesc & makeTableDesc() const
Make an empty table description.
A drop-in replacement for Block<T*>.
Definition: Block.h:861
virtual void resync()=0
Resync the Table object with the table file.
virtual Bool canAddRow() const
Test if it is possible to add a row to this table.
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:182
template <class T, class U> class vector;
Definition: Array.h:169
void prepareCopyRename(const String &newName, int tableOption) const
Prepare for copying or renaming a table.
uInt nrow() const
Get number of rows.
Definition: BaseTable.h:295
Bool isMarkedForDelete() const
Test if the table is marked for delete.
Definition: BaseTable.h:255
simple 1-D array
Definition: ArrayIO.h:47
virtual Bool canRemoveColumn(const Vector< String > &columnNames) const =0
Test if columns can be removed.
BaseTable * sort(const Block< String > &columnNames, const Block< CountedPtr< BaseCompare > > &compareObjects, const Block< Int > &sortOrder, int sortOption)
Sort a table on one or more columns of scalars.
void showStructure(std::ostream &, Bool showDataMan, Bool showColumns, Bool showSubTables, Bool sortColumns)
Show the table structure (implementation of Table::showStructure).
Bool checkRemoveColumn(const Vector< String > &columnNames, Bool throwException) const
Check if the set of columns can be removed.
Abstract base class for a data manager.
Definition: DataManager.h:222
virtual void showStructureExtra(std::ostream &) const
Show a possible extra table structure header.
virtual Record dataManagerInfo() const =0
Get the data manager info.
BaseTable * tabNot()
take complement
virtual Bool canRemoveRow() const
Test if it is possible to remove a row from this table.
virtual void flushTableInfo()
Write the TableInfo object.
void writeStart(AipsIO &, Bool bigEndian)
Start writing a table.
virtual void flush(Bool fsync, Bool recursive)=0
Flush the table, i.e.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual Bool isMultiUsed(Bool checkSubTables) const =0
Is the table in use (i.e.
void addColumns(const TableDesc &tableDesc, const Record &dmInfo, Bool addToParent)
Add one or more columns to the table.
virtual void renameColumn(const String &newName, const String &oldName)=0
Rename a column.
Define the structure of a Casacore table.
Definition: TableDesc.h:186
virtual void addColumn(const ColumnDesc &columnDesc, Bool addToParent)
Add one or more columns to the table.
TableDesc * tdescPtr_p
Definition: BaseTable.h:480
LockType
Define the possible lock types.
Definition: FileLocker.h:95
const TableDesc & tableDesc() const
Get the table description.
Definition: BaseTable.h:259
void link()
Link to this BaseTable object (i.e.
Bool shouldNotWrite() const
Should the table be written.
Definition: BaseTable.h:530
virtual Bool rowOrder() const
Tell if the table is in row order.
const Bool True
Definition: aipstype.h:40
virtual Bool asBigEndian() const =0
Is the table stored in big or little endian format?
virtual Bool hasLock(FileLocker::LockType) const =0
Has this process the read or write lock, thus can the table be read or written safely?
this file contains all the compiler specific defines
Definition: mainpage.dox:28
TableInfo & tableInfo()
Get access to the TableInfo object.
Definition: BaseTable.h:284
virtual void setTableChanged()
Set the table to being changed.
void doNotWrite()
Do not write the table (used in in case of exceptions).
Definition: BaseTable.h:163
unsigned int uInt
Definition: aipstype.h:48
void showColumnInfo(ostream &os, const TableDesc &, uInt maxNameLength, const Array< String > &columnNames, Bool sort) const
Show the info of the given columns.
BaseTable(const String &tableName, int tableOption, uInt nrrow)
Initialize the object.
void throwIfTableExists()
Check if the table already exists.
Abstract base class for a table column.
Definition: BaseColumn.h:98
virtual TableRecord & keywordSet()=0
Get readonly access to the table keyword set.
virtual void deepCopy(const String &newName, const Record &dataManagerInfo, int tableOption, Bool valueCopy, int endianFormat, Bool noRows) const