casacore
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::TiledFileAccess Class Reference

More...

#include <TiledFileAccess.h>

Public Member Functions

 TiledFileAccess (const String &fileName, Int64 fileOffset, const IPosition &shape, const IPosition &tileShape, DataType dataType, const TSMOption &=TSMOption(), Bool writable=False)
 Create a TiledFileAccess object. More...
 
 TiledFileAccess (const String &fileName, Int64 fileOffset, const IPosition &shape, const IPosition &tileShape, DataType dataType, const TSMOption &, Bool writable, Bool bigEndian)
 Create a TiledFileAccess object. More...
 
 ~TiledFileAccess ()
 
Bool isWritable () const
 Is the file writable? More...
 
DataType dataType () const
 
Array< BoolgetBool (const Slicer &section)
 Get part of the array. More...
 
Array< uChargetUChar (const Slicer &section)
 
Array< ShortgetShort (const Slicer &section)
 
Array< IntgetInt (const Slicer &section)
 
Array< FloatgetFloat (const Slicer &section)
 
Array< DoublegetDouble (const Slicer &section)
 
Array< Complex > getComplex (const Slicer &section)
 
Array< DComplex > getDComplex (const Slicer &section)
 
void get (Array< Bool > &, const Slicer &section)
 
void get (Array< uChar > &, const Slicer &section)
 
void get (Array< Short > &, const Slicer &section)
 
void get (Array< Int > &, const Slicer &section)
 
void get (Array< Float > &, const Slicer &section)
 
void get (Array< Double > &, const Slicer &section)
 
void get (Array< Complex > &, const Slicer &section)
 
void get (Array< DComplex > &, const Slicer &section)
 
Array< FloatgetFloat (const Slicer &section, Float scale, Float offset, uChar deleteValue, Bool examineForDeleteValues=True)
 Get the array and scale/offset the data using the given values. More...
 
Array< FloatgetFloat (const Slicer &section, Float scale, Float offset, Short deleteValue, Bool examineForDeleteValues=True)
 
Array< FloatgetFloat (const Slicer &section, Float scale, Float offset, Int deleteValue, Bool examineForDeleteValues=True)
 
void get (Array< Float > &, const Slicer &section, Float scale, Float offset, uChar deleteValue, Bool examineForDeleteValues=True)
 
void get (Array< Float > &, const Slicer &section, Float scale, Float offset, Short deleteValue, Bool examineForDeleteValues=True)
 
void get (Array< Float > &, const Slicer &section, Float scale, Float offset, Int deleteValue, Bool examineForDeleteValues=True)
 
void put (const Array< Bool > &, const Slicer &section)
 Put part of the array. More...
 
void put (const Array< uChar > &, const Slicer &section)
 
void put (const Array< Short > &, const Slicer &section)
 
void put (const Array< Int > &, const Slicer &section)
 
void put (const Array< Float > &, const Slicer &section)
 
void put (const Array< Double > &, const Slicer &section)
 
void put (const Array< Complex > &, const Slicer &section)
 
void put (const Array< DComplex > &, const Slicer &section)
 
void flush ()
 Flush the cache. More...
 
void clearCache ()
 Empty the cache. More...
 
void showCacheStatistics (ostream &os) const
 Show the cache statistics. More...
 
const IPositionshape () const
 Get the shape of the array. More...
 
const IPositiontileShape () const
 Get the shape of the tiles. More...
 
void setMaximumCacheSize (uInt64 nbytes)
 Set the maximum cache size (in bytes). More...
 
uInt64 maximumCacheSize () const
 Get the maximum cache size (in bytes). More...
 
uInt cacheSize () const
 Get the current cache size (in buckets). More...
 
void setCacheSize (const IPosition &sliceShape, const IPosition &axisPath, Bool forceSmaller=True)
 Set the cache size using the given access pattern. More...
 
void setCacheSize (const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath, Bool forceSmaller=True)
 
void setCacheSize (uInt nbuckets, Bool forceSmaller=True)
 Set the cache size for accessing the data. More...
 

Static Public Member Functions

static IPosition makeTileShape (const IPosition &arrayShape, uInt nrPixelsPerTile=32768)
 Make a tile shape from the array shape to fit as closely as possible the number of pixels in the tile. More...
 

Private Member Functions

 TiledFileAccess (const TiledFileAccess &)
 Forbid copy constructor and assignment. More...
 
TiledFileAccessoperator= (const TiledFileAccess &)
 

Private Attributes

TSMCubeitsCube
 
TiledFileHelperitsTSM
 
uInt itsLocalPixelSize
 
Bool itsWritable
 
DataType itsDataType
 

Detailed Description

Tiled access to an array in a file.

Intended use:

Public interface

Review Status

Test programs:
tTiledFileAccess

Prerequisite

Synopsis

TiledFileAccess is a class that makes it possible to access an arbitrary array in a file using the tiled storage manager classes. It can handle arrays of any type supported by the tiled storage managers. The array can be in big or little endian canonical format.

See ROTiledStManAccessor for a more detailed discussion.

Motivation

This class makes it possible to access an image in a FITS file.

Example

// Define the object which also opens the file.
// The (float) array starts at offset 2880.
TiledFileAccess tfa ("fits.file", 2880, IPosition(2,512,512),
IPosition(2,512,1), TpFloat);
// Get all the data.
Array<Float> data = tfa.getFloat (Slicer(IPosition(2,0,0), tfa.shape()));
TiledFileAccess(const String &fileName, Int64 fileOffset, const IPosition &shape, const IPosition &tileShape, DataType dataType, const TSMOption &=TSMOption(), Bool writable=False)
Create a TiledFileAccess object.

Definition at line 92 of file TiledFileAccess.h.

Constructor & Destructor Documentation

◆ TiledFileAccess() [1/3]

casacore::TiledFileAccess::TiledFileAccess ( const String fileName,
Int64  fileOffset,
const IPosition shape,
const IPosition tileShape,
DataType  dataType,
const TSMOption = TSMOption(),
Bool  writable = False 
)

Create a TiledFileAccess object.

The data is assumed to be in local canonical format (thus big endian on e.g. SUN and little endian on e.g. PC). The TSMOption determines how the file is accessed.

◆ TiledFileAccess() [2/3]

casacore::TiledFileAccess::TiledFileAccess ( const String fileName,
Int64  fileOffset,
const IPosition shape,
const IPosition tileShape,
DataType  dataType,
const TSMOption ,
Bool  writable,
Bool  bigEndian 
)

Create a TiledFileAccess object.

The endian format of the data is explicitly given.

◆ ~TiledFileAccess()

casacore::TiledFileAccess::~TiledFileAccess ( )

◆ TiledFileAccess() [3/3]

casacore::TiledFileAccess::TiledFileAccess ( const TiledFileAccess )
private

Forbid copy constructor and assignment.

Member Function Documentation

◆ cacheSize()

uInt casacore::TiledFileAccess::cacheSize ( ) const
inline

Get the current cache size (in buckets).

Definition at line 208 of file TiledFileAccess.h.

References casacore::TSMCube::cacheSize(), and itsCube.

◆ clearCache()

void casacore::TiledFileAccess::clearCache ( )
inline

Empty the cache.

It will flush the cache as needed and remove all buckets from it resulting in a possibly large drop in memory used. It'll also clear the userSetCache_p flag.

Definition at line 185 of file TiledFileAccess.h.

References casacore::TSMCube::emptyCache(), and itsCube.

◆ dataType()

DataType casacore::TiledFileAccess::dataType ( ) const
inline

Definition at line 119 of file TiledFileAccess.h.

References itsDataType.

◆ flush()

void casacore::TiledFileAccess::flush ( )
inline

Flush the cache.

Definition at line 178 of file TiledFileAccess.h.

References casacore::TSMCube::flushCache(), and itsCube.

◆ get() [1/11]

void casacore::TiledFileAccess::get ( Array< Bool > &  ,
const Slicer section 
)

◆ get() [2/11]

void casacore::TiledFileAccess::get ( Array< Complex > &  ,
const Slicer section 
)

◆ get() [3/11]

void casacore::TiledFileAccess::get ( Array< DComplex > &  ,
const Slicer section 
)

◆ get() [4/11]

void casacore::TiledFileAccess::get ( Array< Double > &  ,
const Slicer section 
)

◆ get() [5/11]

void casacore::TiledFileAccess::get ( Array< Float > &  ,
const Slicer section 
)

◆ get() [6/11]

void casacore::TiledFileAccess::get ( Array< Float > &  ,
const Slicer section,
Float  scale,
Float  offset,
Int  deleteValue,
Bool  examineForDeleteValues = True 
)

◆ get() [7/11]

void casacore::TiledFileAccess::get ( Array< Float > &  ,
const Slicer section,
Float  scale,
Float  offset,
Short  deleteValue,
Bool  examineForDeleteValues = True 
)

◆ get() [8/11]

void casacore::TiledFileAccess::get ( Array< Float > &  ,
const Slicer section,
Float  scale,
Float  offset,
uChar  deleteValue,
Bool  examineForDeleteValues = True 
)

◆ get() [9/11]

void casacore::TiledFileAccess::get ( Array< Int > &  ,
const Slicer section 
)

◆ get() [10/11]

void casacore::TiledFileAccess::get ( Array< Short > &  ,
const Slicer section 
)

◆ get() [11/11]

void casacore::TiledFileAccess::get ( Array< uChar > &  ,
const Slicer section 
)

◆ getBool()

Array<Bool> casacore::TiledFileAccess::getBool ( const Slicer section)

Get part of the array.

The Array object is resized if needed.

◆ getComplex()

Array<Complex> casacore::TiledFileAccess::getComplex ( const Slicer section)

◆ getDComplex()

Array<DComplex> casacore::TiledFileAccess::getDComplex ( const Slicer section)

◆ getDouble()

Array<Double> casacore::TiledFileAccess::getDouble ( const Slicer section)

◆ getFloat() [1/4]

Array<Float> casacore::TiledFileAccess::getFloat ( const Slicer section)

◆ getFloat() [2/4]

Array<Float> casacore::TiledFileAccess::getFloat ( const Slicer section,
Float  scale,
Float  offset,
Int  deleteValue,
Bool  examineForDeleteValues = True 
)

◆ getFloat() [3/4]

Array<Float> casacore::TiledFileAccess::getFloat ( const Slicer section,
Float  scale,
Float  offset,
Short  deleteValue,
Bool  examineForDeleteValues = True 
)

◆ getFloat() [4/4]

Array<Float> casacore::TiledFileAccess::getFloat ( const Slicer section,
Float  scale,
Float  offset,
uChar  deleteValue,
Bool  examineForDeleteValues = True 
)

Get the array and scale/offset the data using the given values.

It is meant for FITS, so for now they can only be used for TpUChar, TpShort or TpInt TiledFileAccess objects. A deleteValue is set to a NaN without being scaled.

◆ getInt()

Array<Int> casacore::TiledFileAccess::getInt ( const Slicer section)

◆ getShort()

Array<Short> casacore::TiledFileAccess::getShort ( const Slicer section)

◆ getUChar()

Array<uChar> casacore::TiledFileAccess::getUChar ( const Slicer section)

◆ isWritable()

Bool casacore::TiledFileAccess::isWritable ( ) const
inline

Is the file writable?

Definition at line 116 of file TiledFileAccess.h.

References itsWritable.

◆ makeTileShape()

static IPosition casacore::TiledFileAccess::makeTileShape ( const IPosition arrayShape,
uInt  nrPixelsPerTile = 32768 
)
static

Make a tile shape from the array shape to fit as closely as possible the number of pixels in the tile.

◆ maximumCacheSize()

uInt64 casacore::TiledFileAccess::maximumCacheSize ( ) const

Get the maximum cache size (in bytes).

◆ operator=()

TiledFileAccess& casacore::TiledFileAccess::operator= ( const TiledFileAccess )
private

◆ put() [1/8]

void casacore::TiledFileAccess::put ( const Array< Bool > &  ,
const Slicer section 
)

Put part of the array.

◆ put() [2/8]

void casacore::TiledFileAccess::put ( const Array< Complex > &  ,
const Slicer section 
)

◆ put() [3/8]

void casacore::TiledFileAccess::put ( const Array< DComplex > &  ,
const Slicer section 
)

◆ put() [4/8]

void casacore::TiledFileAccess::put ( const Array< Double > &  ,
const Slicer section 
)

◆ put() [5/8]

void casacore::TiledFileAccess::put ( const Array< Float > &  ,
const Slicer section 
)

◆ put() [6/8]

void casacore::TiledFileAccess::put ( const Array< Int > &  ,
const Slicer section 
)

◆ put() [7/8]

void casacore::TiledFileAccess::put ( const Array< Short > &  ,
const Slicer section 
)

◆ put() [8/8]

void casacore::TiledFileAccess::put ( const Array< uChar > &  ,
const Slicer section 
)

◆ setCacheSize() [1/3]

void casacore::TiledFileAccess::setCacheSize ( const IPosition sliceShape,
const IPosition axisPath,
Bool  forceSmaller = True 
)
inline

Set the cache size using the given access pattern.

Definition at line 213 of file TiledFileAccess.h.

References itsCube, casacore::TSMCube::setCacheSize(), and casacore::True.

◆ setCacheSize() [2/3]

void casacore::TiledFileAccess::setCacheSize ( const IPosition sliceShape,
const IPosition windowStart,
const IPosition windowLength,
const IPosition axisPath,
Bool  forceSmaller = True 
)
inline

Definition at line 218 of file TiledFileAccess.h.

References itsCube, casacore::TSMCube::setCacheSize(), and casacore::True.

◆ setCacheSize() [3/3]

void casacore::TiledFileAccess::setCacheSize ( uInt  nbuckets,
Bool  forceSmaller = True 
)
inline

Set the cache size for accessing the data.

When the give cache size exceeds the maximum cache size with more than 10%, the maximum cache size is used instead.
When forceSmaller is False, the cache is not resized when the new size is smaller.

Definition at line 232 of file TiledFileAccess.h.

References itsCube, casacore::TSMCube::setCacheSize(), and casacore::True.

◆ setMaximumCacheSize()

void casacore::TiledFileAccess::setMaximumCacheSize ( uInt64  nbytes)

Set the maximum cache size (in bytes).

0 means no maximum.

◆ shape()

const IPosition& casacore::TiledFileAccess::shape ( ) const
inline

Get the shape of the array.

Definition at line 193 of file TiledFileAccess.h.

References casacore::TSMCube::cubeShape(), and itsCube.

◆ showCacheStatistics()

void casacore::TiledFileAccess::showCacheStatistics ( ostream &  os) const
inline

Show the cache statistics.

Definition at line 189 of file TiledFileAccess.h.

References itsCube, and casacore::TSMCube::showCacheStatistics().

◆ tileShape()

const IPosition& casacore::TiledFileAccess::tileShape ( ) const
inline

Get the shape of the tiles.

Definition at line 197 of file TiledFileAccess.h.

References itsCube, and casacore::TSMCube::tileShape().

Member Data Documentation

◆ itsCube

TSMCube* casacore::TiledFileAccess::itsCube
private

◆ itsDataType

DataType casacore::TiledFileAccess::itsDataType
private

Definition at line 253 of file TiledFileAccess.h.

Referenced by dataType().

◆ itsLocalPixelSize

uInt casacore::TiledFileAccess::itsLocalPixelSize
private

Definition at line 251 of file TiledFileAccess.h.

◆ itsTSM

TiledFileHelper* casacore::TiledFileAccess::itsTSM
private

Definition at line 250 of file TiledFileAccess.h.

◆ itsWritable

Bool casacore::TiledFileAccess::itsWritable
private

Definition at line 252 of file TiledFileAccess.h.

Referenced by isWritable().


The documentation for this class was generated from the following file: