casacore
Public Member Functions | Protected Member Functions | List of all members
casacore::LatticeBase Class Referenceabstract

More...

#include <LatticeBase.h>

Public Member Functions

virtual ~LatticeBase ()
 A virtual destructor is needed so that it will use the actual destructor in the derived class. More...
 
virtual LatticeBaseclone () const =0
 Make a copy of the derived object (reference semantics). More...
 
virtual String imageType () const
 Get the image type (returns name of derived class). More...
 
virtual DataType dataType () const =0
 Get the data type of the lattice. More...
 
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. More...
 
virtual Bool isPaged () const
 Is the lattice paged to disk?
The default implementation returns False. More...
 
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. More...
 
virtual Bool isWritable () const
 Is the lattice writable?
The default implementation returns True. More...
 
virtual void save (const String &fileName) const
 Save the image in an AipsIO file with the given name. More...
 
virtual Bool lock (FileLocker::LockType, uInt nattempts)
 It is strongly recommended to use class LatticeLocker to handle lattice locking. More...
 
virtual void unlock ()
 
virtual Bool hasLock (FileLocker::LockType) const
 
virtual void resync ()
 Resynchronize the Lattice object with the lattice file. More...
 
virtual void flush ()
 Flush the data (but do not unlock). More...
 
virtual void tempClose ()
 Temporarily close the lattice. More...
 
virtual void reopen ()
 Explicitly reopen the temporarily closed lattice. More...
 
virtual String name (Bool stripPath=False) const
 Return the name of the current Lattice object. More...
 
virtual IPosition shape () const =0
 Return the shape of the Lattice including all degenerate axes (ie. More...
 
virtual uInt ndim () const
 Return the number of axes in this Lattice. More...
 
virtual size_t nelements () const
 Return the total number of elements in this Lattice. More...
 
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". More...
 
virtual LELCoordinates lelCoordinates () const
 Return the coordinates of the lattice. More...
 
virtual uInt advisedMaxPixels () const =0
 This function returns the recommended maximum number of pixels to include in the cursor of an iterator. More...
 
IPosition niceCursorShape (uInt maxPixels) const
 Returns a recommended cursor shape for iterating through all the pixels in the Lattice. More...
 
IPosition niceCursorShape () const
 
virtual Bool ok () const
 Check class internals - used for debugging. More...
 
virtual IPosition doNiceCursorShape (uInt maxPixels) const
 The function (in the derived classes) doing the actual work. More...
 
virtual uInt maximumCacheSize () const
 Maximum cache size - not necessarily all used. More...
 
virtual void setMaximumCacheSize (uInt howManyPixels)
 Set the maximum (allowed) cache size as indicated. More...
 
virtual void setCacheSizeInTiles (uInt howManyTiles)
 Set the actual cache size for this Array to be big enough for the indicated number of tiles. More...
 
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. More...
 
virtual void clearCache ()
 Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSize was called. More...
 
virtual void showCacheStatistics (ostream &os) const
 Report on cache success. More...
 

Protected Member Functions

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

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

Constructor & Destructor Documentation

◆ ~LatticeBase()

virtual casacore::LatticeBase::~LatticeBase ( )
virtual

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

◆ LatticeBase() [1/2]

casacore::LatticeBase::LatticeBase ( )
inlineprotected

Define default constructor to be used by derived classes.

Definition at line 259 of file LatticeBase.h.

◆ LatticeBase() [2/2]

casacore::LatticeBase::LatticeBase ( const LatticeBase )
inlineprotected

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

Definition at line 263 of file LatticeBase.h.

Member Function Documentation

◆ advisedMaxPixels()

virtual uInt casacore::LatticeBase::advisedMaxPixels ( ) const
pure virtual

◆ canReferenceArray()

virtual Bool casacore::LatticeBase::canReferenceArray ( ) const
virtual

◆ clearCache()

virtual void casacore::LatticeBase::clearCache ( )
virtual

◆ clone()

virtual LatticeBase* casacore::LatticeBase::clone ( ) const
pure virtual

◆ conform()

Bool casacore::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 183 of file LatticeBase.h.

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

◆ dataType()

virtual DataType casacore::LatticeBase::dataType ( ) const
pure virtual

◆ doNiceCursorShape()

virtual IPosition casacore::LatticeBase::doNiceCursorShape ( uInt  maxPixels) const
virtual

◆ flush()

virtual void casacore::LatticeBase::flush ( )
virtual

◆ hasLock()

virtual Bool casacore::LatticeBase::hasLock ( FileLocker::LockType  ) const
virtual

◆ imageType()

virtual String casacore::LatticeBase::imageType ( ) const
virtual

◆ isPaged()

virtual Bool casacore::LatticeBase::isPaged ( ) const
virtual

◆ isPersistent()

virtual Bool casacore::LatticeBase::isPersistent ( ) const
virtual

◆ isWritable()

virtual Bool casacore::LatticeBase::isWritable ( ) const
virtual

◆ lelCoordinates()

virtual LELCoordinates casacore::LatticeBase::lelCoordinates ( ) const
virtual

◆ lock()

virtual Bool casacore::LatticeBase::lock ( FileLocker::LockType  ,
uInt  nattempts 
)
virtual

◆ maximumCacheSize()

virtual uInt casacore::LatticeBase::maximumCacheSize ( ) const
virtual

◆ name()

virtual String casacore::LatticeBase::name ( Bool  stripPath = False) const
virtual

◆ ndim()

virtual uInt casacore::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 casacore::LCRegion, casacore::LatticeRegion, and casacore::SubImage< T >.

◆ nelements()

virtual size_t casacore::LatticeBase::nelements ( ) const
virtual

Return the total number of elements in this Lattice.


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

Reimplemented in casacore::LatticeRegion, and casacore::SubImage< T >.

Referenced by size().

◆ niceCursorShape() [1/2]

IPosition casacore::LatticeBase::niceCursorShape ( ) const
inline

Definition at line 210 of file LatticeBase.h.

References advisedMaxPixels(), and doNiceCursorShape().

◆ niceCursorShape() [2/2]

IPosition casacore::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]
IPosition niceCursorShape() const
Definition: LatticeBase.h:210

The default argument is the result of advisedMaxPixels().

Definition at line 208 of file LatticeBase.h.

References doNiceCursorShape().

◆ ok()

virtual Bool casacore::LatticeBase::ok ( ) const
virtual

◆ operator=()

LatticeBase& casacore::LatticeBase::operator= ( const LatticeBase )
inlineprotected

Definition at line 264 of file LatticeBase.h.

◆ reopen()

virtual void casacore::LatticeBase::reopen ( )
virtual

◆ resync()

virtual void casacore::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.

Reimplemented in casacore::LCPagedMask, casacore::LCMask, casacore::LCLELMask, casacore::LatticeRegion, casacore::LatticeExpr< T >, casacore::LatticeExpr< Bool >, casacore::SubLattice< T >, casacore::RebinLattice< T >, casacore::PagedArray< T >, casacore::PagedArray< Bool >, casacore::LatticeConcat< T >, casacore::ExtendLattice< T >, casacore::CurvedLattice2D< T >, casacore::SubImage< T >, casacore::RebinImage< T >, casacore::PagedImage< T >, casacore::ImageExpr< T >, casacore::ImageExpr< Bool >, casacore::ImageConcat< T >, casacore::ExtendImage< T >, and casacore::CurvedImage2D< T >.

◆ save()

virtual void casacore::LatticeBase::save ( const String fileName) const
virtual

Save the image in an AipsIO file with the given name.

Its purpose is to make ImageConcat and ImageExpr objects persistent.
The default implementation throws an exception.

Reimplemented in casacore::ImageExpr< T >, casacore::ImageExpr< Bool >, and casacore::ImageConcat< T >.

◆ setCacheSizeFromPath()

virtual void casacore::LatticeBase::setCacheSizeFromPath ( const IPosition sliceShape,
const IPosition windowStart,
const IPosition windowLength,
const IPosition axisPath 
)
virtual

◆ setCacheSizeInTiles()

virtual void casacore::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.

Reimplemented in casacore::LCPagedMask, casacore::LCMask, casacore::LatticeRegion, casacore::TempLattice< T >, casacore::TempLattice< Float >, casacore::TempLattice< typename casacore::NumericTraits< T >::ConjugateType >, casacore::TempLattice< Complex >, casacore::PagedArray< T >, casacore::PagedArray< Bool >, casacore::HDF5Lattice< T >, casacore::HDF5Lattice< Bool >, casacore::TempImage< T >, casacore::PagedImage< T >, casacore::MIRIADImage, casacore::FITSQualityImage, and casacore::FITSImage.

◆ setMaximumCacheSize()

virtual void casacore::LatticeBase::setMaximumCacheSize ( uInt  howManyPixels)
virtual

◆ shape()

virtual IPosition casacore::LatticeBase::shape ( ) const
pure virtual

◆ showCacheStatistics()

virtual void casacore::LatticeBase::showCacheStatistics ( ostream &  os) const
virtual

◆ size()

size_t casacore::LatticeBase::size ( ) const
inline

Definition at line 177 of file LatticeBase.h.

References nelements().

◆ tempClose()

virtual void casacore::LatticeBase::tempClose ( )
virtual

◆ throwBoolMath()

void casacore::LatticeBase::throwBoolMath ( ) const
protected

Throw an exception for arithmetic on a Bool Lattice.

◆ unlock()

virtual void casacore::LatticeBase::unlock ( )
virtual

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