casacore
DataManInfo.h
Go to the documentation of this file.
1 //# DataManInfo.h: Class with static functions to manipulate a datamanager info record
2 //# Copyright (C) 2001,2002,2003,2009
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_DATAMANINFO_H
29 #define TABLES_DATAMANINFO_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/casa/Arrays/Vector.h>
35 #include <casacore/casa/BasicSL/String.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward Declarations.
40 class TableDesc;
41 class Table;
42 class Record;
43 
44 
45 // <summary>
46 // Class with static functions to manipulate a datamanager record.
47 // </summary>
48 
49 // <use visibility=export>
50 
51 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tTableCopy.cc">
52 // </reviewed>
53 
54 // <prerequisite>
55 //# Classes you should understand before using this one.
56 // <li> Table
57 // </prerequisite>
58 
59 // <synopsis>
60 // DataManInfo is a class to manipulate a datamanager info record and table
61 // descriptions.
62 // Often an existing table description and datamanager info record is used to
63 // construct a new table, but it might be necessary to change it somewhat.
64 // <ul>
65 // <li> Remove hypercolumn definitions from a table description. They are
66 // not needed anymore and can be a burden.
67 // <li> Replace non-writable storage managers (like LofarStMan) by a
68 // writable one.
69 // <li> Replace the deprecated TiledDataStMan by TiledShapeStMan.
70 // </ul>
71 //
72 // Such things might be necessary in a number
73 // </synopsis>
74 
75 //# <todo asof="$DATE:$">
76 //# </todo>
77 
78 
80 {
81 public:
82  // Remove hypercolumn definitions from the table description.
83  static void removeHypercolumns (TableDesc& tabDesc);
84 
85  // Replace TiledDataStMan by TiledShapeStMan in the DataManagerInfo record.
86  // Since TiledShapeStMan does not support ID columns, they are
87  // adjusted as well in tabDesc and dminfo.
88  static void adjustTSM (TableDesc& tabDesc, Record& dminfo);
89 
90  // Replace non-writable storage managers by the given storage manager
91  // (usually StandardStMan or IncrementalStMan).
92  // It is possible to specify the new data manager type to use.
93  // This is needed for special storage managers like LofarStMan.
94  // If replaceMSM is set, MemoryStMan is also replaced.
95  static Record adjustStMan (const Record& dminfo, const String& dmType,
96  Bool replaceMSM = True);
97 
98  // Set the data managers of the given column(s) to the given tiled storage
99  // manager (normally TiledShapeStMan or TiledColumnStMan).
100  // The columns are combined in a single storage manager, so the function
101  // has to be called multiple times if, say, one per column is needed.
102  // The columns already having a tiled storage manager are not changed.
103  static void setTiledStMan (Record& dminfo, const Vector<String>& columns,
104  const String& dmType, const String& dmName,
105  const IPosition& defaultTileShape);
106 
107  // Remove the columns from the dminfo record and return a vector with the
108  // names of the columns actually removed.
109  // The columns having a data manager matching <src>keepType</src> are not
110  // removed. Matching means that the beginning of the data manager name
111  // have to match, so "Tiled" matches all tiled storagemanagers.
113  const Vector<String>& columns,
114  const String& keepType= String());
115 
116  // Adjust the data manager types and groups and the
117  // hypercolumn definitions to the actual data manager info.
118  static void adjustDesc (TableDesc& tabDesc, const Record& dminfo);
119 
120  // Show the Table IO statistics.
121  static void showDataManStats (const Table&, ostream&);
122 };
123 
124 
125 
126 } //# NAMESPACE CASACORE - END
127 
128 #endif
static void showDataManStats(const Table &, ostream &)
Show the Table IO statistics.
static void removeHypercolumns(TableDesc &tabDesc)
Remove hypercolumn definitions from the table description.
static Vector< String > removeDminfoColumns(Record &dminfo, const Vector< String > &columns, const String &keepType=String())
Remove the columns from the dminfo record and return a vector with the names of the columns actually ...
static void setTiledStMan(Record &dminfo, const Vector< String > &columns, const String &dmType, const String &dmName, const IPosition &defaultTileShape)
Set the data managers of the given column(s) to the given tiled storage manager (normally TiledShapeS...
static void adjustDesc(TableDesc &tabDesc, const Record &dminfo)
Adjust the data manager types and groups and the hypercolumn definitions to the actual data manager i...
static void adjustTSM(TableDesc &tabDesc, Record &dminfo)
Replace TiledDataStMan by TiledShapeStMan in the DataManagerInfo record.
static Record adjustStMan(const Record &dminfo, const String &dmType, Bool replaceMSM=True)
Replace non-writable storage managers by the given storage manager (usually StandardStMan or Incremen...
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
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool True
Definition: aipstype.h:43