casa::ISMBase Class Reference
[Tables_internal_classes]

#include <ISMBase.h>

Inheritance diagram for casa::ISMBase:

Inheritance graph
[legend]
Collaboration diagram for casa::ISMBase:

Collaboration graph
[legend]
List of all members.

Detailed Description

Base class of the Incremental Storage Manager.

Intended use:

Internal

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Test programs:
tIncrementalStMan

Prerequisite

Etymology

ISMBase is the base class of the Incremental Storage Manager.

Synopsis

The behaviour of this class is described in IncrementalStMan .

Motivation

The public interface of ISMBase is quite large, because the other internal ISM classes need these functions. To have a class with a minimal interface for the normal user, class IncrementalStMan is derived from it.
IncrementalStMan needs an isA- instead of hasA-relation to be able to bind columns to it in class SetupNewTable .

To Do

Definition at line 87 of file ISMBase.h.

Public Member Functions

 ISMBase (uInt bucketSize=0, Bool checkBucketSize=True, uInt cacheSize=1)
 Create an incremental storage manager without a name.
 ISMBase (const String &dataManagerName, uInt bucketSize, Bool checkBucketSize, uInt cacheSize)
 Create an incremental storage manager with the given name.
 ISMBase (const String &aDataManName, const Record &spec)
 Create an incremental storage manager with the given name.
 ~ISMBase ()
virtual DataManagerclone () const
 Clone this object.
virtual String dataManagerType () const
 Get the type name of the data manager (i.e.
virtual String dataManagerName () const
 Get the name given to the storage manager (in the constructor).
virtual Record dataManagerSpec () const
 Record a record containing data manager specifications.
uInt version () const
 Get the version of the class.
void setCacheSize (uInt cacheSize)
 Set the cache size (in buckets).
uInt cacheSize () const
 Get the current cache size (in buckets).
void clearCache ()
 Clear the cache used by this storage manager.
void showCacheStatistics (ostream &os) const
 Show the statistics of all caches used.
uInt bucketSize () const
 Get the bucket size (in bytes).
uInt uIntSize () const
 Get the size of a uInt in external format (can be canonical or local).
ISMBucketgetBucket (uInt rownr, uInt &bucketStartRow, uInt &bucketNrrow)
 Get the bucket containing the given row.
ISMBucketnextBucket (uInt &cursor, uInt &bucketStartRow, uInt &bucketNrrow)
 Get the next bucket.
char * tempBuffer () const
 Get access to the temporary buffer.
uInt uniqueNr ()
 Get a unique column number for the column (it is only unique for this storage manager).
uInt nrow () const
 Get the number of rows in this storage manager.
virtual Bool canAddRow () const
 Can the storage manager add rows? (yes).
virtual Bool canRemoveRow () const
 Can the storage manager delete rows? (yes).
virtual Bool canAddColumn () const
 Can the storage manager add columns? (not yet).
virtual Bool canRemoveColumn () const
 Can the storage manager delete columns? (not yet).
ISMColumngetColumn (uInt colnr)
 Get access to the given column.
void addBucket (uInt rownr, ISMBucket *bucket)
 Add a bucket to the storage manager (i.e.
void setBucketDirty ()
 Make the current bucket in the cache dirty (i.e.
StManArrayFileopenArrayFile (ByteIO::OpenOption opt)
 Open (if needed) the file for indirect arrays with the given mode.

Static Public Member Functions

static DataManagermakeObject (const String &dataManagerType, const Record &spec)
 Make the object from the type name string.

Private Member Functions

 ISMBase (const ISMBase &that)
 Copy constructor (only meant for clone function).
ISMBaseoperator= (const ISMBase &that)
 Assignment cannot be used.
void recreate ()
 (Re)create the index, file, and cache object.
virtual Bool flush (AipsIO &, Bool fsync)
 Flush and optionally fsync the data.
virtual void create (uInt nrrow)
 Let the storage manager create files as needed for a new table.
virtual void open (uInt nrrow, AipsIO &)
 Open the storage manager file for an existing table, read in the data, and let the ISMColumn objects read their data.
virtual void resync (uInt nrrow)
 Resync the storage manager with the new file contents.
virtual void reopenRW ()
 Reopen the storage manager files for read/write.
virtual void deleteManager ()
 The data manager will be deleted (because all its columns are requested to be deleted).
void init ()
 Let the storage manager initialize itself.
virtual void addRow (uInt nrrow)
 Add rows to the storage manager.
virtual void removeRow (uInt rownr)
 Delete a row from all columns.
virtual void addColumn (DataManagerColumn *)
 Do the final addition of a column.
virtual void removeColumn (DataManagerColumn *)
 Remove a column from the data file and the colSet_p.
BucketCachegetCache ()
 Get the cache object.
ISMIndexgetIndex ()
 Get the index object.
void makeCache ()
 Construct the cache object (if not constructed yet).
void makeIndex ()
 Construct the index object (if not constructed yet) and read it.
void readIndex ()
 Read the index (at the end of the file).
void writeIndex ()
 Write the index (at the end of the file).
virtual DataManagerColumnmakeScalarColumn (const String &name, int dataType, const String &dataTypeID)
 Create a scalar column.
virtual DataManagerColumnmakeDirArrColumn (const String &name, int dataType, const String &dataTypeID)
 Create a direct array column.
virtual DataManagerColumnmakeIndArrColumn (const String &name, int dataType, const String &dataTypeID)
 Create an indirect array column.

Private Attributes

String dataManName_p
 Name of data manager.
uInt version_p
 The version of the class.
StManArrayFileiosfile_p
 The file containing the indirect arrays.
uInt uniqnr_p
 Unique nr for column in this storage manager.
uInt nrrow_p
 The number of rows in the columns.
PtrBlock< ISMColumn * > colSet_p
 The assembly of all columns.
BucketCachecache_p
 The cache with the ISM buckets.
BucketFilefile_p
 The file containing all data.
ISMIndexindex_p
 The ISM bucket index.
uInt persCacheSize_p
 The persistent cache size.
uInt cacheSize_p
 The actual cache size.
uInt nbucketInit_p
 The initial number of buckets in the cache.
uInt nFreeBucket_p
 The nr of free buckets.
Int firstFree_p
 The first free bucket.
uInt bucketSize_p
 The bucket size.
Bool checkBucketSize_p
 Check a positive bucketsize?
Bool dataChanged_p
 Has the data changed since the last flush?
uInt uIntSize_p
 The size of a uInt in external format (local or canonical).
char * tempBuffer_p
 A temporary read/write buffer (also for other classes).


Constructor & Destructor Documentation

casa::ISMBase::ISMBase ( uInt  bucketSize = 0,
Bool  checkBucketSize = True,
uInt  cacheSize = 1 
) [explicit]

Create an incremental storage manager without a name.

The bucket size has to be given in bytes and the cache size in buckets. The bucket size is checked or calculated as described in IncrementalStMan.h.

casa::ISMBase::ISMBase ( const String dataManagerName,
uInt  bucketSize,
Bool  checkBucketSize,
uInt  cacheSize 
)

Create an incremental storage manager with the given name.

The bucket size has to be given in bytes and the cache size in buckets. The bucket size is checked or calculated as described in IncrementalStMan.h.

casa::ISMBase::ISMBase ( const String aDataManName,
const Record spec 
)

Create an incremental storage manager with the given name.

The specifications are in the record (as created by dataManagerSpec).

casa::ISMBase::~ISMBase (  ) 

casa::ISMBase::ISMBase ( const ISMBase that  )  [private]

Copy constructor (only meant for clone function).


Member Function Documentation

virtual DataManager* casa::ISMBase::clone (  )  const [virtual]

Clone this object.

It does not clone ISMColumn objects possibly used. The caller has to delete the newly created object.

Implements casa::DataManager.

virtual String casa::ISMBase::dataManagerType (  )  const [virtual]

Get the type name of the data manager (i.e.

IncrementalStMan).

Implements casa::DataManager.

virtual String casa::ISMBase::dataManagerName (  )  const [virtual]

Get the name given to the storage manager (in the constructor).

Reimplemented from casa::DataManager.

virtual Record casa::ISMBase::dataManagerSpec (  )  const [virtual]

Record a record containing data manager specifications.

Reimplemented from casa::DataManager.

uInt casa::ISMBase::version (  )  const [inline]

Get the version of the class.

Definition at line 349 of file ISMBase.h.

References version_p.

void casa::ISMBase::setCacheSize ( uInt  cacheSize  ) 

Set the cache size (in buckets).

uInt casa::ISMBase::cacheSize (  )  const [inline]

Get the current cache size (in buckets).

Definition at line 354 of file ISMBase.h.

References cacheSize_p.

void casa::ISMBase::clearCache (  ) 

Clear the cache used by this storage manager.

It will flush the cache as needed and remove all buckets from it.

void casa::ISMBase::showCacheStatistics ( ostream &  os  )  const

Show the statistics of all caches used.

uInt casa::ISMBase::bucketSize (  )  const [inline]

Get the bucket size (in bytes).

Definition at line 369 of file ISMBase.h.

References bucketSize_p.

uInt casa::ISMBase::uIntSize (  )  const [inline]

Get the size of a uInt in external format (can be canonical or local).

Definition at line 374 of file ISMBase.h.

References uIntSize_p.

ISMBucket* casa::ISMBase::getBucket ( uInt  rownr,
uInt bucketStartRow,
uInt bucketNrrow 
)

Get the bucket containing the given row.

Also return the first and last row of that bucket. The bucket object is created and deleted by the caching mechanism.

ISMBucket* casa::ISMBase::nextBucket ( uInt cursor,
uInt bucketStartRow,
uInt bucketNrrow 
)

Get the next bucket.

cursor=0 indicates the start of the iteration. The first bucket returned is the bucket containing the rownr given in bucketStartRow. After each iteration BucketStartRow and bucketNrrow are set. A 0 is returned when no more buckets. The bucket object is created and deleted by the caching mechanism.

char * casa::ISMBase::tempBuffer (  )  const [inline]

Get access to the temporary buffer.

Definition at line 379 of file ISMBase.h.

References tempBuffer_p.

uInt casa::ISMBase::uniqueNr (  )  [inline]

Get a unique column number for the column (it is only unique for this storage manager).

This is used by ISMColumnIndArr to create a unique file name.

Definition at line 359 of file ISMBase.h.

References uniqnr_p.

uInt casa::ISMBase::nrow (  )  const [inline]

Get the number of rows in this storage manager.

Definition at line 364 of file ISMBase.h.

References nrrow_p.

virtual Bool casa::ISMBase::canAddRow (  )  const [virtual]

Can the storage manager add rows? (yes).

Reimplemented from casa::DataManager.

virtual Bool casa::ISMBase::canRemoveRow (  )  const [virtual]

Can the storage manager delete rows? (yes).

Reimplemented from casa::DataManager.

virtual Bool casa::ISMBase::canAddColumn (  )  const [virtual]

Can the storage manager add columns? (not yet).

Reimplemented from casa::DataManager.

virtual Bool casa::ISMBase::canRemoveColumn (  )  const [virtual]

Can the storage manager delete columns? (not yet).

Reimplemented from casa::DataManager.

static DataManager* casa::ISMBase::makeObject ( const String dataManagerType,
const Record spec 
) [static]

Make the object from the type name string.

This function gets registered in the DataManager "constructor" map. The caller has to delete the object.

ISMColumn & casa::ISMBase::getColumn ( uInt  colnr  )  [inline]

Get access to the given column.

Definition at line 400 of file ISMBase.h.

References colSet_p.

void casa::ISMBase::addBucket ( uInt  rownr,
ISMBucket bucket 
)

Add a bucket to the storage manager (i.e.

to the cache). The pointer is taken over.

void casa::ISMBase::setBucketDirty (  ) 

Make the current bucket in the cache dirty (i.e.

something has been changed in it and it needs to be written when removed from the cache). (used by ISMColumn::putValue).

StManArrayFile* casa::ISMBase::openArrayFile ( ByteIO::OpenOption  opt  ) 

Open (if needed) the file for indirect arrays with the given mode.

Return a pointer to the object.

ISMBase& casa::ISMBase::operator= ( const ISMBase that  )  [private]

Assignment cannot be used.

void casa::ISMBase::recreate (  )  [private]

(Re)create the index, file, and cache object.

virtual Bool casa::ISMBase::flush ( AipsIO ,
Bool  fsync 
) [private, virtual]

Flush and optionally fsync the data.

It returns a True status if it had to flush (i.e. if data have changed).

Implements casa::DataManager.

virtual void casa::ISMBase::create ( uInt  nrrow  )  [private, virtual]

Let the storage manager create files as needed for a new table.

This allows a column with an indirect array to create its file.

Implements casa::DataManager.

virtual void casa::ISMBase::open ( uInt  nrrow,
AipsIO  
) [private, virtual]

Open the storage manager file for an existing table, read in the data, and let the ISMColumn objects read their data.

Implements casa::DataManager.

virtual void casa::ISMBase::resync ( uInt  nrrow  )  [private, virtual]

Resync the storage manager with the new file contents.

This is done by clearing the cache.

Implements casa::DataManager.

virtual void casa::ISMBase::reopenRW (  )  [private, virtual]

Reopen the storage manager files for read/write.

Reimplemented from casa::DataManager.

virtual void casa::ISMBase::deleteManager (  )  [private, virtual]

The data manager will be deleted (because all its columns are requested to be deleted).

So clean up the things needed (e.g. delete files).

Implements casa::DataManager.

void casa::ISMBase::init (  )  [private]

Let the storage manager initialize itself.

It is used by create and open.

virtual void casa::ISMBase::addRow ( uInt  nrrow  )  [private, virtual]

Add rows to the storage manager.

Per column it extends the interval for which the last value written is valid.

Reimplemented from casa::DataManager.

virtual void casa::ISMBase::removeRow ( uInt  rownr  )  [private, virtual]

Delete a row from all columns.

Reimplemented from casa::DataManager.

virtual void casa::ISMBase::addColumn ( DataManagerColumn  )  [private, virtual]

Do the final addition of a column.

The DataManagerColumn object has already been created (by the makeXXColumn function) and added to colSet_p. However, it still has to be added to the data files, which is done by this function. It uses the pointer to find the correct column in the colSet_p.

Reimplemented from casa::DataManager.

virtual void casa::ISMBase::removeColumn ( DataManagerColumn  )  [private, virtual]

Remove a column from the data file and the colSet_p.

The DataManagerColumn object gets deleted.\.

Reimplemented from casa::DataManager.

virtual DataManagerColumn* casa::ISMBase::makeScalarColumn ( const String name,
int  dataType,
const String dataTypeID 
) [private, virtual]

Create a scalar column.

Implements casa::DataManager.

virtual DataManagerColumn* casa::ISMBase::makeDirArrColumn ( const String name,
int  dataType,
const String dataTypeID 
) [private, virtual]

Create a direct array column.

Implements casa::DataManager.

virtual DataManagerColumn* casa::ISMBase::makeIndArrColumn ( const String name,
int  dataType,
const String dataTypeID 
) [private, virtual]

Create an indirect array column.

Implements casa::DataManager.

BucketCache & casa::ISMBase::getCache (  )  [inline, private]

Get the cache object.

This will construct the cache object if not present yet. The cache object will be deleted by the destructor.

Definition at line 384 of file ISMBase.h.

References cache_p, and makeCache().

ISMIndex & casa::ISMBase::getIndex (  )  [inline, private]

Get the index object.

This will construct the index object if not present yet. The index object will be deleted by the destructor.

Definition at line 392 of file ISMBase.h.

References index_p, and makeIndex().

void casa::ISMBase::makeCache (  )  [private]

Construct the cache object (if not constructed yet).

Referenced by getCache().

void casa::ISMBase::makeIndex (  )  [private]

Construct the index object (if not constructed yet) and read it.

Referenced by getIndex().

void casa::ISMBase::readIndex (  )  [private]

Read the index (at the end of the file).

void casa::ISMBase::writeIndex (  )  [private]

Write the index (at the end of the file).


Member Data Documentation

String casa::ISMBase::dataManName_p [private]

Name of data manager.

Definition at line 309 of file ISMBase.h.

uInt casa::ISMBase::version_p [private]

The version of the class.

Definition at line 311 of file ISMBase.h.

Referenced by version().

StManArrayFile* casa::ISMBase::iosfile_p [private]

The file containing the indirect arrays.

Definition at line 313 of file ISMBase.h.

uInt casa::ISMBase::uniqnr_p [private]

Unique nr for column in this storage manager.

Definition at line 315 of file ISMBase.h.

Referenced by uniqueNr().

uInt casa::ISMBase::nrrow_p [private]

The number of rows in the columns.

Definition at line 317 of file ISMBase.h.

Referenced by nrow().

PtrBlock<ISMColumn*> casa::ISMBase::colSet_p [private]

The assembly of all columns.

Definition at line 319 of file ISMBase.h.

Referenced by getColumn().

BucketCache* casa::ISMBase::cache_p [private]

The cache with the ISM buckets.

Definition at line 321 of file ISMBase.h.

Referenced by getCache().

BucketFile* casa::ISMBase::file_p [private]

The file containing all data.

Definition at line 323 of file ISMBase.h.

ISMIndex* casa::ISMBase::index_p [private]

The ISM bucket index.

Definition at line 325 of file ISMBase.h.

Referenced by getIndex().

uInt casa::ISMBase::persCacheSize_p [private]

The persistent cache size.

Definition at line 327 of file ISMBase.h.

uInt casa::ISMBase::cacheSize_p [private]

The actual cache size.

Definition at line 329 of file ISMBase.h.

Referenced by cacheSize().

uInt casa::ISMBase::nbucketInit_p [private]

The initial number of buckets in the cache.

Definition at line 331 of file ISMBase.h.

uInt casa::ISMBase::nFreeBucket_p [private]

The nr of free buckets.

Definition at line 333 of file ISMBase.h.

Int casa::ISMBase::firstFree_p [private]

The first free bucket.

Definition at line 335 of file ISMBase.h.

uInt casa::ISMBase::bucketSize_p [private]

The bucket size.

Definition at line 337 of file ISMBase.h.

Referenced by bucketSize().

Bool casa::ISMBase::checkBucketSize_p [private]

Check a positive bucketsize?

Definition at line 339 of file ISMBase.h.

Bool casa::ISMBase::dataChanged_p [private]

Has the data changed since the last flush?

Definition at line 341 of file ISMBase.h.

uInt casa::ISMBase::uIntSize_p [private]

The size of a uInt in external format (local or canonical).

Definition at line 343 of file ISMBase.h.

Referenced by uIntSize().

char* casa::ISMBase::tempBuffer_p [private]

A temporary read/write buffer (also for other classes).

Definition at line 345 of file ISMBase.h.

Referenced by tempBuffer().


The documentation for this class was generated from the following file:
Generated on Mon Sep 1 22:45:31 2008 for NRAOCASA by  doxygen 1.5.1