casa
$Rev:20696$
|
The bucket index for a group of columns in the Standard Storage Manager. More...
#include <SSMIndex.h>
Public Member Functions | |
SSMIndex (SSMBase *aPtrSSM, uInt rowsPerBucket=0) | |
Create the object with the given number of rows per bucket. | |
~SSMIndex () | |
void | get (AipsIO &anOs) |
Read the bucket index from the AipsIO object. | |
void | put (AipsIO &anOs) const |
Write the bucket index into the AipsIO object. | |
void | recreate () |
Recreate the object in case all rows are deleted from the table. | |
Vector< uInt > | getBuckets () const |
Return all the bucketnrs used in this index. | |
uInt | getNrBuckets () const |
Return the nr of buckets used. | |
void | setNrColumns (Int aNrColumns, uInt aSizeUsed) |
Set nr of columns use this index. | |
void | addRow (uInt aNrRows) |
Add some rows. | |
void | showStatistics (ostream &anOs) const |
Show Statistics of index. | |
Int | removeColumn (Int anOffset, uInt nbits) |
A column is removed. | |
Int | getFree (Int &anOffset, uInt nbits) const |
Try to find free space for a field with a given length (best fit). | |
void | addColumn (Int anOffset, uInt nbits) |
reuse the space at offset for a field with the given nr of bits. | |
Int | deleteRow (uInt aRowNumber) |
Delete the given row. | |
uInt | getRowsPerBucket () const |
Get the number of rows that fits in ach bucket. | |
void | find (uInt aRowNumber, uInt &aBucketNr, uInt &aStartRow, uInt &anEndRow) const |
Find the bucket containing the given row. | |
Private Member Functions | |
uInt | getIndex (uInt aRowNr) const |
Get the index of the bucket containing the given row. | |
Private Attributes | |
SSMBase * | itsSSMPtr |
uInt | itsNUsed |
Block< uInt > | itsLastRow |
Block< uInt > | itsBucketNumber |
SimpleOrderedMap< Int, Int > | itsFreeSpace |
uInt | itsRowsPerBucket |
Int | itsNrColumns |
The bucket index for a group of columns in the Standard Storage Manager.
Internal
SSMIndex represent the bucket index in the Standard Storage Manager.
In SSMBase it is described that an index is used to map row number to data bucket in a bucket stream. This class implements this index. It serves 2 purposes:
Definition at line 86 of file SSMIndex.h.
casa::SSMIndex::SSMIndex | ( | SSMBase * | aPtrSSM, |
uInt | rowsPerBucket = 0 |
||
) | [explicit] |
Create the object with the given number of rows per bucket.
Note that the default is needed to create the object for existing tables.
void casa::SSMIndex::addColumn | ( | Int | anOffset, |
uInt | nbits | ||
) |
reuse the space at offset for a field with the given nr of bits.
This is used when column has been added to this bucket.
void casa::SSMIndex::addRow | ( | uInt | aNrRows | ) |
Add some rows.
Int casa::SSMIndex::deleteRow | ( | uInt | aRowNumber | ) |
Delete the given row.
void casa::SSMIndex::find | ( | uInt | aRowNumber, |
uInt & | aBucketNr, | ||
uInt & | aStartRow, | ||
uInt & | anEndRow | ||
) | const |
Find the bucket containing the given row.
An exception is thrown if not found. It also sets the first and last row number fitting in that bucket.
void casa::SSMIndex::get | ( | AipsIO & | anOs | ) |
Read the bucket index from the AipsIO object.
Vector<uInt> casa::SSMIndex::getBuckets | ( | ) | const |
Return all the bucketnrs used in this index.
Int casa::SSMIndex::getFree | ( | Int & | anOffset, |
uInt | nbits | ||
) | const |
Try to find free space for a field with a given length (best fit).
-1 is returned if no fit is found. Otherwise it returns the nr of bytes left unused.
uInt casa::SSMIndex::getIndex | ( | uInt | aRowNr | ) | const [private] |
Get the index of the bucket containing the given row.
uInt casa::SSMIndex::getNrBuckets | ( | ) | const |
Return the nr of buckets used.
uInt casa::SSMIndex::getRowsPerBucket | ( | ) | const [inline] |
Get the number of rows that fits in ach bucket.
Definition at line 176 of file SSMIndex.h.
References itsRowsPerBucket.
void casa::SSMIndex::put | ( | AipsIO & | anOs | ) | const |
Write the bucket index into the AipsIO object.
void casa::SSMIndex::recreate | ( | ) |
Recreate the object in case all rows are deleted from the table.
Int casa::SSMIndex::removeColumn | ( | Int | anOffset, |
uInt | nbits | ||
) |
A column is removed.
Set the free space at offset for a field with the given nr of bits. It returns the nr of columns still used in this index.
void casa::SSMIndex::setNrColumns | ( | Int | aNrColumns, |
uInt | aSizeUsed | ||
) |
Set nr of columns use this index.
void casa::SSMIndex::showStatistics | ( | ostream & | anOs | ) | const |
Show Statistics of index.
Block<uInt> casa::SSMIndex::itsBucketNumber [private] |
Definition at line 163 of file SSMIndex.h.
SimpleOrderedMap<Int,Int> casa::SSMIndex::itsFreeSpace [private] |
Definition at line 166 of file SSMIndex.h.
Block<uInt> casa::SSMIndex::itsLastRow [private] |
Definition at line 158 of file SSMIndex.h.
Int casa::SSMIndex::itsNrColumns [private] |
Definition at line 172 of file SSMIndex.h.
uInt casa::SSMIndex::itsNUsed [private] |
Definition at line 155 of file SSMIndex.h.
uInt casa::SSMIndex::itsRowsPerBucket [private] |
Definition at line 169 of file SSMIndex.h.
Referenced by getRowsPerBucket().
SSMBase* casa::SSMIndex::itsSSMPtr [private] |
Definition at line 152 of file SSMIndex.h.