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