casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TSMColumn.h
Go to the documentation of this file.
1 //# TSMColumn.h: A column in the Tiled Storage Manager
2 //# Copyright (C) 1995,1996,1997,1999
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_TSMCOLUMN_H
29 #define TABLES_TSMCOLUMN_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward Declarations
40 class TiledStMan;
41 class TSMDataColumn;
42 class TSMCoordColumn;
43 class TSMIdColumn;
44 
45 
46 // <summary>
47 // A column in the Tiled Storage Manager
48 // </summary>
49 
50 // <use visibility=local>
51 
52 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
53 // </reviewed>
54 
55 // <prerequisite>
56 //# Classes you should understand before using this one.
57 // <li> <linkto class=StManColumn>StManColumn</linkto>
58 // <li> <linkto class=TiledStMan>TiledStMan</linkto>
59 // </prerequisite>
60 
61 // <etymology>
62 // TSMColumn handles a column for the Tiled Storage Manager.
63 // </etymology>
64 
65 // <synopsis>
66 // TSMColumn serves 2 purposes:
67 // <ol>
68 // <li> It is the initial object for all columns in TiledStMan.
69 // <li> It serves as a base class for the specialized TiledStMan
70 // column classes dealing with data, coordinates and id values.
71 // </ol>
72 // The protocol used for creating the derived
73 // <linkto class=TSMDataColumn>TSMDataColumn</linkto>,
74 // <linkto class=TSMCoordColumn>TSMCoordColumn</linkto>, and
75 // <linkto class=TSMIdColumn>TSMIdColumn</linkto>
76 // objects is somewhat complicated. It works as follows:
77 // <br>
78 // When the table is set up, a TSMColumn object gets created for all
79 // columns in a TiledStMan storage manager. The TiledStMan initialization
80 // function lets each TSMColumn object create its specialized TSMXXColumn
81 // object (using make{Coord,Id,Data}Column). At the end of the setup process
82 // the TSMColumn objects are deleted and the DataManagerColumn pointers
83 // in the BaseColumn objects get replaced by those to the specialized
84 // objects. In that way no needless virtual function calls are done.
85 // </synopsis>
86 
87 // <motivation>
88 // TSMColumn is needed for the initial DataManagerColumn setup process.
89 // It is also useful as a base class for all TiledStMan column objects.
90 // </motivation>
91 
92 //# <todo asof="$DATE:$">
93 //# A List of bugs, limitations, extensions or planned refinements.
94 //# </todo>
95 
96 
97 class TSMColumn : public StManColumnBase
98 {
99 public:
100 
101  // Create a column of the given type.
102  // It will maintain a pointer to its parent storage manager.
103  TSMColumn (TiledStMan* stman, int dataType, const String& columnName);
104 
105  // Frees up the storage.
106  virtual ~TSMColumn();
107 
108  // Get the name of the column.
109  const String& columnName() const;
110 
111  // Return the data type of the column.
112  virtual int dataType() const;
113 
114  // Set the fixed shape of the column.
115  void setShapeColumn (const IPosition& shape);
116 
117  // Get the fixed shape of the column.
118  const IPosition& shapeColumn() const;
119 
120  // Make a TSM data column object.
121  // Add the pixel length to the total data pixel length.
123 
124  // Make a TSM coordinate column object.
125  TSMCoordColumn* makeCoordColumn (uInt axesNumber);
126 
127  // Make a TSM id column object.
129 
130  // Unlink the underlying column.
131  // It clears the pointer and returns its original value.
132  // This is used to get a pointer directly to the underlying TSMXXColumn
133  // object in the BaseColumn classes. In that way only 1 instead
134  // of 2 virtual function calls are needed for a get or put.
135  TSMColumn* unlink();
136 
137 
138 protected:
139  // The storage manager.
141  // The data type of the data (as defined in DataType.h).
142  int dtype_p;
143  // The name of the column.
145  // The fixed shape of the column.
147  // The specialized column object (i.e. data, coordinate or id).
149 
150  // The copy constructor can only be used to copy a derived class.
151  TSMColumn (const TSMColumn& that);
152 
153 private:
154  // Forbid assignment.
155  TSMColumn& operator= (const TSMColumn&);
156 };
157 
158 
159 inline const String& TSMColumn::columnName() const
160  { return name_p; }
161 
162 inline const IPosition& TSMColumn::shapeColumn() const
163  { return columnShape_p; }
164 
165 
166 
167 
168 } //# NAMESPACE CASACORE - END
169 
170 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:118
virtual IPosition shape(rownr_t rownr)
Get the shape of the item in the given row.
TiledStMan * stmanPtr_p
The storage manager.
Definition: TSMColumn.h:140
IPosition columnShape_p
The fixed shape of the column.
Definition: TSMColumn.h:146
Base class for Tiled Storage Manager classes.
Definition: TiledStMan.h:106
Base table column storage manager class.
int dtype_p
The data type of the data (as defined in DataType.h).
Definition: TSMColumn.h:142
A data column in Tiled Storage Manager.
Definition: TSMDataColumn.h:96
TSMCoordColumn * makeCoordColumn(uInt axesNumber)
Make a TSM coordinate column object.
void setShapeColumn(const IPosition &shape)
Set the fixed shape of the column.
An id column in Tiled Storage Manager.
Definition: TSMIdColumn.h:90
const IPosition & shapeColumn() const
Get the fixed shape of the column.
Definition: TSMColumn.h:162
TSMColumn & operator=(const TSMColumn &)
Forbid assignment.
TSMColumn * unlink()
Unlink the underlying column.
String name_p
The name of the column.
Definition: TSMColumn.h:144
TSMColumn(TiledStMan *stman, int dataType, const String &columnName)
Create a column of the given type.
TSMIdColumn * makeIdColumn()
Make a TSM id column object.
A column in the Tiled Storage Manager.
Definition: TSMColumn.h:97
A coordinate column in Tiled Storage Manager.
virtual int dataType() const
Return the data type of the column.
TSMColumn * colPtr_p
The specialized column object (i.e.
Definition: TSMColumn.h:148
TSMDataColumn * makeDataColumn()
Make a TSM data column object.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
const String & columnName() const
Get the name of the column.
Definition: TSMColumn.h:159
unsigned int uInt
Definition: aipstype.h:51
virtual ~TSMColumn()
Frees up the storage.