casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
NullTable.h
Go to the documentation of this file.
00001 //# NullTable.h: Class indicating a null Table object
00002 //# Copyright (C) 2001,2002,2003
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: NullTable.h 21014 2011-01-06 08:57:49Z gervandiepen $
00027 
00028 #ifndef TABLES_NULLTABLE_H
00029 #define TABLES_NULLTABLE_H
00030 
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <tables/Tables/BaseTable.h>
00035 
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 // <summary>
00040 // Class indicating a null Table object
00041 // </summary>
00042 
00043 // <use visibility=local>
00044 
00045 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
00046 // </reviewed>
00047 
00048 // <prerequisite>
00049 //# Classes you should understand before using this one.
00050 //   <li> <linkto class=BaseTable>BaseTable</linkto>
00051 // </prerequisite>
00052 
00053 // <etymology>
00054 // NullTable represents a null table object, i.e. a Table object without
00055 // an underlying table..
00056 // </etymology>
00057 
00058 // <synopsis> 
00059 // Nullable is used to represent a null table.
00060 // The default Table constructor used to a create a null pointer
00061 // which results in core dumps when the Table object is actually used.
00062 // The NullTable object makes it possible to catch such cases
00063 // and throw an appropriate exception.
00064 // </synopsis> 
00065 
00066 
00067 class NullTable : public BaseTable
00068 {
00069 public:
00070   // Default constructor.
00071   NullTable();
00072 
00073   virtual ~NullTable();
00074 
00075   // The table is a null table.
00076   virtual Bool isNull() const;
00077 
00078   // All functions throw a "null table" exception.
00079   // <group>
00080   virtual void reopenRW();
00081   virtual Bool asBigEndian() const;
00082   virtual Bool isMultiUsed (Bool checkSubTable) const;
00083   virtual const TableLock& lockOptions() const;
00084   virtual void mergeLock (const TableLock& lockOptions);
00085   virtual Bool hasLock (FileLocker::LockType) const;
00086   virtual Bool lock (FileLocker::LockType, uInt nattempts);
00087   virtual void unlock();
00088   virtual void flush (Bool fsync, Bool recursive);
00089   virtual void resync();
00090   virtual uInt getModifyCounter() const;
00091   virtual Bool isWritable() const;
00092   virtual void deepCopy (const String& newName,
00093                          const Record& dataManagerInfo,
00094                          int tableOption,
00095                          Bool valueCopy,
00096                          int endianFormat,
00097                          Bool noRows) const;
00098   virtual TableDesc actualTableDesc() const;
00099   virtual Record dataManagerInfo() const;
00100   virtual TableRecord& keywordSet();
00101   virtual TableRecord& rwKeywordSet();
00102   virtual BaseColumn* getColumn (uInt columnIndex) const;
00103   virtual BaseColumn* getColumn (const String& columnName) const;
00104   virtual Bool canAddRow() const;
00105   virtual void addRow (uInt nrrow, Bool initialize);
00106   virtual Bool canRemoveRow() const;
00107   virtual void removeRow (uInt rownr);
00108   virtual DataManager* findDataManager (const String& name,
00109                                         Bool byColumn) const;
00110   virtual void addColumn (const ColumnDesc& columnDesc, Bool addToParent);
00111   virtual void addColumn (const ColumnDesc& columnDesc,
00112                           const String& dataManager, Bool byName,
00113                           Bool addToParent);
00114   virtual void addColumn (const ColumnDesc& columnDesc,
00115                           const DataManager& dataManager, Bool addToParent);
00116   virtual void addColumn (const TableDesc& tableDesc,
00117                           const DataManager& dataManager, Bool addToParent);
00118   virtual Bool canRemoveColumn (const Vector<String>& columnNames) const;
00119   virtual void removeColumn (const Vector<String>& columnNames);
00120   virtual Bool canRenameColumn (const String& columnName) const;
00121   virtual void renameColumn (const String& newName, const String& oldName);
00122   virtual void renameHypercolumn (const String& newName,
00123                                     const String& oldName);
00124   virtual Vector<uInt> rowNumbers() const;
00125   virtual BaseTable* root();
00126   virtual Bool rowOrder() const;
00127   virtual Vector<uInt>* rowStorage();
00128   virtual Bool adjustRownrs (uInt nrrow, Vector<uInt>& rownrs,
00129                              Bool determineOrder) const;
00130   virtual BaseTable* doSort (PtrBlock<BaseColumn*>&,
00131                              const Block<CountedPtr<BaseCompare> >&,
00132                              const Block<Int>& sortOrder,
00133                              int sortOption);
00134   virtual void renameSubTables (const String& newName,
00135                                 const String& oldName);
00136   // </group>
00137 
00138 private:
00139   // Copy constructor is forbidden, because copying a table requires
00140   // some more knowledge (like table name of result).
00141   // Declaring it private, makes it unusable.
00142   NullTable (const NullTable&);
00143 
00144   // Assignment is forbidden, because copying a table requires
00145   // some more knowledge (like table name of result).
00146   // Declaring it private, makes it unusable.
00147   NullTable& operator= (const NullTable&);
00148 
00149   // Throw an exception with the name of the function.
00150   void throwError (const String& name) const;
00151 };
00152 
00153 
00154 
00155 
00156 } //# NAMESPACE CASA - END
00157 
00158 #endif