casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions
casa::LatticeBase Class Reference

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

#include <LatticeBase.h>

Inheritance diagram for casa::LatticeBase:
casa::Lattice< T > casa::Lattice< Bool > casa::Lattice< Float > casa::ArrayLattice< T > casa::HDF5Lattice< T > casa::MaskedLattice< T > casa::PagedArray< T > casa::TempLattice< T > casa::FITSMask casa::FITSQualityMask casa::LatticeRegion casa::LCRegion casa::MaskedLattice< Float >

List of all members.

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 DataType dataType () const =0
 Get the data type of the lattice.
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 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
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 size_t nelements () const
 Return the total number of elements in this Lattice.
size_t size () const
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.
IPosition niceCursorShape (uInt maxPixels) const
 Returns a recommended cursor shape for iterating through all the pixels in the Lattice.
IPosition niceCursorShape () const
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.

Protected Member Functions

 LatticeBase ()
 Define default constructor to be used by derived classes.
 LatticeBase (const LatticeBase &)
 Copy constructor and assignment can only be used by derived classes.
LatticeBaseoperator= (const LatticeBase &)
void throwBoolMath () const
 Throw an exception for arithmetic on a Bool Lattice.

Detailed Description

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

Intended use:

Public interface

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 79 of file LatticeBase.h.


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 247 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 251 of file LatticeBase.h.


Member Function Documentation

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.

Implemented in casa::PagedArray< T >, casa::PagedArray< Float >, casa::PagedArray< Bool >, casa::PagedArray< Complex >, casa::Lattice< T >, casa::Lattice< Float >, casa::Lattice< Double >, casa::Lattice< float >, casa::Lattice< AccumType >, casa::Lattice< Int >, casa::Lattice< DComplex >, casa::Lattice< Bool >, casa::Lattice< Complex >, casa::Lattice< typename NumericTraits< Float >::ConjugateType >, casa::Lattice< typename NumericTraits< T >::ConjugateType >, casa::PagedImage< T >, casa::PagedImage< Float >, casa::PagedImage< Complex >, casa::HDF5Image< T >, casa::TempImage< T >, casa::TempImage< Float >, casa::TempImage< Complex >, casa::SubLattice< T >, casa::SubLattice< Float >, casa::HDF5Lattice< T >, casa::HDF5Lattice< Bool >, casa::TempLattice< T >, casa::TempLattice< Float >, casa::TempLattice< AccumType >, casa::TempLattice< Complex >, casa::TempLattice< typename NumericTraits< Float >::ConjugateType >, casa::TempLattice< typename NumericTraits< T >::ConjugateType >, casa::ArrayLattice< T >, casa::ArrayLattice< Bool >, casa::MIRIADImage, casa::FITSImage, casa::SubImage< T >, casa::SubImage< Float >, casa::CurvedImage2D< T >, casa::FITSQualityImage, casa::ExtendLattice< T >, casa::CurvedLattice2D< T >, casa::LatticeRegion, casa::RebinLattice< T >, casa::RebinImage< T >, casa::ExtendImage< T >, casa::LCMask, casa::LCPagedMask, and casa::LCHDF5Mask.

Referenced by niceCursorShape().

virtual Bool casa::LatticeBase::canReferenceArray ( ) const [virtual]
virtual void casa::LatticeBase::clearCache ( ) [virtual]
virtual LatticeBase* casa::LatticeBase::clone ( ) const [pure virtual]
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 171 of file LatticeBase.h.

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

virtual DataType casa::LatticeBase::dataType ( ) const [pure virtual]
virtual IPosition casa::LatticeBase::doNiceCursorShape ( uInt  maxPixels) const [virtual]
virtual void casa::LatticeBase::flush ( ) [virtual]
virtual Bool casa::LatticeBase::hasLock ( FileLocker::LockType  ) const [virtual]
virtual Bool casa::LatticeBase::isPaged ( ) const [virtual]
virtual Bool casa::LatticeBase::isPersistent ( ) const [virtual]
virtual Bool casa::LatticeBase::isWritable ( ) const [virtual]
virtual Bool casa::LatticeBase::lock ( FileLocker::LockType  ,
uInt  nattempts 
) [virtual]
virtual uInt casa::LatticeBase::maximumCacheSize ( ) const [virtual]
virtual String casa::LatticeBase::name ( Bool  stripPath = False) const [virtual]
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().

Reimplemented in casa::SubImage< T >, casa::SubImage< Float >, casa::LCRegion, and casa::LatticeRegion.

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

Return the total number of elements in this Lattice.


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

Reimplemented in casa::SubImage< T >, casa::SubImage< Float >, and casa::LatticeRegion.

Referenced by size().

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 196 of file LatticeBase.h.

References doNiceCursorShape().

Definition at line 198 of file LatticeBase.h.

References advisedMaxPixels(), and doNiceCursorShape().

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

Definition at line 252 of file LatticeBase.h.

virtual void casa::LatticeBase::reopen ( ) [virtual]
virtual void casa::LatticeBase::resync ( ) [virtual]
virtual void casa::LatticeBase::setCacheSizeFromPath ( const IPosition sliceShape,
const IPosition windowStart,
const IPosition windowLength,
const IPosition axisPath 
) [virtual]
virtual void casa::LatticeBase::setCacheSizeInTiles ( uInt  howManyTiles) [virtual]
virtual void casa::LatticeBase::setMaximumCacheSize ( uInt  howManyPixels) [virtual]
virtual IPosition casa::LatticeBase::shape ( ) const [pure virtual]
virtual void casa::LatticeBase::showCacheStatistics ( ostream &  os) const [virtual]
size_t casa::LatticeBase::size ( ) const [inline]

Definition at line 165 of file LatticeBase.h.

References nelements().

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

Throw an exception for arithmetic on a Bool Lattice.

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

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