Go to the documentation of this file.
28 #ifndef TABLES_DATAMANAGER_H
29 #define TABLES_DATAMANAGER_H
33 #include <casacore/casa/aips.h>
34 #include <casacore/tables/Tables/ColumnCache.h>
35 #include <casacore/tables/DataMan/TSMOption.h>
36 #include <casacore/casa/BasicSL/String.h>
37 #include <casacore/casa/BasicSL/Complex.h>
38 #include <casacore/casa/Utilities/CountedPtr.h>
39 #include <casacore/casa/IO/ByteIO.h>
40 #include <casacore/casa/OS/Mutex.h>
48 class DataManagerColumn;
57 template<
class T>
class Array;
364 const String& dataTypeId);
368 const String& dataTypeId);
372 const String& dataTypeId);
435 const String& dataTypeId) = 0;
439 const String& dataTypeId) = 0;
443 const String& dataTypeId) = 0;
449 int dataType,
const String& dataTypeId)
const;
868 const void* dataPtr);
936 const void* dataPtr);
953 const void* dataPtr);
978 const Slicer& slicer,
void* dataPtr);
988 const void* dataPtr);
static void registerCtor(const String &type, DataManagerCtor func)
Register a mapping of a data manager type to its static construction function.
virtual void getOtherV(uInt rownr, void *dataPtr)
This function is the get for all non-standard data types.
virtual Bool canReallocateColumns() const
Tell if the data manager wants to reallocate the data manager column objects.
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...
static DataManager * unknownDataManager(const String &dataManagerType, const Record &spec)
Serve as default function for theirRegisterMap, which catches all unknown data manager types.
Specify which elements to extract from an n-dimensional array.
static std::map< String, DataManagerCtor > theirRegisterMap
Declare the mapping of the data manager type name to a static "makeObject" function.
static std::map< String, DataManagerCtor > initRegisterMap()
Register the main data managers.
String keywordName(const String &keyword) const
Compose a keyword name from the given keyword appended with the sequence number (e....
virtual void setMaxLength(uInt maxLength)
Set the maximum length of the value (can be used for strings).
void put(uInt rownr, const uInt *dataPtr)
A Vector of integers, for indexing into Array<T> objects.
void setMultiFile(MultiFileBase *mfile)
Tell the data manager that MultiFile can be used.
void decrementNcolumn()
Decrement number of columns (in case a column is deleted).
void get(uInt rownr, Short *dataPtr)
virtual void getuShortV(uInt rownr, uShort *dataPtr)
virtual Bool flush(AipsIO &ios, Bool fsync)=0
Flush and optionally fsync the data.
ColumnCache & columnCache()
Get access to the ColumnCache object.
virtual uInt open1(uInt nrrow, AipsIO &ios)
Open as above.
virtual Bool canRenameColumn() const
Does the data manager allow to rename columns? (default yes)
AipsIO is the object persistency mechanism of Casacore
Abstract base class for a data manager.
virtual void removeRow(uInt rownr)
Delete a row from all columns.
OpenOption
Define the possible ByteIO open options.
virtual void putuCharV(uInt rownr, const uChar *dataPtr)
virtual void setShapeColumn(const IPosition &shape)
Set the shape of all (fixed-shaped) arrays in the column.
virtual void putArrayV(uInt rownr, const void *dataPtr)
Put the array value into the given row.
void put(uInt rownr, const Bool *dataPtr)
Put the scalar value into the given row.
virtual void getArrayColumnV(void *dataPtr)
Get all array values in the column.
std::complex< Double > DComplex
virtual IPosition tileShape(uInt rownr)
Get the tile shape of the item in the given row.
virtual void setShape(uInt rownr, const IPosition &shape)
Set the shape of an (variable-shaped) array in the given row.
static DataManagerCtor getCtor(const String &dataManagerType)
Get the "constructor" of a data manager (thread-safe).
void getSliceBase(uInt rownr, const Slicer &slicer, ArrayBase &data)
virtual void putArrayColumnCellsV(const RefRows &rownrs, const void *dataPtr)
Put some array values in the column.
virtual Record getProperties() const
Get data manager properties that can be modified.
virtual void putSliceV(uInt rownr, const Slicer &slicer, const void *dataPtr)
Put into a section of the array in the given row.
virtual Bool isRegular() const
Is this a regular storage manager? It is regular if it allows addition of rows and writing data in th...
void put(uInt rownr, const Complex *dataPtr)
Referenced counted pointer for constant data.
void get(uInt rownr, float *dataPtr)
virtual void setMaximumCacheSize(uInt nbytes)
Set the maximum cache size (in bytes) to be used by a storage manager.
virtual void showCacheStatistics(std::ostream &) const
Show the data manager's IO statistics.
virtual Bool canAddColumn() const
Does the data manager allow to add columns? (default no)
void getScalarColumnBase(ArrayBase &dataPtr)
The default implementations of get and put functions.
Non-templated base class for templated Array class.
DataManagerColumn()
Create a column.
virtual void open(uInt nrrow, AipsIO &ios)=0
Let the data manager initialize itself for an existing table.
virtual void addRow(uInt nrrow)
Add rows to all columns.
void get(uInt rownr, Bool *dataPtr)
Get the scalar value in the given row.
virtual void reopenRW()
Reopen the data manager for read/write access.
virtual Bool canRemoveColumn() const
Does the data manager allow to delete columns? (default no)
virtual Bool canAccessScalarColumn(Bool &reask) const
Can the column data manager handle access to a scalar column? If not, the caller should access the co...
void get(uInt rownr, DComplex *dataPtr)
virtual void getComplexV(uInt rownr, Complex *dataPtr)
uInt ncolumn() const
Get the nr of columns in this data manager (can be zero).
void throwGet() const
Throw an "invalid operation" exception for the default implementation of get.
Abstract base class for a column in a data manager.
DataManagerColumn * createIndArrColumn(const String &columnName, int dataType, const String &dataTypeId)
Create an indirect array column.
virtual String dataTypeId() const
Get the data type id of the column for dataType==TpOther.
virtual void deleteManager()=0
The data manager will be deleted (because all its columns are requested to be deleted).
uInt sequenceNr() const
Get the (unique) sequence nr of this data manager.
virtual void putInt64V(uInt rownr, const Int64 *dataPtr)
virtual Bool canRemoveRow() const
Does the data manager allow to delete rows? (default no)
virtual ~DataManagerColumn()
Frees up the storage.
virtual void putScalarColumnCellsV(const RefRows &rownrs, const void *dataPtr)
Put some scalar values in the column.
void get(uInt rownr, uChar *dataPtr)
void put(uInt rownr, const Short *dataPtr)
virtual void putBoolV(uInt rownr, const Bool *dataPtr)
Put the scalar value into the given row.
void getArrayColumnCellsBase(const RefRows &rownrs, ArrayBase &data)
virtual void putdoubleV(uInt rownr, const double *dataPtr)
MultiFileBase * multiFile()
Get the MultiFile pointer (can be 0).
virtual void getArrayV(uInt rownr, void *dataPtr)
Get the array value in the given row.
void dataManagerInfo(Record &info) const
Add SEQNR and SPEC (the DataManagerSpec subrecord) to the info.
void put(uInt rownr, const DComplex *dataPtr)
virtual void putuShortV(uInt rownr, const uShort *dataPtr)
Class to manage a set of table columns.
void put(uInt rownr, const uChar *dataPtr)
const ColumnCache * columnCachePtr() const
virtual void putArrayColumnV(const void *dataPtr)
Put all array values in the column.
virtual void getArrayColumnCellsV(const RefRows &rownrs, void *dataPtr)
Get some array values in the column.
virtual void putComplexV(uInt rownr, const Complex *dataPtr)
static Bool isRegistered(const String &dataManagerType)
Test if a data manager is registered (thread-safe).
virtual void putColumnSliceV(const Slicer &slicer, const void *dataPtr)
Put into a section of all arrays in the column.
const String & columnName() const
Get rhe column name.
virtual void getuCharV(uInt rownr, uChar *dataPtr)
virtual Bool canAccessSlice(Bool &reask) const
Can the column data manager handle access to a cell slice? If not, the caller should do slicing itsel...
void put(uInt rownr, const Int *dataPtr)
virtual void putShortV(uInt rownr, const Short *dataPtr)
Bool asBigEndian() const
Have the data to be stored in big or little endian canonical format?
Main interface class to a read/write table.
void putArrayColumnBase(const ArrayBase &data)
Table & table() const
Get the table this object is associated with.
virtual uInt ndim(uInt rownr)
Get the dimensionality of the item in the given row.
Class holding the row numbers in a RefTable.
void put(uInt rownr, const String *dataPtr)
virtual void putfloatV(uInt rownr, const float *dataPtr)
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.
void put(uInt rownr, const double *dataPtr)
virtual Bool canAccessScalarColumnCells(Bool &reask) const
Can the column data manager handle access to a clooection of cells in a scalar column?...
virtual void resync(uInt nrrow)=0
Resync the data by rereading cached data from the file.
DataManager * getClone() const
Has the object already been cloned?
void putArrayColumnCellsBase(const RefRows &rownrs, const ArrayBase &data)
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.
Abstract base class to combine multiple files in a single one.
virtual void putStringV(uInt rownr, const String *dataPtr)
void putSliceArr(uInt row, const Slicer §ion, CountedPtr< ArrayBase > &fullArr, const ArrayBase &arr)
Put a slice into the array in the given row.
virtual void setProperties(const Record &spec)
Modify data manager properties given in record fields.
virtual void putBlockV(uInt rownr, uInt nrmax, const void *dataPtr)
Put nrmax scalars from the given row on.
void putColumnSliceCellsBase(const RefRows &rownrs, const Slicer &slicer, const ArrayBase &data)
virtual void prepare()
Let the data manager initialize itself further.
DataManager & operator=(const DataManager &)
Assignment cannot be used for this base class.
virtual void getuIntV(uInt rownr, uInt *dataPtr)
void setIsFixedShape(Bool isFixedShape)
Set the isFixedShape flag.
virtual void getScalarColumnV(void *dataPtr)
Get all scalar values in the column.
void get(uInt rownr, Complex *dataPtr)
Create a new table - define shapes, data managers, etc.
void putScalarColumnCellsBase(const RefRows &rownrs, const ArrayBase &dataPtr)
ByteIO::OpenOption fileOption() const
Get the AipsIO option of the underlying file.
void linkToTable(Table &tab)
Link the data manager to the Table object.
virtual IPosition shape(uInt rownr)
Get the shape of the item in the given row.
void getScalarColumnCellsBase(const RefRows &rownrs, ArrayBase &dataPtr)
virtual void putuIntV(uInt rownr, const uInt *dataPtr)
virtual void getSliceV(uInt rownr, const Slicer &slicer, void *dataPtr)
Get a section of the array in the given row.
virtual void getColumnSliceV(const Slicer &slicer, void *dataPtr)
Get a section of all arrays in the column.
virtual void getIntV(uInt rownr, Int *dataPtr)
virtual void putDComplexV(uInt rownr, const DComplex *dataPtr)
virtual void getBoolV(uInt rownr, Bool *dataPtr)
Get the scalar value in the given row.
virtual void putScalarColumnV(const void *dataPtr)
Put all scalar values in the column.
virtual Bool isStorageManager() const
Is the data manager a storage manager? The default is yes.
DataManagerColumn & operator=(const DataManagerColumn &)
Assignment cannot be used for this base class.
virtual DataManagerColumn * makeIndArrColumn(const String &columnName, int dataType, const String &dataTypeId)=0
Create an indirect array column.
this file contains all the compiler specific defines
void setTsmOption(const TSMOption &tsmOption)
Tell the data manager which TSM option to use.
virtual void getfloatV(uInt rownr, float *dataPtr)
virtual void getInt64V(uInt rownr, Int64 *dataPtr)
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 DataManagerColumn * makeDirArrColumn(const String &columnName, int dataType, const String &dataTypeId)=0
Create a direct array column.
virtual void create(uInt nrrow)=0
Let the data manager initialize itself for a new table.
void setClone(DataManager *clone) const
Set the pointer to the clone.
DataManager()
Default constructor.
virtual void removeColumn(DataManagerColumn *)
Delete a column.
virtual Bool canAccessArrayColumn(Bool &reask) const
Can the column data manager handle access to a scalar column? If not, the caller should access the co...
virtual Bool canAccessArrayColumnCells(Bool &reask) const
Can the column data manager handle access to a collection of cells in an array column?...
virtual String dataManagerType() const =0
Return the type name of the data manager (in fact its class name).
virtual DataManager * clone() const =0
Make a clone of the derived object.
void setFixedShapeColumn(const IPosition &shape)
Set the shape of all (fixed-shaped) arrays in the column.
void put(uInt rownr, const uShort *dataPtr)
virtual void addColumn(DataManagerColumn *)
Add a column.
virtual Bool isWritable() const
Test if data can be put into this column.
virtual DataManagerColumn * reallocateColumn(DataManagerColumn *column)
Reallocate the column object if it is part of this data manager.
virtual Bool canAccessColumnSlice(Bool &reask) const
Can the column data manager handle access to a column slice? If not, the caller should access the col...
void put(uInt rownr, const Int64 *dataPtr)
virtual Bool isShapeDefined(uInt rownr)
Is the value shape defined in the given row? By default it returns True.
Options for the Tiled Storage Manager Access.
virtual uInt resync1(uInt nrrow)
Resync as above.
virtual uInt getBlockV(uInt rownr, uInt nrmax, void *dataPtr)
Get scalars from the given row on with a maximum of nrmax values.
void get(uInt rownr, void *dataPtr)
This function is the get for all non-standard data types.
A caching object for a table column.
virtual void getDComplexV(uInt rownr, DComplex *dataPtr)
virtual void getScalarColumnCellsV(const RefRows &rownrs, void *dataPtr)
Get some scalar values in the column.
String fileName() const
Compose a unique filename from the table name and sequence number.
void get(uInt rownr, uInt *dataPtr)
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
void setColumnName(const String &colName)
Set the column name.
void get(uInt rownr, uShort *dataPtr)
virtual int dataType() const =0
Get the data type of the column as defined in DataType.h.
virtual void setShapeTiled(uInt rownr, const IPosition &shape, const IPosition &tileShape)
Set the shape and tile shape of an (variable-shaped) array in the given row.
void putSliceBase(uInt rownr, const Slicer &slicer, const ArrayBase &data)
virtual void getShortV(uInt rownr, Short *dataPtr)
void getColumnSliceCellsBase(const RefRows &rownrs, const Slicer &slicer, ArrayBase &data)
void get(uInt rownr, Int64 *dataPtr)
virtual Record dataManagerSpec() const
Return a record containing data manager specifications.
void getColumnSliceBase(const Slicer &slicer, ArrayBase &data)
void put(uInt rownr, const float *dataPtr)
Bool isFixedShape() const
Is this a fixed shape column?
String: the storage and methods of handling collections of characters.
virtual void getColumnSliceCellsV(const RefRows &rownrs, const Slicer &slicer, void *dataPtr)
Get a section of some arrays in the column.
Wrapper around a pthreads mutex.
bool Bool
Define the standard types used by Casacore.
void getArrayColumnBase(ArrayBase &data)
std::complex< Float > Complex
virtual Bool canAddRow() const
Does the data manager allow to add rows? (default no)
virtual void putOtherV(uInt rownr, const void *dataPtr)
This function is the put for all non-standard data types.
A hierarchical collection of named fields of various types.
void getSliceArr(uInt row, const Slicer §ion, CountedPtr< ArrayBase > &fullArr, ArrayBase &arr)
Get a slice from the array in the given row.
void setEndian(Bool bigEndian)
Tell the data manager if big or little endian format is needed.
DataManagerColumn * createDirArrColumn(const String &columnName, int dataType, const String &dataTypeId)
Create a direct array column.
DataManagerColumn * createScalarColumn(const String &columnName, int dataType, const String &dataTypeId)
Create a column in the data manager on behalf of a table column.
void putScalarColumnBase(const ArrayBase &dataPtr)
void putColumnSliceBase(const Slicer &slicer, const ArrayBase &data)
Define the type of the static construction function.
virtual void getStringV(uInt rownr, String *dataPtr)
virtual void putIntV(uInt rownr, const Int *dataPtr)
void get(uInt rownr, double *dataPtr)
virtual void getdoubleV(uInt rownr, double *dataPtr)
MultiFileBase * multiFile_p
virtual void putColumnSliceCellsV(const RefRows &rownrs, const Slicer &slicer, const void *dataPtr)
Put into a section of some arrays in the column.
virtual Bool canChangeShape() const
Can the data manager handle chaging the shape of an existing array? Default is no.
void throwPut() const
Throw an "invalid operation" exception for the default implementation of put.
void put(uInt rownr, const void *dataPtr)
This function is the put for all non-standard data types.
void get(uInt rownr, Int *dataPtr)
virtual String dataManagerName() const
Return the name of the data manager.
void get(uInt rownr, String *dataPtr)
void setSeqnr(uInt nr)
Set the sequence number of this data manager.
const TSMOption & tsmOption() const
Get the TSM option.