casa::LatticeBase Class Reference
[Lattices]

#include <LatticeBase.h>

Inheritance diagram for casa::LatticeBase:

Inheritance graph
[legend]
List of all members.

Detailed Description

A non-templated, abstract base class for array-like objects.

Intended use:

Part of API

Review Status

Reviewed By:
Bob Garwood
Date Reviewed:
2000/01/18
Test programs:
tArrayLattice
Demo programs:
dLattice

Synopsis

This pure abstract base class defines the operations which may be performed on a lattice of any type.
See class Lattice for a detailed description of a lattice.

Motivation

It is very useful to be able to keep a pointer to a non-templated base class. Furthermore it gives the opportunity to factor out some non-templated code.

Note: The cache functions (maximumCacheSize, setMaximumCacheSize, setCacheSizeInTiles, setCacheSizeFromPath, clearCache, and showCacheStatistics) should all be over-ridden together as in PagedArray.

Definition at line 78 of file LatticeBase.h.
 LatticeBase (const LatticeBase &)
 Copy constructor and assignment can only be used by derived classes.
LatticeBaseoperator= (const LatticeBase &)

Public Member Functions

virtual ~LatticeBase ()
 A virtual destructor is needed so that it will use the actual destructor in the derived class.
virtual LatticeBaseclone () const=0
 Make a copy of the derived object (reference semantics).
virtual Bool isPersistent () const
 Is the lattice persistent and can it be loaded by other processes as well? That is the case for a PagedArray or PagedImage and for an ImageExpr which does not use transient lattices or regions.
virtual Bool isPaged () const
 Is the lattice paged to disk?
The default implementation returns False.
virtual Bool canReferenceArray () const
 Can the lattice data be referenced as an array section? That is the case for an ArrayLattice or a Temp/SubLattice using it.
virtual Bool isWritable () const
 Is the lattice writable?
The default implementation returns True.
virtual void resync ()
 Resynchronize the Lattice object with the lattice file.
virtual void flush ()
 Flush the data (but do not unlock).
virtual void tempClose ()
 Temporarily close the lattice.
virtual void reopen ()
 Explicitly reopen the temporarily closed lattice.
virtual String name (Bool stripPath=False) const
 Return the name of the current Lattice object.
virtual IPosition shape () const=0
 Return the shape of the Lattice including all degenerate axes (ie.
virtual uInt ndim () const
 Return the number of axes in this Lattice.
virtual uInt nelements () const
 Return the total number of elements in this Lattice.
Bool conform (const LatticeBase &other) const
 Return a value of "True" if this instance of Lattice and 'other' have the same shape, otherwise returns a value of "False".
virtual LELCoordinates lelCoordinates () const
 Return the coordinates of the lattice.
virtual uInt advisedMaxPixels () const=0
 This function returns the recommended maximum number of pixels to include in the cursor of an iterator.
virtual Bool ok () const
 Check class internals - used for debugging.
virtual IPosition doNiceCursorShape (uInt maxPixels) const
 The function (in the derived classes) doing the actual work.
virtual uInt maximumCacheSize () const
 Maximum cache size - not necessarily all used.
virtual void setMaximumCacheSize (uInt howManyPixels)
 Set the maximum (allowed) cache size as indicated.
virtual void setCacheSizeInTiles (uInt howManyTiles)
 Set the actual cache size for this Array to be big enough for the indicated number of tiles.
virtual void setCacheSizeFromPath (const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath)
 Set the cache size as to "fit" the indicated path.
virtual void clearCache ()
 Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSize was called.
virtual void showCacheStatistics (ostream &os) const
 Report on cache success.
virtual Bool lock (FileLocker::LockType, uInt nattempts)
 It is strongly recommended to use class LatticeLocker to handle lattice locking.
virtual void unlock ()
virtual Bool hasLock (FileLocker::LockType) const
IPosition niceCursorShape (uInt maxPixels) const
 Returns a recommended cursor shape for iterating through all the pixels in the Lattice.
IPosition niceCursorShape () const

Protected Member Functions

 LatticeBase ()
 Define default constructor to be used by derived classes.
void throwBoolMath () const
 Throw an exception for arithmetic on a Bool Lattice.


Constructor & Destructor Documentation

virtual casa::LatticeBase::~LatticeBase (  )  [virtual]

A virtual destructor is needed so that it will use the actual destructor in the derived class.

casa::LatticeBase::LatticeBase (  )  [inline, protected]

Define default constructor to be used by derived classes.

Definition at line 239 of file LatticeBase.h.

casa::LatticeBase::LatticeBase ( const LatticeBase  )  [inline, protected]

Copy constructor and assignment can only be used by derived classes.

Definition at line 243 of file LatticeBase.h.


Member Function Documentation

virtual LatticeBase* casa::LatticeBase::clone (  )  const [pure virtual]

Make a copy of the derived object (reference semantics).

virtual Bool casa::LatticeBase::isPersistent (  )  const [virtual]

Is the lattice persistent and can it be loaded by other processes as well? That is the case for a PagedArray or PagedImage and for an ImageExpr which does not use transient lattices or regions.


The default implementation returns False.

virtual Bool casa::LatticeBase::isPaged (  )  const [virtual]

Is the lattice paged to disk?
The default implementation returns False.

virtual Bool casa::LatticeBase::canReferenceArray (  )  const [virtual]

Can the lattice data be referenced as an array section? That is the case for an ArrayLattice or a Temp/SubLattice using it.

It is used by LatticeIterInterface.
The default implementation returns False.

virtual Bool casa::LatticeBase::isWritable (  )  const [virtual]

Is the lattice writable?
The default implementation returns True.

virtual Bool casa::LatticeBase::lock ( FileLocker::LockType  ,
uInt  nattempts 
) [virtual]

It is strongly recommended to use class LatticeLocker to handle lattice locking.

It also contains a more detailed explanation of the locking process.
By default the functions do not do anything at all. lock() and hasLock return True, which is suitable for all non-paged lattices.

virtual void casa::LatticeBase::unlock (  )  [virtual]

virtual Bool casa::LatticeBase::hasLock ( FileLocker::LockType   )  const [virtual]

Referenced by casa::LatticeLocker::hasLock().

virtual void casa::LatticeBase::resync (  )  [virtual]

Resynchronize the Lattice object with the lattice file.

This function is only useful if no read-locking is used, ie. if the table lock option is UserNoReadLocking or AutoNoReadLocking. In that cases the table system does not acquire a read-lock, thus does not synchronize itself automatically.
By default the function does not do anything at all.

virtual void casa::LatticeBase::flush (  )  [virtual]

Flush the data (but do not unlock).


By default the function does not do anything at all.

virtual void casa::LatticeBase::tempClose (  )  [virtual]

Temporarily close the lattice.

It will be reopened automatically on the next access.
By default the function does not do anything at all.

virtual void casa::LatticeBase::reopen (  )  [virtual]

Explicitly reopen the temporarily closed lattice.


By default the function does not do anything at all.

virtual String casa::LatticeBase::name ( Bool  stripPath = False  )  const [virtual]

Return the name of the current Lattice object.

This will generally be a file name for lattices that have a persistent form. Any path before the actual file name can be optionally stripped off.
The default implementation returns an empty string.

virtual IPosition casa::LatticeBase::shape (  )  const [pure virtual]

Return the shape of the Lattice including all degenerate axes (ie.

axes with a length of one)

Referenced by conform().

virtual uInt casa::LatticeBase::ndim (  )  const [virtual]

Return the number of axes in this Lattice.

This includes all degenerate axes.
The default implementation returns shape().nelements().

virtual uInt casa::LatticeBase::nelements (  )  const [virtual]

Return the total number of elements in this Lattice.


The default implementation returns shape().product().

Bool casa::LatticeBase::conform ( const LatticeBase other  )  const [inline]

Return a value of "True" if this instance of Lattice and 'other' have the same shape, otherwise returns a value of "False".

Definition at line 163 of file LatticeBase.h.

References casa::IPosition::isEqual(), and shape().

virtual LELCoordinates casa::LatticeBase::lelCoordinates (  )  const [virtual]

Return the coordinates of the lattice.


The default implementation returns an 'empty' LELLattCoord object.

virtual uInt casa::LatticeBase::advisedMaxPixels (  )  const [pure virtual]

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

The Lattice class has a default implementation which returns a number that is a power of two and includes enough pixels to consume between 4 and 8 MBytes of memory.

Referenced by niceCursorShape().

IPosition casa::LatticeBase::niceCursorShape ( uInt  maxPixels  )  const [inline]

Returns a recommended cursor shape for iterating through all the pixels in the Lattice.

The default implementation sets up a shape that completely fills as many axes as possible, but always at least the first axis. For example, given a 10x20x30 Lattice

      maxPixels = 1     --> niceCursorShape = [10,1,1]
                  100   --> niceCursorShape = [10,1,1]
                  300   --> niceCursorShape = [10,20,1] 
                  10000 --> niceCursorShape = [10,20,30] 
The default argument is the result of advisedMaxPixels().

Definition at line 188 of file LatticeBase.h.

References doNiceCursorShape().

IPosition casa::LatticeBase::niceCursorShape (  )  const [inline]

Definition at line 190 of file LatticeBase.h.

References advisedMaxPixels(), and doNiceCursorShape().

virtual Bool casa::LatticeBase::ok (  )  const [virtual]

Check class internals - used for debugging.

Should always return True

virtual IPosition casa::LatticeBase::doNiceCursorShape ( uInt  maxPixels  )  const [virtual]

The function (in the derived classes) doing the actual work.

This function is public, so it can be used internally in the various Lattice classes.
The default implementation tries to fit as many axes as possible given maxPixels.

Referenced by niceCursorShape().

virtual uInt casa::LatticeBase::maximumCacheSize (  )  const [virtual]

Maximum cache size - not necessarily all used.

In pixels. Default returns 0, which means that there is no maximum.

virtual void casa::LatticeBase::setMaximumCacheSize ( uInt  howManyPixels  )  [virtual]

Set the maximum (allowed) cache size as indicated.


The default implementation does nothing.

virtual void casa::LatticeBase::setCacheSizeInTiles ( uInt  howManyTiles  )  [virtual]

Set the actual cache size for this Array to 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 are cached using a first in first out algorithm.
The default implementation does nothing.

virtual void casa::LatticeBase::setCacheSizeFromPath ( const IPosition sliceShape,
const IPosition windowStart,
const IPosition windowLength,
const IPosition axisPath 
) [virtual]

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


The default implementation does nothing.

virtual void casa::LatticeBase::clearCache (  )  [virtual]

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


The default implementation does nothing.

virtual void casa::LatticeBase::showCacheStatistics ( ostream &  os  )  const [virtual]

Report on cache success.


The default implementation does nothing.

LatticeBase& casa::LatticeBase::operator= ( const LatticeBase  )  [inline, protected]

Definition at line 244 of file LatticeBase.h.

void casa::LatticeBase::throwBoolMath (  )  const [protected]

Throw an exception for arithmetic on a Bool Lattice.

Referenced by casa::LatticeExpr< T >::handleMathTo(), and casa::Lattice< T >::handleMathTo().


The documentation for this class was generated from the following file:
Generated on Mon Sep 1 22:46:14 2008 for NRAOCASA by  doxygen 1.5.1