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