26#ifndef TABLES_ISMCOLUMN_H
27#define TABLES_ISMCOLUMN_H
30#include <casacore/casa/aips.h>
31#include <casacore/tables/DataMan/StManColumnBase.h>
32#include <casacore/tables/DataMan/ISMBase.h>
33#include <casacore/tables/Tables/RefRows.h>
34#include <casacore/casa/Arrays/IPosition.h>
35#include <casacore/casa/Arrays/Vector.h>
36#include <casacore/casa/Containers/Block.h>
37#include <casacore/casa/Utilities/Compare.h>
38#include <casacore/casa/OS/Conversion.h>
299 const char* data,
uInt lenData,
Bool afterLastRow,
Bool canSplit);
321 static size_t fromString(
void* out,
const void* in,
size_t n,
330 template <
typename T>
334 while (rownr < nrrow) {
336 for (rownr++; rownr <=
endRow_p; ++rownr) {
342 template <
typename T>
353 while (rownr <=
end) {
361 while (rownr <= endrow) {
362 *valptr++ = *cacheValue;
380 for (
rownr_t i = 0; i < nr; i++) {
382 if (rownr >= strow && rownr <= endrow) {
383 value[i] = *cacheValue;
397 template <
typename T>
400 for (
rownr_t i = 0; i < nrrow; ++i) {
407 return rownr < startRow_p || rownr >
endRow_p;
Non-templated base class for templated Array class.
size_t nelements() const
How many elements does this array have?
void freeStorage(const T *&storage, bool deleteIt) const
If deleteIt is set, delete "storage".
void putStorage(T *&storage, bool deleteAndCopy)
putStorage() is normally called after a call to getStorage() (cf).
T * getStorage(bool &deleteIt)
Generally use of this should be shunned, except to use a FORTRAN routine or something similar.
size_t ValueFunction(void *to, const void *from, size_t nvalues)
Define the signature of a function converting nvalues values from internal to external format or vice...
void getValueGeneric(rownr_t rownr, T *dataPtr)
void putValueGeneric(rownr_t rownr, const T *dataPtr)
virtual void putDComplex(rownr_t rownr, const DComplex *dataPtr)
ObjCompareFunc * compareFunc_p
Pointer to a compare function.
static size_t writeStringLE(void *out, const void *in, size_t n)
void resync(rownr_t nrrow)
Resync the storage manager with the new file contents.
IPosition shape_p
The shape of the column.
static Conversion::ValueFunction * getWriteRownr(Bool asCanonical)
virtual void getShort(rownr_t rownr, Short *dataPtr)
uInt getFixedLength() const
Get the fixed length of the data value in a cell of this column (0 = variable length).
virtual Bool compareValue(const void *val1, const void *val2) const
Compare the values.
static size_t writeStringBE(void *out, const void *in, size_t n)
virtual void putfloat(rownr_t rownr, const float *dataPtr)
virtual void putScalarColumnV(const ArrayBase &dataPtr)
Put the scalar values into the entire column.
void putValue(rownr_t rownr, const void *value)
Put the value for this row.
virtual void getArrayV(rownr_t rownr, ArrayBase &dataPtr)
Get an array value in the given row.
Conversion::ValueFunction * writeFunc_p
Pointer to a convert function for writing.
virtual void handleRemove(rownr_t rownr, const char *value)
Give a derived class the opportunity to react on the removal of a value.
ISMColumn(ISMBase *parent, int dataType, uInt colnr)
Create a ISMColumn object with the given parent.
virtual void putArrayV(rownr_t rownr, const ArrayBase &dataPtr)
Put an array value in the given row.
rownr_t lastRowPut_p
The last row for which a value has been put.
virtual void getScalarColumnCellsV(const RefRows &rownrs, ArrayBase &dataPtr)
Get the scalar values in some cells of the column.
void replaceData(ISMBucket *bucket, rownr_t bucketStartRow, rownr_t bucketNrrow, rownr_t bucketRownr, uInt &offset, const char *data, uInt lenData, Bool canSplit=True)
Replace a value at the given offset in the bucket.
virtual void putBool(rownr_t rownr, const Bool *dataPtr)
Put a scalar value in the given row.
virtual Bool flush(rownr_t nrrow, Bool fsync)
Flush and optionally fsync the data.
virtual void getScalarColumnV(ArrayBase &dataPtr)
Get the scalar values in the entire column.
virtual void putuShort(rownr_t rownr, const uShort *dataPtr)
virtual void getBool(rownr_t rownr, Bool *dataPtr)
Get a scalar value in the given row.
void getScaColCells(const RefRows &rownrs, Vector< T > &values)
virtual void putShort(rownr_t rownr, const Short *dataPtr)
static Conversion::ValueFunction * getReaduInt(Bool asCanonical)
Get the function needed to read/write a uInt and rownr from/to external format.
uInt nrelem_p
Number of elements in a value for this column.
void remove(rownr_t bucketRownr, ISMBucket *bucket, rownr_t bucketNrrow, rownr_t newNrrow)
Remove the given row in the bucket from the column.
virtual void getString(rownr_t rownr, String *dataPtr)
virtual void doCreate(ISMBucket *)
Let the column object initialize itself for a newly created table.
Bool addData(ISMBucket *bucket, rownr_t bucketStartRow, rownr_t bucketNrrow, rownr_t bucketRownr, uInt inx, const char *data, uInt lenData, Bool afterLastRow=False, Bool canSplit=True)
Add a value at the given index in the bucket.
static Conversion::ValueFunction * getReadRownr(Bool asCanonical)
static size_t fromString(void *out, const void *in, size_t n, Conversion::ValueFunction *writeLeng)
Handle a String in copying to/from external format.
virtual void getuShort(rownr_t rownr, uShort *dataPtr)
static size_t readStringLE(void *out, const void *in, size_t n)
uInt colnr_p
Column sequence number of this column.
virtual void getComplex(rownr_t rownr, Complex *dataPtr)
virtual void getdouble(rownr_t rownr, double *dataPtr)
void putData(ISMBucket *bucket, rownr_t bucketStartRow, rownr_t bucketNrrow, rownr_t bucketRownr, const char *data, uInt lenData, Bool afterLastRow, Bool canSplit)
Put a data value into the bucket.
void putScaCol(const Vector< T > &dataPtr)
virtual void getuChar(rownr_t rownr, uChar *dataPtr)
void handleSplit(ISMBucket &bucket, const Block< Bool > &duplicated)
Handle the duplicated values after a bucket split.
void init()
Initialize part of the object.
virtual void putInt(rownr_t rownr, const Int *dataPtr)
uInt nelements() const
Get the nr of elements in this data value.
void clear()
Clear the object (used by destructor and init).
void getScaCol(Vector< T > &dataPtr)
virtual IPosition shape(rownr_t rownr)
Get the shape of the array in the given row.
rownr_t startRow_p
Cache for interval for which last value read is valid.
virtual void getfloat(rownr_t rownr, float *dataPtr)
Conversion::ValueFunction * readFunc_p
Pointer to a convert function for reading.
virtual void putString(rownr_t rownr, const String *dataPtr)
virtual void getFile(rownr_t nrrow)
Let the column object initialize itself for an existing table.
static size_t toString(void *out, const void *in, size_t n, Conversion::ValueFunction *readLeng)
Bool isLastValueInvalid(rownr_t rownr)
Test if the last value is invalid for this row.
ISMBase * stmanPtr_p
Pointer to the parent storage manager.
void getValue(rownr_t rownr, void *value, Bool setCache)
Get the value for this row.
virtual void getuInt(rownr_t rownr, uInt *dataPtr)
uInt fixedLength_p
Length of column cell value in storage format (0 = variable length).
virtual void setShapeColumn(const IPosition &shape)
Set the shape of an array in the column.
static Conversion::ValueFunction * getWriteuInt(Bool asCanonical)
virtual void getInt(rownr_t rownr, Int *dataPtr)
ISMColumn & operator=(const ISMColumn &)=delete
Forbid assignment.
virtual void putInt64(rownr_t rownr, const Int64 *dataPtr)
virtual void putuChar(rownr_t rownr, const uChar *dataPtr)
virtual void reopenRW()
Let the column reopen its data files for read/write access.
void putFromRow(rownr_t rownr, const char *data, uInt lenData)
Put the value in all buckets from the given row on.
virtual void getInt64(rownr_t rownr, Int64 *dataPtr)
ISMColumn(const ISMColumn &)=delete
Forbid copy constructor.
virtual uInt ndim(rownr_t rownr)
Get the dimensionality of the item in the given row.
virtual void getDComplex(rownr_t rownr, DComplex *dataPtr)
virtual void addRow(rownr_t newNrrow, rownr_t oldNrrow)
Add (newNrrow-oldNrrow) rows to the column and initialize the new rows when needed.
static size_t readStringBE(void *out, const void *in, size_t n)
uInt typeSize_p
The size of the data type in local format.
uInt nrcopy_p
Number of values to be copied.
virtual void putdouble(rownr_t rownr, const double *dataPtr)
virtual void putuInt(rownr_t rownr, const uInt *dataPtr)
virtual void handleCopy(rownr_t rownr, const char *value)
Give a derived class the opportunity to react on the duplication of a value.
virtual void putComplex(rownr_t rownr, const Complex *dataPtr)
Class to iterate through a RefRows object.
rownr_t sliceIncr() const
Bool pastEnd() const
Is the iterator past the end?
rownr_t sliceStart() const
Get the current slice start, end, or increment.
Bool isSliced() const
Represents the vector a slice?
const Vector< rownr_t > & rowVector() const
Get the row vector as is (thus sliced if the object contains slices).
virtual int dataType() const
Return the data type of the column.
StManColumnBase(int dataType)
Default constructor.
String: the storage and methods of handling collections of characters.
For temporary backward namespace compatibility, use casa as alias for casacore.
int offset(int, int) const
compute a linear offset from array indicies
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size).
bool Bool
Define the standard types used by Casacore.
NewDelAllocator< T > NewDelAllocator< T >::value
uInt64 rownr_t
Define the type of a row number in a table.