ISMBase.h

Classes

ISMBase -- Base class of the Incremental Storage Manager (full description)

class ISMBase: public DataManager

Interface

Public Members
explicit ISMBase (uInt bucketSize = 0, Bool checkBucketSize = True, uInt cacheSize = 1)
ISMBase (const String& dataManagerName, uInt bucketSize, Bool checkBucketSize, uInt cacheSize)
ISMBase (const String& aDataManName, const Record& spec)
~ISMBase()
virtual DataManager* clone() const
virtual String dataManagerType() const
virtual String dataManagerName() const
virtual Record dataManagerSpec() const
uInt version() const
void setCacheSize (uInt cacheSize)
uInt cacheSize() const
void clearCache()
void showCacheStatistics (ostream& os) const
uInt bucketSize() const
uInt uIntSize() const
ISMBucket* getBucket (uInt rownr, uInt& bucketStartRow, uInt& bucketNrrow)
ISMBucket* nextBucket (uInt& cursor, uInt& bucketStartRow, uInt& bucketNrrow)
char* tempBuffer() const
uInt uniqueNr()
uInt nrow() const
virtual Bool canAddRow() const
virtual Bool canRemoveRow() const
virtual Bool canAddColumn() const
virtual Bool canRemoveColumn() const
static DataManager* makeObject (const String& dataManagerType, const Record& spec)
ISMColumn& getColumn (uInt colnr)
void addBucket (uInt rownr, ISMBucket* bucket)
void setBucketDirty()
StManArrayFile* openArrayFile (ByteIO::OpenOption opt)
Private Members
ISMBase (const ISMBase& that)
ISMBase& operator= (const ISMBase& that)
void recreate()
virtual Bool flush (AipsIO&, Bool fsync)
virtual void create (uInt nrrow)
virtual void open (uInt nrrow, AipsIO&)
virtual void resync (uInt nrrow)
virtual void reopenRW()
virtual void deleteManager()
void init()
virtual void addRow (uInt nrrow)
virtual void removeRow (uInt rownr)
virtual void addColumn (DataManagerColumn*)
virtual void removeColumn (DataManagerColumn*)
virtual DataManagerColumn* makeScalarColumn (const String& name, int dataType, const String& dataTypeID)
virtual DataManagerColumn* makeDirArrColumn (const String& name, int dataType, const String& dataTypeID)
virtual DataManagerColumn* makeIndArrColumn (const String& name, int dataType, const String& dataTypeID)
BucketCache& getCache()
ISMIndex& getIndex()
void makeCache()
void makeIndex()
void readIndex()
void writeIndex()

Description

Review Status

Programs:
Tests:

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

Member Description

explicit ISMBase (uInt bucketSize = 0, Bool checkBucketSize = True, uInt cacheSize = 1)

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.

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.

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).

~ISMBase()

virtual DataManager* clone() const

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

virtual String dataManagerType() const

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

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. It will flush the cache as needed and remove all buckets from it.

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).

ISMBucket* 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* 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* 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). This is used by ISMColumnIndArr to create a unique file name.

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)

static DataManager* makeObject (const String& dataManagerType, const Record& spec)

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& getColumn (uInt colnr)

Get access to the given column.

void addBucket (uInt rownr, ISMBucket* bucket)

Add a bucket to the storage manager (i.e. to the cache). The pointer is taken over.

void 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* openArrayFile (ByteIO::OpenOption opt)

Open (if needed) the file for indirect arrays with the given mode. Return a pointer to the object.

ISMBase (const ISMBase& that)

Copy constructor (only meant for clone function).

ISMBase& operator= (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. It returns a True status if it had to flush (i.e. if data have changed).

virtual void create (uInt nrrow)

Let the storage manager create files as needed for a new table. This allows a column with an indirect array to create its file.

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. This is done by clearing the cache.

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). So clean up the things needed (e.g. delete files).

void init()

Let the storage manager initialize itself. It is used by create and open.

virtual void addRow (uInt nrrow)

Add rows to the storage manager. Per column it extends the interval for which the last value written is valid.

virtual void removeRow (uInt rownr)

Delete a row from all columns.

virtual void addColumn (DataManagerColumn*)

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.

virtual void removeColumn (DataManagerColumn*)

Remove a column from the data file and the colSet_p. The DataManagerColumn object gets deleted..

virtual DataManagerColumn* makeScalarColumn (const String& name, int dataType, const String& dataTypeID)

Create a column in the storage manager on behalf of a table column. The caller has to delete the newly created object.

Create a scalar column.

virtual DataManagerColumn* makeDirArrColumn (const String& name, int dataType, const String& dataTypeID)

Create a column in the storage manager on behalf of a table column. The caller has to delete the newly created object.

Create a direct array column.

virtual DataManagerColumn* makeIndArrColumn (const String& name, int dataType, const String& dataTypeID)

Create a column in the storage manager on behalf of a table column. The caller has to delete the newly created object.

Create an indirect array column.

BucketCache& getCache()

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

ISMIndex& getIndex()

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

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).