TSMDataColumn.h

Go to the documentation of this file.
00001 //# TSMDataColumn.h: A data column in Tiled Storage Manager
00002 //# Copyright (C) 1995,1996,1997,1999,2002
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_TSMDATACOLUMN_H
00029 #define TABLES_TSMDATACOLUMN_H
00030 
00031 
00032 //# Includes
00033 #include <casacore/casa/aips.h>
00034 #include <casacore/tables/DataMan/TSMColumn.h>
00035 #include <casacore/tables/DataMan/TSMCube.h>
00036 #include <casacore/casa/BasicSL/Complex.h>
00037 #include <casacore/casa/Arrays/IPosition.h>
00038 #include <casacore/casa/BasicSL/String.h>
00039 #include <casacore/casa/OS/Conversion.h>
00040 
00041 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00042 
00043 //# Forward Declarations
00044 class Slicer;
00045 
00046 
00047 // <summary>
00048 // A data column in Tiled Storage Manager.
00049 // </summary>
00050 
00051 // <use visibility=local>
00052 
00053 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
00054 // </reviewed>
00055 
00056 // <prerequisite>
00057 //# Classes you should understand before using this one.
00058 //   <li> <linkto class=TSMColumn>TSMColumn</linkto>
00059 //   <li> <linkto class=TSMCube>TSMCube</linkto>
00060 // </prerequisite>
00061 
00062 // <etymology>
00063 // TSMDataColumn handles a data column for a Tiled
00064 // Storage Manager.
00065 // </etymology>
00066 
00067 // <synopsis> 
00068 // TSMDataColumn is used by 
00069 // <linkto class=TiledStMan>TiledStMan</linkto>
00070 // to handle the access to
00071 // a table column containing data of a tiled hypercube axis.
00072 // The data in a cell can be a scalar or an array (depending on its
00073 // definition in the table column description).
00074 // The shapes of the coordinates and the data are related. Therefore
00075 // the function setShape checks if the data shape matches the coordinates
00076 // shape.
00077 // <p>
00078 // The data are held in a TSMCube object. The row number
00079 // determines which TSMCube object has to be accessed.
00080 // <p>
00081 // The creation of a TSMDataColumn object is done by a TSMColumn object.
00082 // This process is described in more detail in the class
00083 // <linkto class=TSMColumn>TSMColumn</linkto>.
00084 // </synopsis> 
00085 
00086 // <motivation>
00087 // Handling data columns in the Tiled Storage Manager is
00088 // different from other columns.
00089 // </motivation>
00090 
00091 //# <todo asof="$DATE:$">
00092 //# A List of bugs, limitations, extensions or planned refinements.
00093 //# </todo>
00094 
00095 
00096 class TSMDataColumn : public TSMColumn
00097 {
00098 public:
00099 
00100     // Create a data column from the given column.
00101     TSMDataColumn (const TSMColumn& column);
00102 
00103     // Frees up the storage.
00104     virtual ~TSMDataColumn();
00105 
00106     // Return the size of a pixel in the tile in external format.
00107     uInt tilePixelSize() const;
00108 
00109     // Return the size of a pixel in the tile in local format.
00110     uInt localPixelSize() const;
00111 
00112     // Determine the length to store the given number of pixels.
00113     uInt dataLength (uInt nrPixels) const;
00114 
00115     // Set column sequence number.
00116     void setColumnNumber (uInt colnr);
00117 
00118     // It can handle access to a scalar column if there is one hypercube.
00119     Bool canAccessScalarColumn (Bool& reask) const;
00120 
00121     // It can handle access to an array column if there is one hypercube.
00122     Bool canAccessArrayColumn (Bool& reask) const;
00123 
00124     // It can handle access to a slice in a cell.
00125     Bool canAccessSlice (Bool& reask) const;
00126 
00127     // It can handle access to a slice in column if there is one hypercube.
00128     Bool canAccessColumnSlice (Bool& reask) const;
00129 
00130     // Changing array shapes for non-FixedShape columns when the
00131     // parent tiled storage manager can handle it.
00132     Bool canChangeShape() const;
00133 
00134     // Set the shape of the data array in the given row.
00135     // It will check if it matches already defined data and coordinates shapes.
00136     // It will define undefined data and coordinates shapes.
00137     void setShape (uInt rownr, const IPosition& shape);
00138 
00139     // Set the shape and tile shape of the array in the given row.
00140     // It will check if it matches already defined data and coordinates shapes.
00141     // It will define undefined data and coordinates shapes.
00142     // The tile shape is adjusted to the array shape (size 0 gets set to 1;
00143     // size > cubesize gets set to the cubesize).
00144     void setShapeTiled (uInt rownr, const IPosition& shape,
00145                         const IPosition& tileShape);
00146 
00147     // Is the value shape defined in the given row?
00148     Bool isShapeDefined (uInt rownr);
00149 
00150     // Get the shape of the item in the given row.
00151     IPosition shape (uInt rownr);
00152 
00153     // Get the tile shape of the item in the given row.
00154     IPosition tileShape (uInt rownr);
00155 
00156     // Get a scalar value in the given row.
00157     // The buffer pointed to by dataPtr has to have the correct length
00158     // (which is guaranteed by the Scalar/ArrayColumn get function).
00159     // <group>
00160     void getBoolV     (uInt rownr, Bool* dataPtr);
00161     void getuCharV    (uInt rownr, uChar* dataPtr);
00162     void getShortV    (uInt rownr, Short* dataPtr);
00163     void getuShortV   (uInt rownr, uShort* dataPtr);
00164     void getIntV      (uInt rownr, Int* dataPtr);
00165     void getuIntV     (uInt rownr, uInt* dataPtr);
00166     void getfloatV    (uInt rownr, float* dataPtr);
00167     void getdoubleV   (uInt rownr, double* dataPtr);
00168     void getComplexV  (uInt rownr, Complex* dataPtr);
00169     void getDComplexV (uInt rownr, DComplex* dataPtr);
00170     // </group>
00171 
00172     // Put a scalar value into the given row.
00173     // The buffer pointed to by dataPtr has to have the correct length
00174     // (which is guaranteed by the Scalar/ArrayColumn put function).
00175     // <group>
00176     void putBoolV     (uInt rownr, const Bool* dataPtr);
00177     void putuCharV    (uInt rownr, const uChar* dataPtr);
00178     void putShortV    (uInt rownr, const Short* dataPtr);
00179     void putuShortV   (uInt rownr, const uShort* dataPtr);
00180     void putIntV      (uInt rownr, const Int* dataPtr);
00181     void putuIntV     (uInt rownr, const uInt* dataPtr);
00182     void putfloatV    (uInt rownr, const float* dataPtr);
00183     void putdoubleV   (uInt rownr, const double* dataPtr);
00184     void putComplexV  (uInt rownr, const Complex* dataPtr);
00185     void putDComplexV (uInt rownr, const DComplex* dataPtr);
00186     // </group>
00187 
00188     // Get the array value in the given row.
00189     // The array pointed to by dataPtr has to have the correct length
00190     // (which is guaranteed by the ArrayColumn get function).
00191     // The default implementation thrown an "invalid operation exception".
00192     // <group>
00193     void getArrayBoolV     (uInt rownr, Array<Bool>* dataPtr);
00194     void getArrayuCharV    (uInt rownr, Array<uChar>* dataPtr);
00195     void getArrayShortV    (uInt rownr, Array<Short>* dataPtr);
00196     void getArrayuShortV   (uInt rownr, Array<uShort>* dataPtr);
00197     void getArrayIntV      (uInt rownr, Array<Int>* dataPtr);
00198     void getArrayuIntV     (uInt rownr, Array<uInt>* dataPtr);
00199     void getArrayfloatV    (uInt rownr, Array<float>* dataPtr);
00200     void getArraydoubleV   (uInt rownr, Array<double>* dataPtr);
00201     void getArrayComplexV  (uInt rownr, Array<Complex>* dataPtr);
00202     void getArrayDComplexV (uInt rownr, Array<DComplex>* dataPtr);
00203     // </group>
00204 
00205     // Put the array value into the given row.
00206     // The buffer pointed to by dataPtr has to have the correct length
00207     // (which is guaranteed by the ArrayColumn put function).
00208     // The default implementation thrown an "invalid operation exception".
00209     // <group>
00210     void putArrayBoolV     (uInt rownr, const Array<Bool>* dataPtr);
00211     void putArrayuCharV    (uInt rownr, const Array<uChar>* dataPtr);
00212     void putArrayShortV    (uInt rownr, const Array<Short>* dataPtr);
00213     void putArrayuShortV   (uInt rownr, const Array<uShort>* dataPtr);
00214     void putArrayIntV      (uInt rownr, const Array<Int>* dataPtr);
00215     void putArrayuIntV     (uInt rownr, const Array<uInt>* dataPtr);
00216     void putArrayfloatV    (uInt rownr, const Array<float>* dataPtr);
00217     void putArraydoubleV   (uInt rownr, const Array<double>* dataPtr);
00218     void putArrayComplexV  (uInt rownr, const Array<Complex>* dataPtr);
00219     void putArrayDComplexV (uInt rownr, const Array<DComplex>* dataPtr);
00220     // </group>
00221 
00222     void getSliceBoolV     (uInt rownr, const Slicer& slicer,
00223                             Array<Bool>* dataPtr);
00224     void getSliceuCharV    (uInt rownr, const Slicer& slicer,
00225                             Array<uChar>* dataPtr);
00226     void getSliceShortV    (uInt rownr, const Slicer& slicer,
00227                             Array<Short>* dataPtr);
00228     void getSliceuShortV   (uInt rownr, const Slicer& slicer,
00229                             Array<uShort>* dataPtr);
00230     void getSliceIntV      (uInt rownr, const Slicer& slicer,
00231                             Array<Int>* dataPtr);
00232     void getSliceuIntV     (uInt rownr, const Slicer& slicer,
00233                             Array<uInt>* dataPtr);
00234     void getSlicefloatV    (uInt rownr, const Slicer& slicer,
00235                             Array<float>* dataPtr);
00236     void getSlicedoubleV   (uInt rownr, const Slicer& slicer,
00237                             Array<double>* dataPtr);
00238     void getSliceComplexV  (uInt rownr, const Slicer& slicer,
00239                             Array<Complex>* dataPtr);
00240     void getSliceDComplexV (uInt rownr, const Slicer& slicer,
00241                             Array<DComplex>* dataPtr);
00242 
00243     void putSliceBoolV     (uInt rownr, const Slicer& slicer,
00244                             const Array<Bool>* dataPtr);
00245     void putSliceuCharV    (uInt rownr, const Slicer& slicer,
00246                             const Array<uChar>* dataPtr);
00247     void putSliceShortV    (uInt rownr, const Slicer& slicer,
00248                             const Array<Short>* dataPtr);
00249     void putSliceuShortV   (uInt rownr, const Slicer& slicer,
00250                             const Array<uShort>* dataPtr);
00251     void putSliceIntV      (uInt rownr, const Slicer& slicer,
00252                             const Array<Int>* dataPtr);
00253     void putSliceuIntV     (uInt rownr, const Slicer& slicer,
00254                             const Array<uInt>* dataPtr);
00255     void putSlicefloatV    (uInt rownr, const Slicer& slicer,
00256                             const Array<float>* dataPtr);
00257     void putSlicedoubleV   (uInt rownr, const Slicer& slicer,
00258                             const Array<double>* dataPtr);
00259     void putSliceComplexV  (uInt rownr, const Slicer& slicer,
00260                             const Array<Complex>* dataPtr);
00261     void putSliceDComplexV (uInt rownr, const Slicer& slicer,
00262                             const Array<DComplex>* dataPtr);
00263 
00264     void getScalarColumnBoolV     (Vector<Bool>* arr);
00265     void getScalarColumnuCharV    (Vector<uChar>* arr);
00266     void getScalarColumnShortV    (Vector<Short>* arr);
00267     void getScalarColumnuShortV   (Vector<uShort>* arr);
00268     void getScalarColumnIntV      (Vector<Int>* arr);
00269     void getScalarColumnuIntV     (Vector<uInt>* arr);
00270     void getScalarColumnfloatV    (Vector<float>* arr);
00271     void getScalarColumndoubleV   (Vector<double>* arr);
00272     void getScalarColumnComplexV  (Vector<Complex>* arr);
00273     void getScalarColumnDComplexV (Vector<DComplex>* arr);
00274 
00275     void putScalarColumnBoolV     (const Vector<Bool>* arr);
00276     void putScalarColumnuCharV    (const Vector<uChar>* arr);
00277     void putScalarColumnShortV    (const Vector<Short>* arr);
00278     void putScalarColumnuShortV   (const Vector<uShort>* arr);
00279     void putScalarColumnIntV      (const Vector<Int>* arr);
00280     void putScalarColumnuIntV     (const Vector<uInt>* arr);
00281     void putScalarColumnfloatV    (const Vector<float>* arr);
00282     void putScalarColumndoubleV   (const Vector<double>* arr);
00283     void putScalarColumnComplexV  (const Vector<Complex>* arr);
00284     void putScalarColumnDComplexV (const Vector<DComplex>* arr);
00285 
00286     // Get the scalar values in some cells of the column.
00287     // The buffer pointed to by dataPtr has to have the correct length.
00288     // (which is guaranteed by the ScalarColumn getColumnCells function).
00289     // The default implementation loops through all rows.
00290     // <group>
00291     virtual void getScalarColumnCellsBoolV     (const RefRows& rownrs,
00292                                                 Vector<Bool>* dataPtr);
00293     virtual void getScalarColumnCellsuCharV    (const RefRows& rownrs,
00294                                                 Vector<uChar>* dataPtr);
00295     virtual void getScalarColumnCellsShortV    (const RefRows& rownrs,
00296                                                 Vector<Short>* dataPtr);
00297     virtual void getScalarColumnCellsuShortV   (const RefRows& rownrs,
00298                                                 Vector<uShort>* dataPtr);
00299     virtual void getScalarColumnCellsIntV      (const RefRows& rownrs,
00300                                                 Vector<Int>* dataPtr);
00301     virtual void getScalarColumnCellsuIntV     (const RefRows& rownrs,
00302                                                 Vector<uInt>* dataPtr);
00303     virtual void getScalarColumnCellsfloatV    (const RefRows& rownrs,
00304                                                 Vector<float>* dataPtr);
00305     virtual void getScalarColumnCellsdoubleV   (const RefRows& rownrs,
00306                                                 Vector<double>* dataPtr);
00307     virtual void getScalarColumnCellsComplexV  (const RefRows& rownrs,
00308                                                 Vector<Complex>* dataPtr);
00309     virtual void getScalarColumnCellsDComplexV (const RefRows& rownrs,
00310                                                 Vector<DComplex>* dataPtr);
00311     // </group>
00312 
00313     // Put the scalar values into some cells of the column.
00314     // The buffer pointed to by dataPtr has to have the correct length.
00315     // (which is guaranteed by the ScalarColumn putColumnCells function).
00316     // The default implementation loops through all rows.
00317     // <group>
00318     virtual void putScalarColumnCellsBoolV     (const RefRows& rownrs,
00319                                                 const Vector<Bool>* dataPtr);
00320     virtual void putScalarColumnCellsuCharV    (const RefRows& rownrs,
00321                                                 const Vector<uChar>* dataPtr);
00322     virtual void putScalarColumnCellsShortV    (const RefRows& rownrs,
00323                                                 const Vector<Short>* dataPtr);
00324     virtual void putScalarColumnCellsuShortV   (const RefRows& rownrs,
00325                                                 const Vector<uShort>* dataPtr);
00326     virtual void putScalarColumnCellsIntV      (const RefRows& rownrs,
00327                                                 const Vector<Int>* dataPtr);
00328     virtual void putScalarColumnCellsuIntV     (const RefRows& rownrs,
00329                                                 const Vector<uInt>* dataPtr);
00330     virtual void putScalarColumnCellsfloatV    (const RefRows& rownrs,
00331                                                 const Vector<float>* dataPtr);
00332     virtual void putScalarColumnCellsdoubleV   (const RefRows& rownrs,
00333                                                 const Vector<double>* dataPtr);
00334     virtual void putScalarColumnCellsComplexV  (const RefRows& rownrs,
00335                                                 const Vector<Complex>* dataPtr);
00336     virtual void putScalarColumnCellsDComplexV (const RefRows& rownrs,
00337                                                const Vector<DComplex>* dataPtr);
00338     // </group>
00339 
00340     void getArrayColumnBoolV     (Array<Bool>* arr);
00341     void getArrayColumnuCharV    (Array<uChar>* arr);
00342     void getArrayColumnShortV    (Array<Short>* arr);
00343     void getArrayColumnuShortV   (Array<uShort>* arr);
00344     void getArrayColumnIntV      (Array<Int>* arr);
00345     void getArrayColumnuIntV     (Array<uInt>* arr);
00346     void getArrayColumnfloatV    (Array<float>* arr);
00347     void getArrayColumndoubleV   (Array<double>* arr);
00348     void getArrayColumnComplexV  (Array<Complex>* arr);
00349     void getArrayColumnDComplexV (Array<DComplex>* arr);
00350 
00351     void putArrayColumnBoolV     (const Array<Bool>* arr);
00352     void putArrayColumnuCharV    (const Array<uChar>* arr);
00353     void putArrayColumnShortV    (const Array<Short>* arr);
00354     void putArrayColumnuShortV   (const Array<uShort>* arr);
00355     void putArrayColumnIntV      (const Array<Int>* arr);
00356     void putArrayColumnuIntV     (const Array<uInt>* arr);
00357     void putArrayColumnfloatV    (const Array<float>* arr);
00358     void putArrayColumndoubleV   (const Array<double>* arr);
00359     void putArrayColumnComplexV  (const Array<Complex>* arr);
00360     void putArrayColumnDComplexV (const Array<DComplex>* arr);
00361 
00362     // Get the array values in some cells of the column.
00363     // The buffer pointed to by dataPtr has to have the correct length.
00364     // (which is guaranteed by the ArrayColumn getColumnCells function).
00365     // The default implementation throws an "invalid operation exception".
00366     // <group>
00367     virtual void getArrayColumnCellsBoolV     (const RefRows& rownrs,
00368                                                Array<Bool>* dataPtr);
00369     virtual void getArrayColumnCellsuCharV    (const RefRows& rownrs,
00370                                                Array<uChar>* dataPtr);
00371     virtual void getArrayColumnCellsShortV    (const RefRows& rownrs,
00372                                                Array<Short>* dataPtr);
00373     virtual void getArrayColumnCellsuShortV   (const RefRows& rownrs,
00374                                                Array<uShort>* dataPtr);
00375     virtual void getArrayColumnCellsIntV      (const RefRows& rownrs,
00376                                                Array<Int>* dataPtr);
00377     virtual void getArrayColumnCellsuIntV     (const RefRows& rownrs,
00378                                                Array<uInt>* dataPtr);
00379     virtual void getArrayColumnCellsfloatV    (const RefRows& rownrs,
00380                                                Array<float>* dataPtr);
00381     virtual void getArrayColumnCellsdoubleV   (const RefRows& rownrs,
00382                                                Array<double>* dataPtr);
00383     virtual void getArrayColumnCellsComplexV  (const RefRows& rownrs,
00384                                                Array<Complex>* dataPtr);
00385     virtual void getArrayColumnCellsDComplexV (const RefRows& rownrs,
00386                                                Array<DComplex>* dataPtr);
00387     // </group>
00388 
00389     // Put the array values into some cells of the column.
00390     // The buffer pointed to by dataPtr has to have the correct length.
00391     // (which is guaranteed by the ArrayColumn putColumnCells function).
00392     // The default implementation throws an "invalid operation exception".
00393     // <group>
00394     virtual void putArrayColumnCellsBoolV     (const RefRows& rownrs,
00395                                                const Array<Bool>* dataPtr);
00396     virtual void putArrayColumnCellsuCharV    (const RefRows& rownrs,
00397                                                const Array<uChar>* dataPtr);
00398     virtual void putArrayColumnCellsShortV    (const RefRows& rownrs,
00399                                                const Array<Short>* dataPtr);
00400     virtual void putArrayColumnCellsuShortV   (const RefRows& rownrs,
00401                                                const Array<uShort>* dataPtr);
00402     virtual void putArrayColumnCellsIntV      (const RefRows& rownrs,
00403                                                const Array<Int>* dataPtr);
00404     virtual void putArrayColumnCellsuIntV     (const RefRows& rownrs,
00405                                                const Array<uInt>* dataPtr);
00406     virtual void putArrayColumnCellsfloatV    (const RefRows& rownrs,
00407                                                const Array<float>* dataPtr);
00408     virtual void putArrayColumnCellsdoubleV   (const RefRows& rownrs,
00409                                                const Array<double>* dataPtr);
00410     virtual void putArrayColumnCellsComplexV  (const RefRows& rownrs,
00411                                                const Array<Complex>* dataPtr);
00412     virtual void putArrayColumnCellsDComplexV (const RefRows& rownrs,
00413                                                const Array<DComplex>* dataPtr);
00414     // </group>
00415 
00416     void getColumnSliceBoolV     (const Slicer& slicer, Array<Bool>* arr);
00417     void getColumnSliceuCharV    (const Slicer& slicer, Array<uChar>* arr);
00418     void getColumnSliceShortV    (const Slicer& slicer, Array<Short>* arr);
00419     void getColumnSliceuShortV   (const Slicer& slicer, Array<uShort>* arr);
00420     void getColumnSliceIntV      (const Slicer& slicer, Array<Int>* arr);
00421     void getColumnSliceuIntV     (const Slicer& slicer, Array<uInt>* arr);
00422     void getColumnSlicefloatV    (const Slicer& slicer, Array<float>* arr);
00423     void getColumnSlicedoubleV   (const Slicer& slicer, Array<double>* arr);
00424     void getColumnSliceComplexV  (const Slicer& slicer, Array<Complex>* arr);
00425     void getColumnSliceDComplexV (const Slicer& slicer, Array<DComplex>* arr);
00426 
00427     void putColumnSliceBoolV     (const Slicer& slicer,
00428                                   const Array<Bool>* dataPtr);
00429     void putColumnSliceuCharV    (const Slicer& slicer,
00430                                   const Array<uChar>* dataPtr);
00431     void putColumnSliceShortV    (const Slicer& slicer,
00432                                   const Array<Short>* dataPtr);
00433     void putColumnSliceuShortV   (const Slicer& slicer,
00434                                   const Array<uShort>* dataPtr);
00435     void putColumnSliceIntV      (const Slicer& slicer,
00436                                   const Array<Int>* dataPtr);
00437     void putColumnSliceuIntV     (const Slicer& slicer,
00438                                   const Array<uInt>* dataPtr);
00439     void putColumnSlicefloatV    (const Slicer& slicer,
00440                                   const Array<float>* dataPtr);
00441     void putColumnSlicedoubleV   (const Slicer& slicer,
00442                                   const Array<double>* dataPtr);
00443     void putColumnSliceComplexV  (const Slicer& slicer,
00444                                   const Array<Complex>* dataPtr);
00445     void putColumnSliceDComplexV (const Slicer& slicer,
00446                                   const Array<DComplex>* dataPtr);
00447  
00448     // Get the array values in some cells of the column.
00449     // The buffer pointed to by dataPtr has to have the correct length.
00450     // (which is guaranteed by the ArrayColumn getColumnCells function).
00451     // The default implementation throws an "invalid operation exception".
00452     // <group>
00453     virtual void getColumnSliceCellsBoolV     (const RefRows& rownrs,
00454                                                const Slicer& ns,
00455                                                Array<Bool>* dataPtr);
00456     virtual void getColumnSliceCellsuCharV    (const RefRows& rownrs,
00457                                                const Slicer& ns,
00458                                                Array<uChar>* dataPtr);
00459     virtual void getColumnSliceCellsShortV    (const RefRows& rownrs,
00460                                                const Slicer& ns,
00461                                                Array<Short>* dataPtr);
00462     virtual void getColumnSliceCellsuShortV   (const RefRows& rownrs,
00463                                                const Slicer& ns,
00464                                                Array<uShort>* dataPtr);
00465     virtual void getColumnSliceCellsIntV      (const RefRows& rownrs,
00466                                                const Slicer& ns,
00467                                                Array<Int>* dataPtr);
00468     virtual void getColumnSliceCellsuIntV     (const RefRows& rownrs,
00469                                                const Slicer& ns,
00470                                                Array<uInt>* dataPtr);
00471     virtual void getColumnSliceCellsfloatV    (const RefRows& rownrs,
00472                                                const Slicer& ns,
00473                                                Array<float>* dataPtr);
00474     virtual void getColumnSliceCellsdoubleV   (const RefRows& rownrs,
00475                                                const Slicer& ns,
00476                                                Array<double>* dataPtr);
00477     virtual void getColumnSliceCellsComplexV  (const RefRows& rownrs,
00478                                                const Slicer& ns,
00479                                                Array<Complex>* dataPtr);
00480     virtual void getColumnSliceCellsDComplexV (const RefRows& rownrs,
00481                                                const Slicer& ns,
00482                                                Array<DComplex>* dataPtr);
00483     // </group>
00484 
00485     // Put the array values into some cells of the column.
00486     // The buffer pointed to by dataPtr has to have the correct length.
00487     // (which is guaranteed by the ArrayColumn putColumnSlice function).
00488     // The default implementation throws an "invalid operation exception".
00489     // <group>
00490     virtual void putColumnSliceCellsBoolV     (const RefRows& rownrs,
00491                                                const Slicer& ns,
00492                                                const Array<Bool>* dataPtr);
00493     virtual void putColumnSliceCellsuCharV    (const RefRows& rownrs,
00494                                                const Slicer& ns,
00495                                                const Array<uChar>* dataPtr);
00496     virtual void putColumnSliceCellsShortV    (const RefRows& rownrs,
00497                                                const Slicer& ns,
00498                                                const Array<Short>* dataPtr);
00499     virtual void putColumnSliceCellsuShortV   (const RefRows& rownrs,
00500                                                const Slicer& ns,
00501                                                const Array<uShort>* dataPtr);
00502     virtual void putColumnSliceCellsIntV      (const RefRows& rownrs,
00503                                                const Slicer& ns,
00504                                                const Array<Int>* dataPtr);
00505     virtual void putColumnSliceCellsuIntV     (const RefRows& rownrs,
00506                                                const Slicer& ns,
00507                                                const Array<uInt>* dataPtr);
00508     virtual void putColumnSliceCellsfloatV    (const RefRows& rownrs,
00509                                                const Slicer& ns,
00510                                                const Array<float>* dataPtr);
00511     virtual void putColumnSliceCellsdoubleV   (const RefRows& rownrs,
00512                                                const Slicer& ns,
00513                                                const Array<double>* dataPtr);
00514     virtual void putColumnSliceCellsComplexV  (const RefRows& rownrs,
00515                                                const Slicer& ns,
00516                                                const Array<Complex>* dataPtr);
00517     virtual void putColumnSliceCellsDComplexV (const RefRows& rownrs,
00518                                                const Slicer& ns,
00519                                                const Array<DComplex>* dataPtr);
00520     // </group>
00521 
00522     // Read the data of the column from a tile.
00523     // (I.e. convert from external to local format).
00524     void readTile (void* to, const void* from, uInt nrPixels);
00525 
00526     // Write the data of the column into a tile.
00527     // (I.e. convert from local to external format).
00528     void writeTile (void* to, const void* from, uInt nrPixels);
00529 
00530     // Get the function to convert from external to local format
00531     // (or vice-versa if <src>writeFlag=True</src>).
00532     Conversion::ValueFunction* getConvertFunction (Bool writeFlag) const
00533       { return writeFlag ?  writeFunc_p : readFunc_p; }
00534 
00535     // Get nr of elements in a value to convert (usually 1, but 2 for Complex).
00536     size_t getNrConvert() const
00537       { return convPixelSize_p; }
00538 
00539     // Does a conversion (byte swap) needs to be done?
00540     Bool isConversionNeeded() const
00541       { return mustConvert_p; }
00542 
00543 private:
00544     // The (canonical) size of a pixel in a tile.
00545     uInt tilePixelSize_p;
00546     // The local size of a pixel.
00547     uInt localPixelSize_p;
00548     // The multiplication factor for a conversion operation.
00549     // This is the pixel size when a memcpy can be used, otherwise it is 1.
00550     uInt convPixelSize_p;
00551     // Is a conversion necessary?
00552     Bool mustConvert_p;
00553     // The column sequence number.
00554     uInt colnr_p;
00555     // The conversion function needed when reading.
00556     Conversion::ValueFunction* readFunc_p;
00557     // The conversion function needed when writing.
00558     Conversion::ValueFunction* writeFunc_p;
00559 
00560 
00561     // Forbid copy constructor.
00562     TSMDataColumn (const TSMDataColumn&);
00563 
00564     // Forbid assignment.
00565     TSMDataColumn& operator= (const TSMDataColumn&);
00566 
00567     // Read or write a data cell in the cube.
00568     // A cell can contain a scalar or an array (depending on the
00569     // column definition).
00570     void accessCell (uInt rownr,
00571                      const void* dataPtr, Bool writeFlag);
00572 
00573     // Read or write a slice of a data cell in the cube.
00574     void accessCellSlice (uInt rownr, const Slicer& ns,
00575                           const void* dataPtr, Bool writeFlag);
00576 
00577     // Read or write an entire column.
00578     // This can only be done if one hypercube is used.
00579     void accessColumn (const void* dataPtr, Bool writeFlag);
00580 
00581     // Read or write a slice from the entire column.
00582     // This can only be done if one hypercube is used.
00583     void accessColumnSlice (const Slicer& ns,
00584                             const void* dataPtr, Bool writeFlag);
00585 
00586     // Read or write some cells in a column.
00587     // It tries to optimize by looking for regular row strides.
00588     void accessColumnCells (const RefRows& rownrs,  const IPosition& shape,
00589                             const void* dataPtr, Bool writeFlag);
00590 
00591     // Read or write some cells in a column.
00592     // It tries to optimize by looking for regular row strides.
00593     void accessColumnSliceCells (const RefRows& rownrs, const Slicer& ns,
00594                                  const IPosition& shape,
00595                                  const void* dataPtr, Bool writeFlag);
00596 
00597     // Read or write the full cells given by start,end,incr.
00598     void accessFullCells (TSMCube* hypercube,
00599                           char* dataPtr, Bool writeFlag,
00600                           const IPosition& start,
00601                           const IPosition& end,
00602                           const IPosition& incr);
00603 
00604     // Read or write the sliced cells given by start,end,incr.
00605     void accessSlicedCells (TSMCube* hypercube,
00606                             char* dataPtr, Bool writeFlag,
00607                             const IPosition& start,
00608                             const IPosition& end,
00609                             const IPosition& incr);
00610 };
00611 
00612 
00613 inline uInt TSMDataColumn::tilePixelSize() const
00614 {
00615     return tilePixelSize_p;
00616 }
00617 inline uInt TSMDataColumn::localPixelSize() const
00618 {
00619     return localPixelSize_p;
00620 }
00621 inline void TSMDataColumn::setColumnNumber (uInt colnr)
00622 {
00623     colnr_p = colnr;
00624 }
00625 inline void TSMDataColumn::readTile (void* to, const void* from,
00626                                      uInt nrPixels)
00627 {
00628     readFunc_p (to, from, nrPixels * convPixelSize_p);
00629 }
00630 inline void TSMDataColumn::writeTile (void* to, const void* from,
00631                                       uInt nrPixels)
00632 {
00633     writeFunc_p (to, from, nrPixels * convPixelSize_p);
00634 }
00635 
00636 
00637 
00638 } //# NAMESPACE CASACORE - END
00639 
00640 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1