Loading...
Searching...
No Matches
casacore::TempLatticeImpl< T > Class Template Reference
lattices package (libcasa_lattices) » Lattices_module » Lattices_module_internal_classes

More...

`#include <TempLatticeImpl.h>`

## 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?
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.
T | 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

Table | itsTable
std::shared_ptr< 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

- Lattice

### Synopsis

The class is used as std::shared_ptr<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 66 of file TempLatticeImpl.h.

## Constructor & Destructor Documentation

## TempLatticeImpl() [1/4]

template<class T>

casacore::TempLatticeImpl< T >::TempLatticeImpl | ( |  | ) |

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

Referenced by operator=(), and TempLatticeImpl().

## TempLatticeImpl() [2/4]

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.

References shape().

## TempLatticeImpl() [3/4]

template<class T>

casacore::TempLatticeImpl< T >::TempLatticeImpl | ( | const TiledShape & | shape,
|  | Double | maxMemoryInMB )

References shape().

## ~TempLatticeImpl()

template<class T>

casacore::TempLatticeImpl< T >::~TempLatticeImpl | ( |  | ) |

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

## TempLatticeImpl() [4/4]

template<class T>

casacore::TempLatticeImpl< T >::TempLatticeImpl | ( | const TempLatticeImpl< T > & | other | ) |

private

The copy constructor cannot be used.

References TempLatticeImpl().

## Member Function Documentation

## advisedMaxPixels()

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

References doReopen(), and itsLatticePtr.

## apply() [1/3]

template<class T>

void casacore::TempLatticeImpl< T >::apply | ( | const Functional< T, T > & | function | ) |

inline

Definition at line 136 of file TempLatticeImpl.h.

References doReopen(), and itsLatticePtr.

## apply() [2/3]

template<class T>

void casacore::TempLatticeImpl< T >::apply | ( | T(* | function )(const T &) | ) |

inline

Definition at line 134 of file TempLatticeImpl.h.

References doReopen(), and itsLatticePtr.

## apply() [3/3]

template<class T>

void casacore::TempLatticeImpl< T >::apply | ( | T(* | function )(T) | ) |

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

References doReopen(), and itsLatticePtr.

## canReferenceArray()

template<class T>

Bool casacore::TempLatticeImpl< T >::canReferenceArray | ( |  | ) | const

inline

Can the lattice data be referenced as an array section?

Definition at line 92 of file TempLatticeImpl.h.

References itsTableName.

## clearCache()

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

References itsLatticePtr.

## deleteTable()

template<class T>

void casacore::TempLatticeImpl< T >::deleteTable | ( |  | ) |

private

Make sure that the temporary table gets deleted.

## doGetSlice()

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

References doReopen(), and itsLatticePtr.

## doNiceCursorShape()

template<class T>

IPosition casacore::TempLatticeImpl< T >::doNiceCursorShape | ( | uInt | maxPixels | ) |

inline

Get the best cursor shape.

Definition at line 146 of file TempLatticeImpl.h.

References doReopen(), and itsLatticePtr.

## doPutSlice()

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

References doReopen(), and itsLatticePtr.

## doReopen()

template<class T>

void casacore::TempLatticeImpl< T >::doReopen | ( |  | ) | const

inline

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

Definition at line 213 of file TempLatticeImpl.h.

References itsIsClosed, and tempReopen().

Referenced by advisedMaxPixels(), apply(), apply(), apply(), doGetSlice(), doNiceCursorShape(), doPutSlice(), getAt(), makeIter(), ok(), putAt(), set(), and shape().

## flush()

template<class T>

void casacore::TempLatticeImpl< T >::flush | ( |  | ) |

inline

Flush the data.

Definition at line 100 of file TempLatticeImpl.h.

References itsTable.

## getAt()

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

References doReopen(), and itsLatticePtr.

## init()

template<class T>

void casacore::TempLatticeImpl< T >::init | ( | const TiledShape & | shape,
|  | Double | maxMemoryInMB = -1 )

private

Initialize the object.

References shape().

## isPaged()

template<class T>

Bool casacore::TempLatticeImpl< T >::isPaged | ( |  | ) | const

inline

Is the TempLattice paged to disk?

Definition at line 88 of file TempLatticeImpl.h.

References itsTableName.

## isWritable()

template<class T>

Bool casacore::TempLatticeImpl< T >::isWritable | ( |  | ) | const

inline

Is the TempLattice writable?

It should be.

Definition at line 96 of file TempLatticeImpl.h.

References casacore::True.

## makeIter()

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

References doReopen(), and itsLatticePtr.

## maximumCacheSize()

template<class T>

uInt casacore::TempLatticeImpl< T >::maximumCacheSize | ( |  | ) | const

inline

Maximum size - not necessarily all used.

In pixels.

Definition at line 150 of file TempLatticeImpl.h.

References itsLatticePtr.

## ok()

template<class T>

Bool casacore::TempLatticeImpl< T >::ok | ( |  | ) | const

inline

Check class internals - used for debugging.

Should always return True

Definition at line 192 of file TempLatticeImpl.h.

References doReopen(), and itsLatticePtr.

## operator=()

template<class T>

TempLatticeImpl< T > & casacore::TempLatticeImpl< T >::operator= | ( | const TempLatticeImpl< T > & | other | ) |

private

The assignment operator cannot be used.

References TempLatticeImpl().

## putAt()

template<class T>

void casacore::TempLatticeImpl< T >::putAt | ( | const T & | value,
|  | const IPosition & | where )

inline

Definition at line 187 of file TempLatticeImpl.h.

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

## reopen()

template<class T>

void casacore::TempLatticeImpl< T >::reopen | ( |  | ) |

If needed, reopen a temporarily closed TempLatticeImpl.

## set()

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

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

## setCacheSizeFromPath()

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

References itsLatticePtr.

## setCacheSizeInTiles()

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

References itsLatticePtr.

## setMaximumCacheSize()

template<class T>

void casacore::TempLatticeImpl< T >::setMaximumCacheSize | ( | uInt | howManyPixels | ) |

inline

Set the maximum (allowed) cache size as indicated.

Definition at line 154 of file TempLatticeImpl.h.

References itsLatticePtr.

## shape()

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

References doReopen(), and itsLatticePtr.

Referenced by init(), TempLatticeImpl(), and TempLatticeImpl().

## showCacheStatistics()

template<class T>

void casacore::TempLatticeImpl< T >::showCacheStatistics | ( | ostream & | os | ) | const

inline

Report on cache success.

Definition at line 179 of file TempLatticeImpl.h.

References itsLatticePtr.

## tempClose()

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.

## tempReopen()

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 doReopen().

## Member Data Documentation

## itsIsClosed

template<class T>

Bool casacore::TempLatticeImpl< T >::itsIsClosed

mutable private

Definition at line 236 of file TempLatticeImpl.h.

Referenced by doReopen().

## itsLatticePtr

template<class T>

std::shared_ptr<Lattice<T> > casacore::TempLatticeImpl< T >::itsLatticePtr

mutable private

Definition at line 234 of file TempLatticeImpl.h.

Referenced by advisedMaxPixels(), apply(), apply(), apply(), clearCache(), doGetSlice(), doNiceCursorShape(), doPutSlice(), getAt(), makeIter(), maximumCacheSize(), ok(), putAt(), set(), setCacheSizeFromPath(), setCacheSizeInTiles(), setMaximumCacheSize(), shape(), and showCacheStatistics().

## itsTable

template<class T>

Table casacore::TempLatticeImpl< T >::itsTable

mutable private

Definition at line 233 of file TempLatticeImpl.h.

Referenced by flush().

## itsTableName

template<class T>

String casacore::TempLatticeImpl< T >::itsTableName

private

Definition at line 235 of file TempLatticeImpl.h.

Referenced by canReferenceArray(), and isPaged().

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

- lattices/Lattices/TempLatticeImpl.h