28 #ifndef TABLES_SSMBASE_H
29 #define TABLES_SSMBASE_H
33 #include <casacore/casa/aips.h>
34 #include <casacore/tables/DataMan/DataManager.h>
35 #include <casacore/casa/Containers/Block.h>
45 class SSMStringHandler;
293 const char* aBucket);
366 const String& aDataTypeID);
370 const String& aDataTypeID);
374 const String& aDataTypeID);
Cache for buckets in a part of a file.
OpenOption
Define the possible ByteIO open options.
Abstract base class for a data manager.
A drop-in replacement for Block<T*>.
SSMIndex & getIndex(uInt anIdxNr)
Get access to the given Index.
virtual void create64(rownr_t aNrRows)
Let the storage manager create files as needed for a new table.
static char * readCallBack(void *anOwner, const char *aBucketStorage)
Callbacks for BucketCache access.
SSMStringHandler * getStringHandler()
Return a pointer to the (one and only) StringHandler object.
SSMColumn & getColumn(uInt aColNr)
Get access to the given column.
void makeCache()
Construct the cache object (if not constructed yet).
uInt itsIndexLength
length of index memoryblock
static void deleteCallBack(void *, char *aBucket)
uInt getCacheSize() const
Get the current cache size (in buckets).
Int itsLastStringBucket
Number of the first String Bucket.
virtual void addRow64(rownr_t aNrRows)
Add rows to the storage manager.
uInt itsPersCacheSize
The persistent cache size.
StManArrayFile * openArrayFile(ByteIO::OpenOption anOpt)
Open (if needed) the file for indirect arrays with the given mode.
virtual Record dataManagerSpec() const
Record a record containing data manager specifications.
PtrBlock< SSMIndex * > itsPtrIndex
Will contain all indices.
uInt getRowsPerBucket(uInt aColumn) const
Get rows per bucket for the given column.
uInt itsBucketSize
The bucket size.
SSMStringHandler * itsStringHandler
String handler class.
BucketCache * itsCache
The cache with the SSM buckets.
uInt getNewBucket()
Add a new bucket and get its bucket number.
uInt itsNrBuckets
The initial number of buckets in the cache.
void recreate()
(Re)create the index, file, and cache object.
char * find(rownr_t aRowNr, uInt aColNr, rownr_t &aStartRow, rownr_t &anEndRow, const String &colName)
Find the bucket containing the column and row and return the pointer to the beginning of the column d...
String itsDataManName
Name of data manager.
void init()
Let the storage manager initialize itself (upon creation).
void readHeader()
Read the header.
void showBaseStatistics(ostream &anOs) const
Show statistics of the Base offsets/index etc.
virtual Bool canAddColumn() const
The storage manager can add columns.
uInt itsFreeBucketsNr
The nr of free buckets.
Int itsFirstIdxBucket
Number of the first index bucket.
BucketFile * itsFile
The file containing all data.
Block< uInt > itsColIndexMap
Row Index ID containing all the columns in a bucket.
rownr_t getNRow() const
Get the number of rows in this storage manager.
Int itsFirstFreeBucket
The first free bucket.
void setCacheSize(uInt aCacheSize, Bool canExceedNrBuckets=True)
Set the cache size (in buckets).
virtual Bool hasMultiFileSupport() const
The data manager supports use of MultiFile.
SSMBase(const String &aDataManName, Int aBucketSize=0, uInt aCacheSize=1)
Create a Standard storage manager with the given name.
uInt getVersion() const
Get the version of the class.
virtual Record getProperties() const
Get data manager properties that can be modified.
virtual void setProperties(const Record &spec)
Modify data manager properties.
static void writeCallBack(void *anOwner, char *aBucketStorage, const char *aBucket)
uInt itsIdxBucketOffset
Offset of index in first bucket.
void removeBucket(uInt aBucketNr)
Remove a bucket from the bucket cache.
rownr_t itsNrRows
The number of rows in the columns.
void showIndexStatistics(ostream &anOs) const
Show statistics of all indices used.
SSMBase(const String &aDataManName, const Record &spec)
Create a Standard storage manager with the given name.
BucketCache & getCache()
Get the cache object.
static DataManager * makeObject(const String &aDataManType, const Record &spec)
Make the object from the type name string.
virtual String dataManagerType() const
Get the type name of the data manager (i.e.
virtual void removeRow64(rownr_t aRowNr)
Delete a row from all columns.
uInt getNrIndices() const
Get the number of indices in use.
uInt itsCacheSize
The actual cache size.
virtual DataManagerColumn * makeIndArrColumn(const String &aName, int aDataType, const String &aDataTypeID)
Create an indirect array column.
void setBucketDirty()
Make the current bucket in the cache dirty (i.e.
virtual DataManagerColumn * makeDirArrColumn(const String &aName, int aDataType, const String &aDataTypeID)
Create a direct array column.
SSMBase(Int aBucketSize=0, uInt aCacheSize=1)
Create a Standard storage manager with default name SSM.
virtual Bool flush(AipsIO &, Bool doFsync)
Flush and optionally fsync the data.
virtual Bool canAddRow() const
The storage manager can add rows.
Block< uInt > itsColumnOffset
Column offset.
virtual void reopenRW()
Reopen the storage manager files for read/write.
PtrBlock< SSMColumn * > itsPtrColumn
The assembly of all columns.
char * getBucket(uInt aBucketNr)
Read the bucket (if needed) and return the pointer to it.
virtual void showCacheStatistics(ostream &anOs) const
Show the statistics of all caches used.
virtual void deleteManager()
The data manager will be deleted (because all its columns are requested to be deleted).
void readIndexBuckets()
Read the index from its buckets.
virtual void removeColumn(DataManagerColumn *)
Remove a column from the data file.
uInt setBucketSize()
Determine and set the bucket size.
virtual Bool canRemoveRow() const
The storage manager can delete rows.
virtual rownr_t resync64(rownr_t aRowNr)
Resync the storage manager with the new file contents.
virtual String dataManagerName() const
Get the name given to the storage manager (in the constructor).
StManArrayFile * itsIosFile
The file containing the indirect arrays.
virtual Bool canRemoveColumn() const
The storage manager can delete columns.
virtual DataManagerColumn * makeScalarColumn(const String &aName, int aDataType, const String &aDataTypeID)
Create a column in the storage manager on behalf of a table column.
uInt getBucketSize() const
Get the bucket size.
SSMBase(const SSMBase &that)
Copy constructor (only meant for clone function).
void writeIndex()
Write the header and the indices.
uInt itsNrIdxBuckets
Nr of buckets needed for index.
static char * initCallBack(void *anOwner)
Bool isDataChanged
Has the data changed since the last flush?
void clearCache()
Clear the cache used by this storage manager.
virtual DataManager * clone() const
Clone this object.
SSMBase & operator=(const SSMBase &that)
Assignment cannot be used.
virtual rownr_t open64(rownr_t aRowNr, AipsIO &)
Open the storage manager file for an existing table, read in the data, and let the SSMColumn objects ...
virtual void addColumn(DataManagerColumn *)
Do the final addition of a column.
String: the storage and methods of handling collections of characters.
this file contains all the compiler specific defines
bool Bool
Define the standard types used by Casacore.
uInt64 rownr_t
Define the type of a row number in a table.