casa
5.7.0-16
|
The class implementing TempLattice. More...
#include <TempLatticeImpl.h>
Public Member Functions | |
TempLatticeImpl () | |
The default constructor creates a TempLatticeImpl containing a default ArrayLattice object. More... | |
TempLatticeImpl (const TiledShape &shape, Int maxMemoryInMB) | |
Create a TempLatticeImpl of the specified shape. More... | |
TempLatticeImpl (const TiledShape &shape, Double maxMemoryInMB) | |
~TempLatticeImpl () | |
The destructor removes the Lattice from memory and if necessary disk. More... | |
Bool | isPaged () const |
Is the TempLattice paged to disk? More... | |
Bool | canReferenceArray () const |
Can the lattice data be referenced as an array section? More... | |
Bool | isWritable () const |
Is the TempLattice writable? It should be. More... | |
void | flush () |
Flush the data. More... | |
void | tempClose () |
Close the Lattice temporarily (if it is paged to disk). More... | |
void | reopen () |
If needed, reopen a temporarily closed TempLatticeImpl. More... | |
IPosition | shape () const |
Return the shape of the Lattice including all degenerate axes. More... | |
void | set (const T &value) |
Set all of the elements in the Lattice to the given value. More... | |
void | apply (T(*function)(T)) |
Replace every element, x, of the Lattice with the result of f(x). More... | |
void | apply (T(*function)(const T &)) |
void | apply (const Functional< T, T > &function) |
uInt | advisedMaxPixels () const |
This function returns the recommended maximum number of pixels to include in the cursor of an iterator. More... | |
IPosition | doNiceCursorShape (uInt maxPixels) |
Get the best cursor shape. More... | |
uInt | maximumCacheSize () const |
Maximum size - not necessarily all used. More... | |
void | setMaximumCacheSize (uInt howManyPixels) |
Set the maximum (allowed) cache size as indicated. More... | |
void | setCacheSizeFromPath (const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath) |
Set the cache size as to "fit" the indicated path. More... | |
void | setCacheSizeInTiles (uInt howManyTiles) |
Set the actual cache size for this Array to be be big enough for the indicated number of tiles. More... | |
void | clearCache () |
Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSize was called. More... | |
void | showCacheStatistics (ostream &os) const |
Report on cache success. More... | |
T | getAt (const IPosition &where) const |
Get or put a single element in the lattice. More... | |
void | putAt (const T &value, const IPosition &where) |
Bool | ok () const |
Check class internals - used for debugging. More... | |
LatticeIterInterface< T > * | makeIter (const LatticeNavigator &navigator, Bool useRef) const |
This function is used by the LatticeIterator class to generate an iterator of the correct type for this Lattice. More... | |
Bool | doGetSlice (Array< T > &buffer, const Slicer §ion) |
Do the actual getting of an array of values. More... | |
void | doPutSlice (const Array< T > &sourceBuffer, const IPosition &where, const IPosition &stride) |
Do the actual getting of an array of values. More... | |
void | doReopen () const |
Do the reopen of the table (if not open already). More... | |
Private Member Functions | |
TempLatticeImpl (const TempLatticeImpl< T > &other) | |
The copy constructor cannot be used. More... | |
TempLatticeImpl< T > & | operator= (const TempLatticeImpl< T > &other) |
The assignment operator cannot be used. More... | |
void | init (const TiledShape &shape, Double maxMemoryInMB=-1) |
Initialize the object. More... | |
void | tempReopen () const |
Do the actual reopen of the temporarily closed table (if not open already). More... | |
void | deleteTable () |
Make sure that the temporary table gets deleted. More... | |
Private Attributes | |
Table * | itsTablePtr |
CountedPtr< Lattice< T > > | itsLatticePtr |
String | itsTableName |
Bool | itsIsClosed |
The class implementing TempLattice.
Internal
The class is used as CountedPtr<TempLatticeImpl>
in class TempLattice. In that way the making a copy of a TempLattice uses the same object underneath. This was needed to have a correct implementation of tempClose. Otherwise when deleting a copy of a TempLattice, that destructor would delete the underlying table and the original TempLattice could not reopen it.
Definition at line 69 of file TempLatticeImpl.h.
casacore::TempLatticeImpl< T >::TempLatticeImpl | ( | ) |
The default constructor creates a TempLatticeImpl containing a default ArrayLattice object.
casacore::TempLatticeImpl< T >::TempLatticeImpl | ( | const TiledShape & | shape, |
Int | maxMemoryInMB | ||
) |
Create a TempLatticeImpl of the specified shape.
You can specify how much memory the Lattice can consume before it becomes disk based by giving a non-negative value to the maxMemoryInMB argument. Otherwise it will assume it can use up to 25% of the memory on your machine as defined in aipsrc (this algorithm may change). Setting maxMemoryInMB to zero will force the lattice to disk.
casacore::TempLatticeImpl< T >::TempLatticeImpl | ( | const TiledShape & | shape, |
Double | maxMemoryInMB | ||
) |
casacore::TempLatticeImpl< T >::~TempLatticeImpl | ( | ) |
The destructor removes the Lattice from memory and if necessary disk.
|
private |
The copy constructor cannot be used.
|
inline |
This function returns the recommended maximum number of pixels to include in the cursor of an iterator.
Definition at line 145 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Replace every element, x, of the Lattice with the result of f(x).
You must pass in the address of the function – so the function must be declared and defined in the scope of your program. All versions of apply require a function that accepts a single argument of type T (the Lattice template type) and return a result of the same type. The first apply expects a function with an argument passed by value; the second expects the argument to be passed by const reference; the third requires an instance of the class Functional<T,T>
. The first form ought to run faster for the built-in types, which may be an issue for large Lattices stored in memory, where disk access is not an issue.
Definition at line 135 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Definition at line 137 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Definition at line 139 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Can the lattice data be referenced as an array section?
Definition at line 95 of file TempLatticeImpl.h.
References casacore::String::empty(), and casacore::TempLatticeImpl< T >::itsTableName.
|
inline |
Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSize was called.
Definition at line 178 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::itsLatticePtr.
|
private |
Make sure that the temporary table gets deleted.
|
inline |
Do the actual getting of an array of values.
Definition at line 206 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Get the best cursor shape.
Definition at line 149 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Do the actual getting of an array of values.
Definition at line 210 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Do the reopen of the table (if not open already).
Definition at line 216 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::itsIsClosed, and casacore::TempLatticeImpl< T >::tempReopen().
Referenced by casacore::TempLatticeImpl< T >::advisedMaxPixels(), casacore::TempLatticeImpl< T >::apply(), casacore::TempLatticeImpl< T >::doGetSlice(), casacore::TempLatticeImpl< T >::doNiceCursorShape(), casacore::TempLatticeImpl< T >::doPutSlice(), casacore::TempLatticeImpl< T >::getAt(), casacore::TempLatticeImpl< T >::makeIter(), casacore::TempLatticeImpl< T >::ok(), casacore::TempLatticeImpl< T >::putAt(), casacore::TempLatticeImpl< T >::set(), and casacore::TempLatticeImpl< T >::shape().
|
inline |
Flush the data.
Definition at line 103 of file TempLatticeImpl.h.
References casacore::Table::flush(), and casacore::TempLatticeImpl< T >::itsTablePtr.
|
inline |
Get or put a single element in the lattice.
Note that Lattice::operator() can also be used to get a single element.
Definition at line 188 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
|
private |
Initialize the object.
|
inline |
Is the TempLattice paged to disk?
Definition at line 91 of file TempLatticeImpl.h.
References casacore::String::empty(), and casacore::TempLatticeImpl< T >::itsTableName.
|
inline |
Is the TempLattice writable? It should be.
Definition at line 99 of file TempLatticeImpl.h.
References casacore::True.
|
inline |
This function is used by the LatticeIterator class to generate an iterator of the correct type for this Lattice.
Not recommended for general use.
Definition at line 201 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Maximum size - not necessarily all used.
In pixels.
Definition at line 153 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Check class internals - used for debugging.
Should always return True
Definition at line 195 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
|
private |
The assignment operator cannot be used.
|
inline |
Definition at line 190 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
void casacore::TempLatticeImpl< T >::reopen | ( | ) |
If needed, reopen a temporarily closed TempLatticeImpl.
|
inline |
Set all of the elements in the Lattice to the given value.
Definition at line 120 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Set the cache size as to "fit" the indicated path.
Definition at line 161 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Set the actual cache size for this Array to be be big enough for the indicated number of tiles.
This cache is not shared with PagedArrays in other rows and is always clipped to be less than the maximum value set using the setMaximumCacheSize member function. tiles. Tiles are cached using a first in first out algorithm.
Definition at line 173 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Set the maximum (allowed) cache size as indicated.
Definition at line 157 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Return the shape of the Lattice including all degenerate axes.
(ie. axes with a length of one)
Definition at line 116 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.
|
inline |
Report on cache success.
Definition at line 182 of file TempLatticeImpl.h.
References casacore::TempLatticeImpl< T >::itsLatticePtr.
void casacore::TempLatticeImpl< T >::tempClose | ( | ) |
Close the Lattice temporarily (if it is paged to disk).
It'll be reopened automatically when needed or when reopen
is called explicitly.
|
private |
Do the actual reopen of the temporarily closed table (if not open already).
Referenced by casacore::TempLatticeImpl< T >::doReopen().
|
mutableprivate |
Definition at line 239 of file TempLatticeImpl.h.
Referenced by casacore::TempLatticeImpl< T >::doReopen().
|
mutableprivate |
Definition at line 237 of file TempLatticeImpl.h.
Referenced by casacore::TempLatticeImpl< T >::advisedMaxPixels(), casacore::TempLatticeImpl< T >::apply(), casacore::TempLatticeImpl< T >::clearCache(), casacore::TempLatticeImpl< T >::doGetSlice(), casacore::TempLatticeImpl< T >::doNiceCursorShape(), casacore::TempLatticeImpl< T >::doPutSlice(), casacore::TempLatticeImpl< T >::getAt(), casacore::TempLatticeImpl< T >::makeIter(), casacore::TempLatticeImpl< T >::maximumCacheSize(), casacore::TempLatticeImpl< T >::ok(), casacore::TempLatticeImpl< T >::putAt(), casacore::TempLatticeImpl< T >::set(), casacore::TempLatticeImpl< T >::setCacheSizeFromPath(), casacore::TempLatticeImpl< T >::setCacheSizeInTiles(), casacore::TempLatticeImpl< T >::setMaximumCacheSize(), casacore::TempLatticeImpl< T >::shape(), and casacore::TempLatticeImpl< T >::showCacheStatistics().
|
private |
Definition at line 238 of file TempLatticeImpl.h.
Referenced by casacore::TempLatticeImpl< T >::canReferenceArray(), and casacore::TempLatticeImpl< T >::isPaged().
|
mutableprivate |
Definition at line 236 of file TempLatticeImpl.h.
Referenced by casacore::TempLatticeImpl< T >::flush().