casacore
Loading...
Searching...
No Matches
NullTable.h
Go to the documentation of this file.
1//# NullTable.h: Class indicating a null Table object
2//# Copyright (C) 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: 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_NULLTABLE_H
27#define TABLES_NULLTABLE_H
28
29
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/tables/Tables/BaseTable.h>
33#include <casacore/tables/Tables/TableError.h>
34
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38// <summary>
39// Class indicating a null Table object
40// </summary>
41
42// <use visibility=local>
43
44// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
45// </reviewed>
46
47// <prerequisite>
48//# Classes you should understand before using this one.
49// <li> <linkto class=BaseTable>BaseTable</linkto>
50// </prerequisite>
51
52// <etymology>
53// NullTable represents a null table object, i.e. a Table object without
54// an underlying table.
55// </etymology>
56
57// <synopsis>
58// NullTable is used to represent a null table.
59// The default Table constructor used to a create a null pointer
60// which resulted in core dumps when the Table object was actually used.
61// The NullTable object makes it possible to catch such cases
62// and throw an appropriate exception.
63// </synopsis>
64
65
66class NullTable : public BaseTable
67{
68public:
69 // Default constructor.
71
72 virtual ~NullTable();
73
74 // Copy constructor is forbidden.
75 NullTable (const NullTable&) = delete;
76
77 // Assignment is forbidden.
78 NullTable& operator= (const NullTable&) = delete;
79
80 // The table is a null table.
81 virtual Bool isNull() const override;
82
83 // All functions throw a "null table" exception.
84 // <group>
85 virtual void reopenRW() override;
86 virtual Bool asBigEndian() const override;
87 virtual const StorageOption& storageOption() const override;
88 virtual Bool isMultiUsed (Bool checkSubTable) const override;
89 virtual const TableLock& lockOptions() const override;
90 virtual void mergeLock (const TableLock& lockOptions) override;
91 virtual Bool hasLock (FileLocker::LockType) const override;
92 virtual Bool lock (FileLocker::LockType, uInt nattempts) override;
93 virtual void unlock() override;
94 virtual void flush (Bool fsync, Bool recursive) override;
95 virtual void resync() override;
96 virtual uInt getModifyCounter() const override;
97 virtual Bool isWritable() const override;
98 virtual void deepCopy (const String& newName,
100 const StorageOption&,
101 int tableOption,
102 Bool valueCopy,
103 int endianFormat,
104 Bool noRows) const override;
105 virtual TableDesc actualTableDesc() const override;
106 virtual Record dataManagerInfo() const override;
107 virtual TableRecord& keywordSet() override;
108 virtual TableRecord& rwKeywordSet() override;
109 virtual BaseColumn* getColumn (uInt columnIndex) const override;
110 virtual BaseColumn* getColumn (const String& columnName) const override;
111 virtual Bool canAddRow() const override;
112 virtual void addRow (rownr_t nrrow, Bool initialize) override;
113 virtual Bool canRemoveRow() const override;
114 virtual void removeRow (rownr_t rownr) override;
115 virtual DataManager* findDataManager (const String& name,
116 Bool byColumn) const override;
117 virtual void addColumn (const ColumnDesc& columnDesc, Bool addToParent) override;
118 virtual void addColumn (const ColumnDesc& columnDesc,
119 const String& dataManager, Bool byName,
120 Bool addToParent) override;
121 virtual void addColumn (const ColumnDesc& columnDesc,
122 const DataManager& dataManager, Bool addToParent) override;
123 virtual void addColumn (const TableDesc& tableDesc,
124 const DataManager& dataManager, Bool addToParent) override;
125 virtual Bool canRemoveColumn (const Vector<String>& columnNames) const override;
126 virtual void removeColumn (const Vector<String>& columnNames) override;
127 virtual Bool canRenameColumn (const String& columnName) const override;
128 virtual void renameColumn (const String& newName, const String& oldName) override;
129 virtual void renameHypercolumn (const String& newName,
130 const String& oldName) override;
131 virtual Vector<rownr_t> rowNumbers() const override;
132 virtual BaseTable* root() override;
133 virtual Bool rowOrder() const override;
134 virtual Vector<rownr_t>& rowStorage() override;
135 virtual Bool adjustRownrs (rownr_t nrrow, Vector<rownr_t>& rownrs,
136 Bool determineOrder) const override;
137 virtual std::shared_ptr<BaseTable> doSort (PtrBlock<BaseColumn*>&,
138 const Block<std::shared_ptr<BaseCompare>>&,
139 const Block<Int>&,
140 int,
141 std::shared_ptr<Vector<rownr_t>>,
142 std::shared_ptr<Vector<size_t>>) override;
143 virtual void renameSubTables (const String& newName,
144 const String& oldName) override;
145 // </group>
146
147private:
148 // Make an exception message with the name of the function.
149 TableError makeError (const String& name) const;
150};
151
152
153
154
155} //# NAMESPACE CASACORE - END
156
157#endif
const TableDesc & tableDesc() const
Get the table description.
Definition BaseTable.h:272
int tableOption() const
Get the table option.
Definition BaseTable.h:253
simple 1-D array
Definition Block.h:198
Abstract base class for a data manager.
LockType
Define the possible lock types.
Definition FileLocker.h:93
virtual TableRecord & rwKeywordSet() override
Get read/write access to the table keyword set.
virtual std::shared_ptr< BaseTable > doSort(PtrBlock< BaseColumn * > &, const Block< std::shared_ptr< BaseCompare > > &, const Block< Int > &, int, std::shared_ptr< Vector< rownr_t > >, std::shared_ptr< Vector< size_t > >) override
Do the actual sort.
virtual void deepCopy(const String &newName, const Record &dataManagerInfo, const StorageOption &, int tableOption, Bool valueCopy, int endianFormat, Bool noRows) const override
virtual Record dataManagerInfo() const override
Get the data manager info.
virtual BaseColumn * getColumn(uInt columnIndex) const override
Get a column object using its index.
virtual TableDesc actualTableDesc() const override
Get the actual table description.
virtual void addColumn(const ColumnDesc &columnDesc, const DataManager &dataManager, Bool addToParent) override
virtual uInt getModifyCounter() const override
Get the modify counter.
virtual void unlock() override
Unlock the table.
virtual Bool canRemoveColumn(const Vector< String > &columnNames) const override
Test if columns can be removed.
virtual Bool canRenameColumn(const String &columnName) const override
Test if a column can be renamed.
virtual Vector< rownr_t > & rowStorage() override
By the default the table cannot return the storage of rownrs.
virtual const TableLock & lockOptions() const override
Get the locking info.
NullTable()
Default constructor.
virtual TableRecord & keywordSet() override
Get readonly access to the table keyword set.
virtual Bool isNull() const override
The table is a null table.
virtual Vector< rownr_t > rowNumbers() const override
Get a vector of row numbers.
virtual void renameSubTables(const String &newName, const String &oldName) override
Rename the subtables (used by rename function).
virtual void mergeLock(const TableLock &lockOptions) override
Merge the given lock info with the existing one.
virtual void addColumn(const ColumnDesc &columnDesc, const String &dataManager, Bool byName, Bool addToParent) override
virtual BaseColumn * getColumn(const String &columnName) const override
Get a column object using its name.
virtual void addColumn(const ColumnDesc &columnDesc, Bool addToParent) override
Add one or more columns to the table.
virtual Bool adjustRownrs(rownr_t nrrow, Vector< rownr_t > &rownrs, Bool determineOrder) const override
Adjust the row numbers to be the actual row numbers in the root table.
NullTable & operator=(const NullTable &)=delete
Assignment is forbidden.
virtual Bool isWritable() const override
Test if this table is writable.
virtual void renameColumn(const String &newName, const String &oldName) override
Rename a column.
virtual void removeColumn(const Vector< String > &columnNames) override
Remove columns.
virtual void flush(Bool fsync, Bool recursive) override
Flush the table, i.e.
virtual Bool canAddRow() const override
Test if it is possible to add a row to this table.
virtual void addRow(rownr_t nrrow, Bool initialize) override
Add one or more rows and possibly initialize them.
virtual Bool hasLock(FileLocker::LockType) const override
Has this process the read or write lock, thus can the table be read or written safely?
virtual void removeRow(rownr_t rownr) override
Remove rows.
virtual Bool isMultiUsed(Bool checkSubTable) const override
Is the table in use (i.e.
virtual Bool lock(FileLocker::LockType, uInt nattempts) override
Try to lock the table for read or write access.
virtual void renameHypercolumn(const String &newName, const String &oldName) override
Rename a hypercolumn.
virtual void addColumn(const TableDesc &tableDesc, const DataManager &dataManager, Bool addToParent) override
virtual void resync() override
Resync the Table object with the table file.
virtual Bool rowOrder() const override
Tell if the table is in row order.
virtual DataManager * findDataManager(const String &name, Bool byColumn) const override
Find the data manager with the given name or for the given column.
virtual void reopenRW() override
All functions throw a "null table" exception.
NullTable(const NullTable &)=delete
Copy constructor is forbidden.
virtual const StorageOption & storageOption() const override
Get the storage option used for the table.
virtual Bool asBigEndian() const override
Is the table stored in big or little endian format?
TableError makeError(const String &name) const
Make an exception message with the name of the function.
virtual Bool canRemoveRow() const override
Test if it is possible to remove a row from this table.
virtual BaseTable * root() override
Get pointer to root table (i.e.
A drop-in replacement for Block<T*>.
Definition Block.h:812
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
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44