casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
DataManInfo.h
Go to the documentation of this file.
00001 //# DataManInfo.h: Class with static functions to manipulate a datamanager info record
00002 //# Copyright (C) 2001,2002,2003,2009
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: DataManInfo.h 20889 2010-05-17 06:53:39Z gervandiepen $
00027 
00028 #ifndef TABLES_DATAMANINFO_H
00029 #define TABLES_DATAMANINFO_H
00030 
00031 
00032 //# Includes
00033 #include <casa/Arrays/Vector.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 //# Forward Declarations.
00038 class TableDesc;
00039 class Record;
00040 
00041 
00042 // <summary>
00043 // Class with static functions to manipulate a datamanager record.
00044 // </summary>
00045 
00046 // <use visibility=export>
00047 
00048 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tTableCopy.cc">
00049 // </reviewed>
00050 
00051 // <prerequisite>
00052 //# Classes you should understand before using this one.
00053 //   <li> Table
00054 // </prerequisite>
00055 
00056 // <synopsis> 
00057 // DataManInfo is a class to manipulate a datamanager info record and table
00058 // descriptions.
00059 // Often an existing table description and datamanager info record is used to
00060 // construct a new table, but it might be necessary to change it somewhat.
00061 // <ul>
00062 //  <li> Remove hypercolumn definitions from a table description. They are
00063 //       not needed anymore and can be a burden.
00064 //  <li> Replace non-writable storage managers (like LofarStMan) by a
00065 //       writable one.
00066 //  <li> Replace the deprecated TiledDataStMan by TiledShapeStMan.
00067 // </ul>
00068 //
00069 // Such things might be necessary in a number
00070 // </synopsis> 
00071 
00072 //# <todo asof="$DATE:$">
00073 //# </todo>
00074 
00075 
00076 class DataManInfo
00077 {
00078 public:
00079   // Remove hypercolumn definitions from the table description.
00080   static void removeHypercolumns (TableDesc& tabDesc);
00081 
00082   // Replace TiledDataStMan by TiledShapeStMan in the DataManagerInfo record.
00083   // Since TiledShapeStMan does not support ID columns, they are
00084   // adjusted as well in tabDesc and dminfo.
00085   static void adjustTSM (TableDesc& tabDesc, Record& dminfo);
00086 
00087   // Replace non-writable storage managers by the given storage manager
00088   // (usually StandardStMan or IncrementalStMan).
00089   // It is possible to specify the new data manager type to use.
00090   // This is needed for special storage managers like LofarStMan.
00091   // If replaceMSM is set, MemoryStMan is also replaced.
00092   static Record adjustStMan (const Record& dminfo, const String& dmType,
00093                              Bool replaceMSM = True);
00094 
00095   // Set the data managers of the given column(s) to the given tiled storage
00096   // manager (normally TiledShapeStMan or TiledColumnStMan).
00097   // The columns are combined in a single storage manager, so the function
00098   // has to be called multiple times if, say, one per column is needed.
00099   // The columns already having a tiled storage manager are not changed.
00100   static void setTiledStMan (Record& dminfo, const Vector<String>& columns,
00101                              const String& dmType, const String& dmName,
00102                              const IPosition& defaultTileShape);
00103 
00104   // Remove the columns from the dminfo record and return a vector with the
00105   // names of the columns actually removed.
00106   // The columns having a data manager matching <src>keepType</src> are not
00107   // removed. Matching means that the beginning of the data manager name
00108   // have to match, so "Tiled" matches all tiled storagemanagers.
00109   static Vector<String> removeDminfoColumns (Record& dminfo,
00110                                              const Vector<String>& columns,
00111                                              const String& keepType= String());
00112 
00113   // Adjust the data manager types and groups and the
00114   // hypercolumn definitions to the actual data manager info.
00115   static void adjustDesc (TableDesc& tabDesc, const Record& dminfo);
00116 };
00117 
00118 
00119 
00120 } //# NAMESPACE CASA - END
00121 
00122 #endif