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

A caching object for a table column. More...

#include <ColumnCache.h>

Public Member Functions

 ColumnCache ()
 Constructor. More...
 
void setIncrement (uInt increment)
 Set the increment to the given value. More...
 
void set (uInt startRow, uInt 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...
 
Int offset (uInt 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...
 
uInt start () const
 Give the start, end (including), and increment row number of the cached column values. More...
 
uInt end () const
 
uInt incr () const
 

Private Attributes

uInt itsStart
 
uInt itsEnd
 
uInt itsIncr
 
const void * itsData
 

Detailed Description

A caching object for a table column.

Intended use:

Internal

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Prerequisite

Synopsis

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.

Motivation

This class was developed to improve the performance for getting a scalar.

To Do

Definition at line 83 of file ColumnCache.h.

Constructor & Destructor Documentation

casacore::ColumnCache::ColumnCache ( )

Constructor.

It sets the increment to 1 and calls invalidate.

Member Function Documentation

const void * casacore::ColumnCache::dataPtr ( ) const
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 140 of file ColumnCache.h.

References itsData.

Referenced by casacore::ScalarColumn< casacore::String >::get().

uInt casacore::ColumnCache::end ( ) const
inline

Definition at line 113 of file ColumnCache.h.

References itsEnd.

uInt casacore::ColumnCache::incr ( ) const
inline

Definition at line 114 of file ColumnCache.h.

References itsIncr.

void casacore::ColumnCache::invalidate ( )
inline

Invalidate the cache.

This clears the data pointer and sets startRow>endRow.

Definition at line 129 of file ColumnCache.h.

References set().

Int casacore::ColumnCache::offset ( uInt  rownr) const
inline

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 134 of file ColumnCache.h.

References itsEnd, itsIncr, and itsStart.

Referenced by casacore::ScalarColumn< casacore::String >::get().

void casacore::ColumnCache::set ( uInt  startRow,
uInt  endRow,
const void *  dataPtr 
)

Set the start and end row number for which the given data pointer is valid.

Referenced by invalidate().

void casacore::ColumnCache::setIncrement ( uInt  increment)
inline

Set the increment to the given value.

Definition at line 124 of file ColumnCache.h.

References itsIncr.

uInt casacore::ColumnCache::start ( ) const
inline

Give the start, end (including), and increment row number of the cached column values.

Definition at line 112 of file ColumnCache.h.

References itsStart.

Member Data Documentation

const void* casacore::ColumnCache::itsData
private

Definition at line 120 of file ColumnCache.h.

Referenced by dataPtr().

uInt casacore::ColumnCache::itsEnd
private

Definition at line 118 of file ColumnCache.h.

Referenced by end(), and offset().

uInt casacore::ColumnCache::itsIncr
private

Definition at line 119 of file ColumnCache.h.

Referenced by incr(), offset(), and setIncrement().

uInt casacore::ColumnCache::itsStart
private

Definition at line 117 of file ColumnCache.h.

Referenced by offset(), and start().


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