casacore
|
#include <ColumnCache.h>
Public Member Functions | |
ColumnCache () | |
Constructor. More... | |
void | setIncrement (rownr_t increment) |
Set the increment to the given value. More... | |
void | set (rownr_t startRow, rownr_t endRow, const void *dataPtr) |
Set the start and end row number for which the given data pointer is valid. More... | |
void | invalidate () |
Invalidate the cache. More... | |
Int64 | offset (rownr_t rownr) const |
Calculate the offset in the cached data for the given row. More... | |
const void * | dataPtr () const |
Give a pointer to the data. More... | |
rownr_t | start () const |
Give the start, end (including), and increment row number of the cached column values. More... | |
rownr_t | end () const |
rownr_t | incr () const |
Private Attributes | |
rownr_t | itsStart |
rownr_t | itsEnd |
rownr_t | itsIncr |
const void * | itsData |
A caching object for a table column.
Internal
ColumnCache acts as a cache for a table column. It contains a pointer to data and the start and end row number for which these data are valid. An increment is part of the object and is usually 0 or 1. The value 0 is used for data which is valid for multiple rows (as used in IncrementalStMan). The value 1 is used for data stored consecutevily in a buffer for each row (as used in StManAipsIO).
The ColumnCache object is created and updated by the data manager. The top level ScalarColumn object contains a pointer to the cache object. In this way the ScalarColumn::get
can often be executed by a few inlined statements which improves performance considerably.
The invalidate
function can be used to invalidate the cache. This is for instance needed when a table lock is acquired or released to be sure that the cache gets refreshed.
This class was developed to improve the performance for getting a scalar.
Definition at line 86 of file ColumnCache.h.
casacore::ColumnCache::ColumnCache | ( | ) |
Constructor.
It sets the increment to 1 and calls invalidate.
|
inline |
Give a pointer to the data.
The calling function has to do a proper cast after which the calculated offset can be added to get the proper data.
Definition at line 150 of file ColumnCache.h.
References itsData.
Referenced by casacore::ScalarColumn< T >::get().
|
inline |
Definition at line 117 of file ColumnCache.h.
References itsEnd.
|
inline |
Definition at line 119 of file ColumnCache.h.
References itsIncr.
|
inline |
Invalidate the cache.
This clears the data pointer and sets startRow>endRow.
Definition at line 135 of file ColumnCache.h.
References set().
Calculate the offset in the cached data for the given row.
-1 is returned if the row is not within the cached rows.
Definition at line 140 of file ColumnCache.h.
References itsEnd, itsIncr, itsStart, and casacore::max().
Referenced by casacore::ScalarColumn< T >::get().
Set the start and end row number for which the given data pointer is valid.
Referenced by invalidate().
|
inline |
Set the increment to the given value.
Definition at line 130 of file ColumnCache.h.
References itsIncr.
|
inline |
Give the start, end (including), and increment row number of the cached column values.
Definition at line 115 of file ColumnCache.h.
References itsStart.
|
private |
Definition at line 126 of file ColumnCache.h.
Referenced by dataPtr().
|
private |
Definition at line 124 of file ColumnCache.h.
|
private |
Definition at line 125 of file ColumnCache.h.
Referenced by incr(), offset(), and setIncrement().
|
private |
Definition at line 123 of file ColumnCache.h.