casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::TempLatticeImpl< T > Class Template Reference

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...
 
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 &section)
 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

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

Detailed Description

template<class T>
class casacore::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 69 of file TempLatticeImpl.h.

Constructor & Destructor Documentation

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

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

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

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

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

template<class T>
casacore::TempLatticeImpl< T >::TempLatticeImpl ( const TempLatticeImpl< T > &  other)
private

The copy constructor cannot be used.

Member Function Documentation

template<class T>
uInt casacore::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 145 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.

template<class T>
void casacore::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 135 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.

template<class T>
void casacore::TempLatticeImpl< T >::apply ( T(*)(const T &)  function)
inline
template<class T>
void casacore::TempLatticeImpl< T >::apply ( const Functional< T, T > &  function)
inline
template<class T>
Bool casacore::TempLatticeImpl< T >::canReferenceArray ( ) const
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.

template<class T>
void casacore::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 178 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::itsLatticePtr.

template<class T>
void casacore::TempLatticeImpl< T >::deleteTable ( )
private

Make sure that the temporary table gets deleted.

template<class T>
Bool casacore::TempLatticeImpl< T >::doGetSlice ( Array< T > &  buffer,
const Slicer section 
)
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.

template<class T>
IPosition casacore::TempLatticeImpl< T >::doNiceCursorShape ( uInt  maxPixels)
inline

Get the best cursor shape.

Definition at line 149 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.

template<class T>
void casacore::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 210 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.

template<class T>
void casacore::TempLatticeImpl< T >::doReopen ( ) const
inline
template<class T>
void casacore::TempLatticeImpl< T >::flush ( )
inline

Flush the data.

Definition at line 103 of file TempLatticeImpl.h.

References casacore::Table::flush(), and casacore::TempLatticeImpl< T >::itsTablePtr.

template<class T>
T casacore::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 188 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.

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

Initialize the object.

template<class T>
Bool casacore::TempLatticeImpl< T >::isPaged ( ) const
inline

Is the TempLattice paged to disk?

Definition at line 91 of file TempLatticeImpl.h.

References casacore::String::empty(), and casacore::TempLatticeImpl< T >::itsTableName.

template<class T>
Bool casacore::TempLatticeImpl< T >::isWritable ( ) const
inline

Is the TempLattice writable? It should be.

Definition at line 99 of file TempLatticeImpl.h.

References casacore::True.

template<class T>
LatticeIterInterface<T>* casacore::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 201 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.

template<class T>
uInt casacore::TempLatticeImpl< T >::maximumCacheSize ( ) const
inline

Maximum size - not necessarily all used.

In pixels.

Definition at line 153 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::itsLatticePtr.

template<class T>
Bool casacore::TempLatticeImpl< T >::ok ( ) const
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.

template<class T>
TempLatticeImpl<T>& casacore::TempLatticeImpl< T >::operator= ( const TempLatticeImpl< T > &  other)
private

The assignment operator cannot be used.

template<class T>
void casacore::TempLatticeImpl< T >::putAt ( const T &  value,
const IPosition where 
)
inline
template<class T>
void casacore::TempLatticeImpl< T >::reopen ( )

If needed, reopen a temporarily closed TempLatticeImpl.

template<class T>
void casacore::TempLatticeImpl< T >::set ( const T &  value)
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.

template<class T>
void casacore::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 161 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::itsLatticePtr.

template<class T>
void casacore::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 173 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::itsLatticePtr.

template<class T>
void casacore::TempLatticeImpl< T >::setMaximumCacheSize ( uInt  howManyPixels)
inline

Set the maximum (allowed) cache size as indicated.

Definition at line 157 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::itsLatticePtr.

template<class T>
IPosition casacore::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 116 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::doReopen(), and casacore::TempLatticeImpl< T >::itsLatticePtr.

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

Report on cache success.

Definition at line 182 of file TempLatticeImpl.h.

References casacore::TempLatticeImpl< T >::itsLatticePtr.

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

template<class T>
void casacore::TempLatticeImpl< T >::tempReopen ( ) const
private

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

Referenced by casacore::TempLatticeImpl< T >::doReopen().

Member Data Documentation

template<class T>
Bool casacore::TempLatticeImpl< T >::itsIsClosed
mutableprivate

Definition at line 239 of file TempLatticeImpl.h.

Referenced by casacore::TempLatticeImpl< T >::doReopen().

template<class T>
CountedPtr<Lattice<T> > casacore::TempLatticeImpl< T >::itsLatticePtr
mutableprivate
template<class T>
String casacore::TempLatticeImpl< T >::itsTableName
private
template<class T>
Table* casacore::TempLatticeImpl< T >::itsTablePtr
mutableprivate

Definition at line 236 of file TempLatticeImpl.h.

Referenced by casacore::TempLatticeImpl< T >::flush().


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