casa
$Rev:20696$
|
00001 //# TSMColumn.h: A column in the Tiled Storage Manager 00002 //# Copyright (C) 1995,1996,1997,1999 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: TSMColumn.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $ 00027 00028 #ifndef TABLES_TSMCOLUMN_H 00029 #define TABLES_TSMCOLUMN_H 00030 00031 //# Includes 00032 #include <casa/aips.h> 00033 #include <tables/Tables/StManColumn.h> 00034 #include <casa/Arrays/IPosition.h> 00035 #include <casa/BasicSL/String.h> 00036 00037 namespace casa { //# NAMESPACE CASA - BEGIN 00038 00039 //# Forward Declarations 00040 class TiledStMan; 00041 class TSMDataColumn; 00042 class TSMCoordColumn; 00043 class TSMIdColumn; 00044 00045 00046 // <summary> 00047 // A column in the Tiled Storage Manager 00048 // </summary> 00049 00050 // <use visibility=local> 00051 00052 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00053 // </reviewed> 00054 00055 // <prerequisite> 00056 //# Classes you should understand before using this one. 00057 // <li> <linkto class=StManColumn>StManColumn</linkto> 00058 // <li> <linkto class=TiledStMan>TiledStMan</linkto> 00059 // </prerequisite> 00060 00061 // <etymology> 00062 // TSMColumn handles a column for the Tiled Storage Manager. 00063 // </etymology> 00064 00065 // <synopsis> 00066 // TSMColumn serves 2 purposes: 00067 // <ol> 00068 // <li> It is the initial object for all columns in TiledStMan. 00069 // <li> It serves as a base class for the specialized TiledStMan 00070 // column classes dealing with data, coordinates and id values. 00071 // </ol> 00072 // The protocol used for creating the derived 00073 // <linkto class=TSMDataColumn>TSMDataColumn</linkto>, 00074 // <linkto class=TSMCoordColumn>TSMCoordColumn</linkto>, and 00075 // <linkto class=TSMIdColumn>TSMIdColumn</linkto> 00076 // objects is somewhat complicated. It works as follows: 00077 // <br> 00078 // When the table is set up, a TSMColumn object gets created for all 00079 // columns in a TiledStMan storage manager. The TiledStMan initialization 00080 // function lets each TSMColumn object create its specialized TSMXXColumn 00081 // object (using make{Coord,Id,Data}Column). At the end of the setup process 00082 // the TSMColumn objects are deleted and the DataManagerColumn pointers 00083 // in the BaseColumn objects get replaced by those to the specialized 00084 // objects. In that way no needless virtual function calls are done. 00085 // </synopsis> 00086 00087 // <motivation> 00088 // TSMColumn is needed for the initial DataManagerColumn setup process. 00089 // It is also useful as a base class for all TiledStMan column objects. 00090 // </motivation> 00091 00092 //# <todo asof="$DATE:$"> 00093 //# A List of bugs, limitations, extensions or planned refinements. 00094 //# </todo> 00095 00096 00097 class TSMColumn : public StManColumn 00098 { 00099 public: 00100 00101 // Create a column of the given type. 00102 // It will maintain a pointer to its parent storage manager. 00103 TSMColumn (TiledStMan* stman, int dataType, const String& columnName); 00104 00105 // Frees up the storage. 00106 virtual ~TSMColumn(); 00107 00108 // Get the name of the column. 00109 const String& columnName() const; 00110 00111 // Return the data type of the column. 00112 virtual int dataType() const; 00113 00114 // Set the fixed shape of the column. 00115 void setShapeColumn (const IPosition& shape); 00116 00117 // Get the fixed shape of the column. 00118 const IPosition& shapeColumn() const; 00119 00120 // Make a TSM data column object. 00121 // Add the pixel length to the total data pixel length. 00122 TSMDataColumn* makeDataColumn(); 00123 00124 // Make a TSM coordinate column object. 00125 TSMCoordColumn* makeCoordColumn (uInt axesNumber); 00126 00127 // Make a TSM id column object. 00128 TSMIdColumn* makeIdColumn(); 00129 00130 // Unlink the underlying column. 00131 // It clears the pointer and returns its original value. 00132 // This is used to get a pointer directly to the underlying TSMXXColumn 00133 // object in the BaseColumn classes. In that way only 1 instead 00134 // of 2 virtual function calls are needed for a get or put. 00135 TSMColumn* unlink(); 00136 00137 00138 protected: 00139 // The storage manager. 00140 TiledStMan* stmanPtr_p; 00141 // The data type of the data (as defined in DataType.h). 00142 int dtype_p; 00143 // The name of the column. 00144 String name_p; 00145 // The fixed shape of the column. 00146 IPosition columnShape_p; 00147 // The specialized column object (i.e. data, coordinate or id). 00148 TSMColumn* colPtr_p; 00149 00150 // The copy constructor can only be used to copy a derived class. 00151 TSMColumn (const TSMColumn& that); 00152 00153 private: 00154 // Forbid assignment. 00155 TSMColumn& operator= (const TSMColumn&); 00156 }; 00157 00158 00159 inline const String& TSMColumn::columnName() const 00160 { return name_p; } 00161 00162 inline const IPosition& TSMColumn::shapeColumn() const 00163 { return columnShape_p; } 00164 00165 00166 00167 00168 } //# NAMESPACE CASA - END 00169 00170 #endif