00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef TABLES_TILEDFILEACCESS_H
00029 #define TABLES_TILEDFILEACCESS_H
00030
00031
00032
00033 #include <casacore/casa/aips.h>
00034 #include <casacore/tables/DataMan/TSMCube.h>
00035 #include <casacore/tables/DataMan/TSMOption.h>
00036 #include <casacore/casa/Utilities/DataType.h>
00037
00038 namespace casacore {
00039
00040
00041 class TiledFileHelper;
00042 class Slicer;
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 class TiledFileAccess
00093 {
00094 public:
00095
00096
00097
00098
00099 TiledFileAccess (const String& fileName, Int64 fileOffset,
00100 const IPosition& shape, const IPosition& tileShape,
00101 DataType dataType,
00102 const TSMOption& = TSMOption(),
00103 Bool writable=False);
00104
00105
00106
00107 TiledFileAccess (const String& fileName, Int64 fileOffset,
00108 const IPosition& shape, const IPosition& tileShape,
00109 DataType dataType,
00110 const TSMOption&,
00111 Bool writable, Bool bigEndian);
00112
00113 ~TiledFileAccess();
00114
00115
00116 Bool isWritable() const
00117 { return itsWritable; }
00118
00119 DataType dataType() const
00120 { return itsDataType; }
00121
00122
00123
00124
00125 Array<Bool> getBool (const Slicer& section);
00126 Array<uChar> getUChar (const Slicer& section);
00127 Array<Short> getShort (const Slicer& section);
00128 Array<Int> getInt (const Slicer& section);
00129 Array<Float> getFloat (const Slicer& section);
00130 Array<Double> getDouble (const Slicer& section);
00131 Array<Complex> getComplex (const Slicer& section);
00132 Array<DComplex> getDComplex (const Slicer& section);
00133 void get (Array<Bool>&, const Slicer& section);
00134 void get (Array<uChar>&, const Slicer& section);
00135 void get (Array<Short>&, const Slicer& section);
00136 void get (Array<Int>&, const Slicer& section);
00137 void get (Array<Float>&, const Slicer& section);
00138 void get (Array<Double>&, const Slicer& section);
00139 void get (Array<Complex>&, const Slicer& section);
00140 void get (Array<DComplex>&, const Slicer& section);
00141
00142
00143
00144
00145
00146
00147
00148 Array<Float> getFloat (const Slicer& section, Float scale, Float offset,
00149 uChar deleteValue, Bool examineForDeleteValues=True);
00150 Array<Float> getFloat (const Slicer& section, Float scale, Float offset,
00151 Short deleteValue, Bool examineForDeleteValues=True);
00152 Array<Float> getFloat (const Slicer& section, Float scale, Float offset,
00153 Int deleteValue, Bool examineForDeleteValues=True);
00154 void get (Array<Float>&, const Slicer& section,
00155 Float scale, Float offset, uChar deleteValue,
00156 Bool examineForDeleteValues=True);
00157 void get (Array<Float>&, const Slicer& section,
00158 Float scale, Float offset, Short deleteValue,
00159 Bool examineForDeleteValues=True);
00160 void get (Array<Float>&, const Slicer& section,
00161 Float scale, Float offset, Int deleteValue,
00162 Bool examineForDeleteValues=True);
00163
00164
00165
00166
00167 void put (const Array<Bool>&, const Slicer& section);
00168 void put (const Array<uChar>&, const Slicer& section);
00169 void put (const Array<Short>&, const Slicer& section);
00170 void put (const Array<Int>&, const Slicer& section);
00171 void put (const Array<Float>&, const Slicer& section);
00172 void put (const Array<Double>&, const Slicer& section);
00173 void put (const Array<Complex>&, const Slicer& section);
00174 void put (const Array<DComplex>&, const Slicer& section);
00175
00176
00177
00178 void flush()
00179 { itsCube->flushCache(); }
00180
00181
00182
00183
00184
00185 void clearCache()
00186 { itsCube->emptyCache(); }
00187
00188
00189 void showCacheStatistics (ostream& os) const
00190 { itsCube->showCacheStatistics (os); }
00191
00192
00193 const IPosition& shape() const
00194 { return itsCube->cubeShape(); }
00195
00196
00197 const IPosition& tileShape() const
00198 { return itsCube->tileShape(); }
00199
00200
00201
00202 void setMaximumCacheSize (uInt nbytes);
00203
00204
00205 uInt maximumCacheSize() const;
00206
00207
00208 uInt cacheSize() const
00209 { return itsCube->cacheSize(); }
00210
00211
00212
00213 void setCacheSize (const IPosition& sliceShape,
00214 const IPosition& axisPath,
00215 Bool forceSmaller=True)
00216 { itsCube->setCacheSize (sliceShape, IPosition(), IPosition(),
00217 axisPath, forceSmaller, True); }
00218 void setCacheSize (const IPosition& sliceShape,
00219 const IPosition& windowStart,
00220 const IPosition& windowLength,
00221 const IPosition& axisPath,
00222 Bool forceSmaller=True)
00223 { itsCube->setCacheSize (sliceShape, windowStart, windowLength,
00224 axisPath, forceSmaller, True); }
00225
00226
00227
00228
00229
00230
00231
00232 void setCacheSize (uInt nbuckets, Bool forceSmaller=True)
00233 { itsCube->setCacheSize (nbuckets, forceSmaller, True); }
00234
00235
00236
00237 static IPosition makeTileShape (const IPosition& arrayShape,
00238 uInt nrPixelsPerTile = 32768);
00239
00240
00241 private:
00242
00243
00244 TiledFileAccess (const TiledFileAccess&);
00245 TiledFileAccess& operator= (const TiledFileAccess&);
00246
00247
00248
00249 TSMCube* itsCube;
00250 TiledFileHelper* itsTSM;
00251 uInt itsLocalPixelSize;
00252 Bool itsWritable;
00253 DataType itsDataType;
00254 };
00255
00256
00257
00258 }
00259
00260 #endif