casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Member Functions | Private Attributes
casa::TempLatticeImpl< T > Class Template Reference

The class implementing TempLattice. More...

#include <TempLatticeImpl.h>

List of all members.

Public Member Functions

 TempLatticeImpl ()
 The default constructor creates a TempLatticeImpl containing a default ArrayLattice object.
 TempLatticeImpl (const TiledShape &shape, Int maxMemoryInMB)
 Create a TempLatticeImpl of the specified shape.
 TempLatticeImpl (const TiledShape &shape, Double maxMemoryInMB)
 ~TempLatticeImpl ()
 The destructor removes the Lattice from memory and if necessary disk.
Bool isPaged () const
 Is the TempLattice paged to disk?
Bool canReferenceArray () const
 Can the lattice data be referenced as an array section?
Bool isWritable () const
 Is the TempLattice writable? It should be.
void flush ()
 Flush the data.
void tempClose ()
 Close the Lattice temporarily (if it is paged to disk).
void reopen ()
 If needed, reopen a temporarily closed TempLatticeImpl.
IPosition shape () const
 Return the shape of the Lattice including all degenerate axes.
void set (const T &value)
 Set all of the elements in the Lattice to the given value.
void apply (T(*function)(T))
 Replace every element, x, of the Lattice with the result of f(x).
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.
IPosition doNiceCursorShape (uInt maxPixels)
 Get the best cursor shape.
uInt maximumCacheSize () const
 Maximum size - not necessarily all used.
void setMaximumCacheSize (uInt howManyPixels)
 Set the maximum (allowed) cache size as indicated.
void setCacheSizeFromPath (const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath)
 Set the cache size as to "fit" the indicated path.
void setCacheSizeInTiles (uInt howManyTiles)
 Set the actual cache size for this Array to be be big enough for the indicated number of tiles.
void clearCache ()
 Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSize was called.
void showCacheStatistics (ostream &os) const
 Report on cache success.
getAt (const IPosition &where) const
 Get or put a single element in the lattice.
void putAt (const T &value, const IPosition &where)
Bool ok () const
 Check class internals - used for debugging.
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.
Bool doGetSlice (Array< T > &buffer, const Slicer &section)
 Do the actual getting of an array of values.
void doPutSlice (const Array< T > &sourceBuffer, const IPosition &where, const IPosition &stride)
 Do the actual getting of an array of values.
void doReopen () const
 Do the reopen of the table (if not open already).

Private Member Functions

 TempLatticeImpl (const TempLatticeImpl< T > &other)
 The copy constructor cannot be used.
TempLatticeImpl< T > & operator= (const TempLatticeImpl< T > &other)
 The assignment operator cannot be used.
void init (const TiledShape &shape, Double maxMemoryInMB=-1)
 Initialize the object.
void tempReopen () const
 Do the actual reopen of the temporarily closed table (if not open already).
void deleteTable ()
 Make sure that the temporary table gets deleted.

Private Attributes

TableitsTablePtr
CountedPtr< Lattice< T > > itsLatticePtr
String itsTableName
Bool itsIsClosed

Detailed Description

template<class T>
class casa::TempLatticeImpl< T >

The class implementing TempLattice.

Intended use:

Internal

Review Status

Reviewed By:
Peter Barnes
Date Reviewed:
1999/10/30
Test programs:
tTempLattice

Prerequisite

Synopsis

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 68 of file TempLatticeImpl.h.


Constructor & Destructor Documentation

template<class T>
casa::TempLatticeImpl< T >::TempLatticeImpl ( )

The default constructor creates a TempLatticeImpl containing a default ArrayLattice object.

template<class T>
casa::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.

template<class T>
casa::TempLatticeImpl< T >::TempLatticeImpl ( const TiledShape shape,
Double  maxMemoryInMB 
)
template<class T>
casa::TempLatticeImpl< T >::~TempLatticeImpl ( )

The destructor removes the Lattice from memory and if necessary disk.

template<class T>
casa::TempLatticeImpl< T >::TempLatticeImpl ( const TempLatticeImpl< T > &  other) [private]

The copy constructor cannot be used.


Member Function Documentation

template<class T>
uInt casa::TempLatticeImpl< T >::advisedMaxPixels ( ) const [inline]

This function returns the recommended maximum number of pixels to include in the cursor of an iterator.

Definition at line 144 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::apply ( T(*)(T)  function) [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 134 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::apply ( T(*)(const T &)  function) [inline]

Definition at line 136 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::apply ( const Functional< T, T > &  function) [inline]

Definition at line 138 of file TempLatticeImpl.h.

template<class T>
Bool casa::TempLatticeImpl< T >::canReferenceArray ( ) const [inline]

Can the lattice data be referenced as an array section?

Definition at line 94 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::clearCache ( ) [inline]

Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSize was called.

Definition at line 177 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::deleteTable ( ) [private]

Make sure that the temporary table gets deleted.

template<class T>
Bool casa::TempLatticeImpl< T >::doGetSlice ( Array< T > &  buffer,
const Slicer section 
) [inline]

Do the actual getting of an array of values.

Definition at line 205 of file TempLatticeImpl.h.

template<class T>
IPosition casa::TempLatticeImpl< T >::doNiceCursorShape ( uInt  maxPixels) [inline]

Get the best cursor shape.

Definition at line 148 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::doPutSlice ( const Array< T > &  sourceBuffer,
const IPosition where,
const IPosition stride 
) [inline]

Do the actual getting of an array of values.

Definition at line 209 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::doReopen ( ) const [inline]
template<class T>
void casa::TempLatticeImpl< T >::flush ( ) [inline]

Flush the data.

Definition at line 102 of file TempLatticeImpl.h.

template<class T>
T casa::TempLatticeImpl< T >::getAt ( const IPosition where) const [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 187 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::init ( const TiledShape shape,
Double  maxMemoryInMB = -1 
) [private]

Initialize the object.

template<class T>
Bool casa::TempLatticeImpl< T >::isPaged ( ) const [inline]

Is the TempLattice paged to disk?

Definition at line 90 of file TempLatticeImpl.h.

template<class T>
Bool casa::TempLatticeImpl< T >::isWritable ( ) const [inline]

Is the TempLattice writable? It should be.

Definition at line 98 of file TempLatticeImpl.h.

template<class T>
LatticeIterInterface<T>* casa::TempLatticeImpl< T >::makeIter ( const LatticeNavigator navigator,
Bool  useRef 
) const [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 200 of file TempLatticeImpl.h.

template<class T>
uInt casa::TempLatticeImpl< T >::maximumCacheSize ( ) const [inline]

Maximum size - not necessarily all used.

In pixels.

Definition at line 152 of file TempLatticeImpl.h.

template<class T>
Bool casa::TempLatticeImpl< T >::ok ( ) const [inline]

Check class internals - used for debugging.

Should always return True

Definition at line 194 of file TempLatticeImpl.h.

template<class T>
TempLatticeImpl<T>& casa::TempLatticeImpl< T >::operator= ( const TempLatticeImpl< T > &  other) [private]

The assignment operator cannot be used.

template<class T>
void casa::TempLatticeImpl< T >::putAt ( const T &  value,
const IPosition where 
) [inline]

Definition at line 189 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::reopen ( )

If needed, reopen a temporarily closed TempLatticeImpl.

template<class T>
void casa::TempLatticeImpl< T >::set ( const T &  value) [inline]

Set all of the elements in the Lattice to the given value.

Definition at line 119 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::setCacheSizeFromPath ( const IPosition sliceShape,
const IPosition windowStart,
const IPosition windowLength,
const IPosition axisPath 
) [inline]

Set the cache size as to "fit" the indicated path.

Definition at line 160 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::setCacheSizeInTiles ( uInt  howManyTiles) [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 172 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::setMaximumCacheSize ( uInt  howManyPixels) [inline]

Set the maximum (allowed) cache size as indicated.

Definition at line 156 of file TempLatticeImpl.h.

template<class T>
IPosition casa::TempLatticeImpl< T >::shape ( ) const [inline]

Return the shape of the Lattice including all degenerate axes.

(ie. axes with a length of one)

Definition at line 115 of file TempLatticeImpl.h.

template<class T>
void casa::TempLatticeImpl< T >::showCacheStatistics ( ostream &  os) const [inline]

Report on cache success.

Definition at line 181 of file TempLatticeImpl.h.

template<class T>
void casa::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.

template<class T>
void casa::TempLatticeImpl< T >::tempReopen ( ) const [private]

Do the actual reopen of the temporarily closed table (if not open already).

Referenced by casa::TempLatticeImpl< typename NumericTraits< T >::ConjugateType >::doReopen().


Member Data Documentation

template<class T>
Bool casa::TempLatticeImpl< T >::itsIsClosed [mutable, private]
template<class T>
CountedPtr<Lattice<T> > casa::TempLatticeImpl< T >::itsLatticePtr [mutable, private]
template<class T>
String casa::TempLatticeImpl< T >::itsTableName [private]
template<class T>
Table* casa::TempLatticeImpl< T >::itsTablePtr [mutable, private]

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