28 #ifndef TABLES_DATAMANAGER_H
29 #define TABLES_DATAMANAGER_H
33 #include <casacore/casa/aips.h>
34 #include <casacore/tables/DataMan/DataManagerColumn.h>
35 #include <casacore/tables/DataMan/TSMOption.h>
36 #include <casacore/casa/Arrays/ArrayFwd.h>
37 #include <casacore/casa/BasicSL/String.h>
38 #include <casacore/casa/IO/ByteIO.h>
360 const String& dataTypeId);
364 const String& dataTypeId);
368 const String& dataTypeId);
431 const String& dataTypeId) = 0;
435 const String& dataTypeId) = 0;
439 const String& dataTypeId) = 0;
445 int dataType,
const String& dataTypeId)
const;
OpenOption
Define the possible ByteIO open options.
Abstract base class for a data manager.
virtual String dataManagerType() const =0
Return the type name of the data manager (in fact its class name).
virtual void resync(uInt nrrow)
virtual void removeColumn(DataManagerColumn *)
Delete a column.
virtual void addColumn(DataManagerColumn *)
Add a column.
virtual void showCacheStatistics(std::ostream &) const
Show the data manager's IO statistics.
void throwDataTypeOther(const String &columnName, int dataType) const
Throw an exception in case data type is TpOther, because the storage managers (and maybe other data m...
void setSeqnr(uInt nr)
Set the sequence number of this data manager.
ByteIO::OpenOption fileOption() const
Get the AipsIO option of the underlying file.
virtual rownr_t resync64(rownr_t nrrow)
Resync the data by rereading cached data from the file.
static DataManagerCtor getCtor(const String &dataManagerType)
Get the "constructor" of a data manager (thread-safe).
static std::map< String, DataManagerCtor > initRegisterMap()
Register the main data managers.
void dataManagerInfo(Record &info) const
Add SEQNR and SPEC (the DataManagerSpec subrecord) to the info.
void setEndian(Bool bigEndian)
Tell the data manager if big or little endian format is needed.
virtual Record getProperties() const
Get data manager properties that can be modified.
virtual void deleteManager()=0
The data manager will be deleted (because all its columns are requested to be deleted).
virtual Bool hasMultiFileSupport() const
Does the data manager support use of MultiFile? A derived class has to return True if it can use the ...
virtual Bool canRemoveRow() const
Does the data manager allow to delete rows? (default no)
virtual void create64(rownr_t nrrow)
Let the data manager initialize itself for a new table.
virtual Bool canRemoveColumn() const
Does the data manager allow to delete columns? (default no)
DataManager(const DataManager &)
The copy constructor cannot be used for this base class.
DataManagerColumn * createScalarColumn(const String &columnName, int dataType, const String &dataTypeId)
Create a column in the data manager on behalf of a table column.
virtual Bool canRenameColumn() const
Does the data manager allow to rename columns? (default yes)
DataManagerColumn * createIndArrColumn(const String &columnName, int dataType, const String &dataTypeId)
Create an indirect array column.
virtual void removeRow64(rownr_t rownr)
Delete a row from all columns.
virtual void removeRow(uInt rownr)
void decrementNcolumn()
Decrement number of columns (in case a column is deleted).
Table & table() const
Get the table this object is associated with.
static std::map< String, DataManagerCtor > theirRegisterMap
Declare the mapping of the data manager type name to a static "makeObject" function.
DataManager & operator=(const DataManager &)
Assignment cannot be used for this base class.
virtual Bool canReallocateColumns() const
Tell if the data manager wants to reallocate the data manager column objects.
uInt ncolumn() const
Get the nr of columns in this data manager (can be zero).
virtual void reopenRW()
Reopen the data manager for read/write access.
virtual Bool canAddColumn() const
Does the data manager allow to add columns? (default no)
virtual void addRow64(rownr_t nrrow)
Add rows to all columns.
virtual DataManagerColumn * makeScalarColumn(const String &columnName, int dataType, const String &dataTypeId)=0
Create a column in the data manager on behalf of a table column.
virtual Record dataManagerSpec() const
Return a record containing data manager specifications.
String keywordName(const String &keyword) const
Compose a keyword name from the given keyword appended with the sequence number (e....
virtual void prepare()
Let the data manager initialize itself further.
static DataManager * unknownDataManager(const String &dataManagerType, const Record &spec)
Serve as default function for theirRegisterMap, which catches all unknown data manager types.
virtual void addRow(uInt nrrow)
Backward compatibility function using uInt instead of rownr_t.
DataManager()
Default constructor.
virtual void setProperties(const Record &spec)
Modify data manager properties given in record fields.
virtual Bool isRegular() const
Is this a regular storage manager? It is regular if it allows addition of rows and writing data in th...
DataManager * getClone() const
Has the object already been cloned?
virtual uInt resync1(uInt nrrow)
virtual Bool isStorageManager() const
Is the data manager a storage manager? The default is yes.
void setClone(DataManager *clone) const
Set the pointer to the clone.
MultiFileBase * multiFile_p
virtual DataManagerColumn * makeIndArrColumn(const String &columnName, int dataType, const String &dataTypeId)=0
Create an indirect array column.
Bool asBigEndian() const
Have the data to be stored in big or little endian canonical format?
virtual rownr_t open64(rownr_t nrrow, AipsIO &ios)
Let the data manager initialize itself for an existing table.
virtual DataManagerColumn * makeDirArrColumn(const String &columnName, int dataType, const String &dataTypeId)=0
Create a direct array column.
virtual String dataManagerName() const
Return the name of the data manager.
void checkDataType(const DataManagerColumn *colPtr, const String &columnName, int dataType, const String &dataTypeId) const
Check if the data type of the created data manager column is correct.
virtual uInt open1(uInt nrrow, AipsIO &ios)
virtual DataManager * clone() const =0
Make a clone of the derived object.
DataManagerColumn * createDirArrColumn(const String &columnName, int dataType, const String &dataTypeId)
Create a direct array column.
MultiFileBase * multiFile()
Get the MultiFile pointer (can be 0).
virtual void setMaximumCacheSize(uInt nMiB)
Set the maximum cache size (in bytes) to be used by a storage manager.
void linkToTable(Table &tab)
Link the data manager to the Table object.
const TSMOption & tsmOption() const
Get the TSM option.
virtual Bool canAddRow() const
Does the data manager allow to add rows? (default no)
static Bool isRegistered(const String &dataManagerType)
Test if a data manager is registered (thread-safe).
static void registerCtor(const String &type, DataManagerCtor func)
Register a mapping of a data manager type to its static construction function.
virtual void open(uInt nrrow, AipsIO &ios)
virtual DataManagerColumn * reallocateColumn(DataManagerColumn *column)
Reallocate the column object if it is part of this data manager.
static std::recursive_mutex theirMutex
virtual void create(uInt nrrow)
virtual Bool flush(AipsIO &ios, Bool fsync)=0
Flush and optionally fsync the data.
uInt sequenceNr() const
Get the (unique) sequence nr of this data manager.
void setTsmOption(const TSMOption &tsmOption)
Tell the data manager which TSM option to use.
void setMultiFile(MultiFileBase *mfile)
Tell the data manager that MultiFile can be used.
static rownr_t MAXROWNR32
Define the highest row number that can be represented as signed 32-bit.
String fileName() const
Compose a unique filename from the table name and sequence number.
Abstract base class to combine multiple files in a single one.
Create a new table - define shapes, data managers, etc.
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.