26#ifndef TABLES_DATAMANAGER_H
27#define TABLES_DATAMANAGER_H
31#include <casacore/casa/aips.h>
32#include <casacore/tables/DataMan/DataManagerColumn.h>
33#include <casacore/tables/DataMan/TSMOption.h>
34#include <casacore/casa/Arrays/ArrayFwd.h>
35#include <casacore/casa/BasicSL/String.h>
36#include <casacore/casa/IO/ByteIO.h>
365 const String& dataTypeId);
369 const String& dataTypeId);
373 const String& dataTypeId);
427 const String& dataTypeId) = 0;
431 const String& dataTypeId) = 0;
435 const String& dataTypeId) = 0;
441 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 DataManagerColumn * makeDirArrColumn(const String &columnName, int dataType, const String &dataTypeId)=0
Create a direct array column.
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).
void setMultiFile(const std::shared_ptr< MultiFileBase > &mfile)
Tell the data manager that MultiFile can be used.
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 DataManager * clone() const =0
Make a clone of the derived object.
virtual Record getProperties() const
Get data manager properties that can be modified.
DataManager * getClone() const
Has the object already been cloned?
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)
virtual DataManagerColumn * reallocateColumn(DataManagerColumn *column)
Reallocate the column object if it is part of this data manager.
virtual Bool canRenameColumn() const
Does the data manager allow to rename columns? (default yes)
Table & table() const
Get the table this object is associated with.
virtual void removeRow64(rownr_t rownr)
Delete a row from all columns.
virtual void removeRow(uInt rownr)
std::shared_ptr< MultiFileBase > multiFile_p
void decrementNcolumn()
Decrement number of columns (in case a column is deleted).
static std::map< String, DataManagerCtor > theirRegisterMap
Declare the mapping of the data manager type name to a static "makeObject" function.
virtual Bool canReallocateColumns() const
Tell if the data manager wants to reallocate the data manager column objects.
DataManagerColumn * createIndArrColumn(const String &columnName, int dataType, const String &dataTypeId)
Create an indirect array column.
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.
static DataManager * unknownDataManager(const String &dataManagerType, const Record &spec)
Serve as default function for theirRegisterMap, which catches all unknown data manager types.
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 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....
DataManager & operator=(const DataManager &)=delete
Assignment cannot be used for this base class.
virtual void prepare()
Let the data manager initialize itself further.
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...
virtual uInt resync1(uInt nrrow)
virtual Bool isStorageManager() const
Is the data manager a storage manager? The default is yes.
DataManagerColumn * createScalarColumn(const String &columnName, int dataType, const String &dataTypeId)
Create a column in the data manager on behalf of a table column.
void setClone(DataManager *clone) const
Set the pointer to the clone.
DataManagerColumn * createDirArrColumn(const String &columnName, int dataType, const String &dataTypeId)
Create a direct 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.
const TSMOption & tsmOption() const
Get the TSM option.
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 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.
virtual DataManagerColumn * makeIndArrColumn(const String &columnName, int dataType, const String &dataTypeId)=0
Create an indirect array column.
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)
static std::recursive_mutex theirMutex
virtual void create(uInt nrrow)
std::shared_ptr< MultiFileBase > multiFile()
Get the MultiFile pointer (can be 0).
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.
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.
static std::map< String, DataManagerCtor > initRegisterMap()
Register the main data managers.
DataManager(const DataManager &)=delete
The copy constructor cannot be used for this base class.
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.
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.