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