casa
$Rev:20696$
|
The Index of the Incremental Storage Manager. More...
#include <ISMIndex.h>
Public Member Functions | |
ISMIndex (ISMBase *parent) | |
Create a ISMIndex object with the given parent for a new table. | |
~ISMIndex () | |
The destructor closes the file (if opened). | |
void | addRow (uInt nrrow) |
Add a row. | |
Int | removeRow (uInt rownr) |
Remove a row from the index. | |
uInt | getBucketNr (uInt rownr, uInt &bucketStartRow, uInt &bucketNrrow) const |
Get the bucket number for the given row. | |
void | get (AipsIO &os) |
Read the bucket index from the AipsIO object. | |
void | put (AipsIO &os) |
Write the bucket index into the AipsIO object. | |
void | addBucketNr (uInt rownr, uInt bucketNr) |
Add a bucket number to the index. | |
Bool | nextBucketNr (uInt &cursor, uInt &bucketStartRow, uInt &bucketNrrow, uInt &bucketNr) const |
Get the number of the next bucket from the index and return it in bucketNr . | |
Private Member Functions | |
ISMIndex (const ISMIndex &) | |
Forbid copy constructor. | |
ISMIndex & | operator= (const ISMIndex &) |
Forbid assignment. | |
uInt | getIndex (uInt rownr) const |
Get the index of the bucket containing the given row. | |
Private Attributes | |
ISMBase * | stmanPtr_p |
Pointer to the parent storage manager. | |
uInt | nused_p |
Number of entries used. | |
Block< uInt > | rows_p |
Rownr index (i.e. | |
Block< uInt > | bucketNr_p |
Corresponding bucket number. |
The Index of the Incremental Storage Manager.
Internal
ISMIndex represents the index in the Incremental Storage Manager.
ISMIndex maintains an index of all buckets in an ISM (Incremental Storage Manager). The index consists of the starting row number and the bucket number of each bucket in the BucketCache object of the ISM. When the ISM is opened, the entire index is read in and kept in memory. When the ISM is closed or flushed, the index is written back after all buckets in the file. A little header at the beginning of the file indicates the starting offset of the index.
ISMIndex encapsulates all operations on the ISM index.
Definition at line 79 of file ISMIndex.h.
casa::ISMIndex::ISMIndex | ( | ISMBase * | parent | ) | [explicit] |
Create a ISMIndex object with the given parent for a new table.
It keeps the pointer to its parent (but does not own it).
The destructor closes the file (if opened).
casa::ISMIndex::ISMIndex | ( | const ISMIndex & | ) | [private] |
Forbid copy constructor.
void casa::ISMIndex::addBucketNr | ( | uInt | rownr, |
uInt | bucketNr | ||
) |
Add a bucket number to the index.
Argument rownr
gives the starting row of the bucket. It is used to add the bucket number at the correct place (such that the row numbers are kept in ascending order).
void casa::ISMIndex::addRow | ( | uInt | nrrow | ) |
Add a row.
void casa::ISMIndex::get | ( | AipsIO & | os | ) |
Read the bucket index from the AipsIO object.
uInt casa::ISMIndex::getBucketNr | ( | uInt | rownr, |
uInt & | bucketStartRow, | ||
uInt & | bucketNrrow | ||
) | const |
Get the bucket number for the given row.
Also return the start row of the bucket and the number of rows in it.
uInt casa::ISMIndex::getIndex | ( | uInt | rownr | ) | const [private] |
Get the index of the bucket containing the given row.
Bool casa::ISMIndex::nextBucketNr | ( | uInt & | cursor, |
uInt & | bucketStartRow, | ||
uInt & | bucketNrrow, | ||
uInt & | bucketNr | ||
) | const |
Get the number of the next bucket from the index and return it in bucketNr
.
The starting row of that bucket and the number of rows in the bucket are also returned. Return status False indicates that no more buckets are available.
The start of the iteration is indicated by cursor=0. The first bucket returned is the bucket containing the rownr given in bucketStartRow
(thus set bucketStartRow to 0 if you to start at the first bucket).
The next iterations return the next bucket number and fill the starting row and number of rows.
void casa::ISMIndex::put | ( | AipsIO & | os | ) |
Write the bucket index into the AipsIO object.
Int casa::ISMIndex::removeRow | ( | uInt | rownr | ) |
Remove a row from the index.
If the result of this is that the entire bucket gets empty, that bucketnr is returned. Otherwise -1 is returned.
Block<uInt> casa::ISMIndex::bucketNr_p [private] |
Corresponding bucket number.
Definition at line 146 of file ISMIndex.h.
uInt casa::ISMIndex::nused_p [private] |
Number of entries used.
Definition at line 142 of file ISMIndex.h.
Block<uInt> casa::ISMIndex::rows_p [private] |
Rownr index (i.e.
row rows_p[i] starts in bucketNr_p[i]).
Definition at line 144 of file ISMIndex.h.
ISMBase* casa::ISMIndex::stmanPtr_p [private] |
Pointer to the parent storage manager.
Definition at line 140 of file ISMIndex.h.