casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::ISMIndColumn Class Reference

A column of Incremental storage manager for indirect arrays. More...

#include <ISMIndColumn.h>

Inheritance diagram for casacore::ISMIndColumn:
casacore::ISMColumn casacore::StManColumnBase casacore::DataManagerColumn

Public Member Functions

 ISMIndColumn (ISMBase *parent, int dataType, uInt colnr)
 Create a column of the given data type. More...
 
virtual ~ISMIndColumn ()
 Frees up the storage. More...
 
virtual void addRow (rownr_t newNrrow, rownr_t oldNrrow)
 Add (newNrrow-oldNrrow) rows to the column. More...
 
virtual void setShapeColumn (const IPosition &shape)
 Set the (fixed) shape of the arrays in the entire column. More...
 
virtual uInt ndim (rownr_t rownr)
 Get the dimensionality of the item in the given row. More...
 
virtual void setShape (rownr_t rownr, const IPosition &shape)
 Set the shape of the array in the given row and allocate the array in the file. More...
 
virtual Bool isShapeDefined (rownr_t rownr)
 Is the shape defined (i.e. More...
 
virtual IPosition shape (rownr_t rownr)
 Get the shape of the array in the given row. More...
 
virtual Bool canChangeShape () const
 This storage manager can handle changing array shapes. More...
 
virtual void getArrayV (rownr_t rownr, ArrayBase &)
 Get an array value in the given row. More...
 
virtual void putArrayV (rownr_t rownr, const ArrayBase &)
 Put an array value into the given row. More...
 
virtual void getSliceV (rownr_t rownr, const Slicer &, ArrayBase &)
 Get a section of the array in the given row. More...
 
virtual void putSliceV (rownr_t rownr, const Slicer &, const ArrayBase &)
 Put into a section of the array in the given row. More...
 
virtual void doCreate (ISMBucket *bucket)
 Let the column object create its array file. More...
 
virtual void getFile (rownr_t nrrow)
 Let the column object open an existing file. More...
 
virtual Bool flush (rownr_t nrrow, Bool fsync)
 Flush and optionally fsync the data. More...
 
virtual void resync (rownr_t nrrow)
 Resync the storage manager with the new file contents. More...
 
virtual void reopenRW ()
 Let the column reopen its data files for read/write access. More...
 
virtual void handleCopy (rownr_t rownr, const char *value)
 Handle the duplication of a value; i.e. More...
 
virtual void handleRemove (rownr_t rownr, const char *value)
 Handle the removal of a value; i.e. More...
 
- Public Member Functions inherited from casacore::ISMColumn
 ISMColumn (ISMBase *parent, int dataType, uInt colnr)
 Create a ISMColumn object with the given parent. More...
 
 ~ISMColumn ()
 
void resync (rownr_t nrrow)
 Resync the storage manager with the new file contents. More...
 
virtual void getBool (rownr_t rownr, Bool *dataPtr)
 Get a scalar value in the given row. More...
 
virtual void getuChar (rownr_t rownr, uChar *dataPtr)
 
virtual void getShort (rownr_t rownr, Short *dataPtr)
 
virtual void getuShort (rownr_t rownr, uShort *dataPtr)
 
virtual void getInt (rownr_t rownr, Int *dataPtr)
 
virtual void getuInt (rownr_t rownr, uInt *dataPtr)
 
virtual void getInt64 (rownr_t rownr, Int64 *dataPtr)
 
virtual void getfloat (rownr_t rownr, float *dataPtr)
 
virtual void getdouble (rownr_t rownr, double *dataPtr)
 
virtual void getComplex (rownr_t rownr, Complex *dataPtr)
 
virtual void getDComplex (rownr_t rownr, DComplex *dataPtr)
 
virtual void getString (rownr_t rownr, String *dataPtr)
 
virtual void putBool (rownr_t rownr, const Bool *dataPtr)
 Put a scalar value in the given row. More...
 
virtual void putuChar (rownr_t rownr, const uChar *dataPtr)
 
virtual void putShort (rownr_t rownr, const Short *dataPtr)
 
virtual void putuShort (rownr_t rownr, const uShort *dataPtr)
 
virtual void putInt (rownr_t rownr, const Int *dataPtr)
 
virtual void putuInt (rownr_t rownr, const uInt *dataPtr)
 
virtual void putInt64 (rownr_t rownr, const Int64 *dataPtr)
 
virtual void putfloat (rownr_t rownr, const float *dataPtr)
 
virtual void putdouble (rownr_t rownr, const double *dataPtr)
 
virtual void putComplex (rownr_t rownr, const Complex *dataPtr)
 
virtual void putDComplex (rownr_t rownr, const DComplex *dataPtr)
 
virtual void putString (rownr_t rownr, const String *dataPtr)
 
virtual void getScalarColumnV (ArrayBase &dataPtr)
 Get the scalar values in the entire column. More...
 
virtual void putScalarColumnV (const ArrayBase &dataPtr)
 Put the scalar values into the entire column. More...
 
virtual void getScalarColumnCellsV (const RefRows &rownrs, ArrayBase &dataPtr)
 Get the scalar values in some cells of the column. More...
 
void remove (rownr_t bucketRownr, ISMBucket *bucket, rownr_t bucketNrrow, rownr_t newNrrow)
 Remove the given row in the bucket from the column. More...
 
uInt getFixedLength () const
 Get the fixed length of the data value in a cell of this column (0 = variable length). More...
 
uInt nelements () const
 Get the nr of elements in this data value. More...
 
- Public Member Functions inherited from casacore::StManColumnBase
 StManColumnBase (int dataType)
 Default constructor. More...
 
 ~StManColumnBase ()
 
virtual int dataType () const
 Return the data type of the column. More...
 
DataType dtype () const
 
Int elemSize () const
 Return the size of an element of the column's data type. More...
 
- Public Member Functions inherited from casacore::DataManagerColumn
 DataManagerColumn ()
 Create a column. More...
 
virtual ~DataManagerColumn ()
 Frees up the storage. More...
 
void setIsFixedShape (Bool isFixedShape)
 Set the isFixedShape flag. More...
 
Bool isFixedShape () const
 Is this a fixed shape column? More...
 
virtual String dataTypeId () const
 Get the data type id of the column for dataType==TpOther. More...
 
virtual Bool isWritable () const
 Test if data can be put into this column. More...
 
virtual void setMaxLength (uInt maxLength)
 Set the maximum length of the value (can be used for strings). More...
 
void setFixedShapeColumn (const IPosition &shape)
 Set the shape of all (fixed-shaped) arrays in the column. More...
 
virtual void setShapeTiled (rownr_t rownr, const IPosition &shape, const IPosition &tileShape)
 Set the shape and tile shape of an (variable-shaped) array in the given row. More...
 
virtual IPosition tileShape (rownr_t rownr)
 Get the tile shape of the item in the given row. More...
 
ColumnCachecolumnCache ()
 Get access to the ColumnCache object. More...
 
const ColumnCachecolumnCachePtr () const
 
void get (rownr_t rownr, Bool *dataPtr)
 Get the scalar value in the given row. More...
 
void get (rownr_t rownr, uChar *dataPtr)
 
void get (rownr_t rownr, Short *dataPtr)
 
void get (rownr_t rownr, uShort *dataPtr)
 
void get (rownr_t rownr, Int *dataPtr)
 
void get (rownr_t rownr, uInt *dataPtr)
 
void get (rownr_t rownr, Int64 *dataPtr)
 
void get (rownr_t rownr, float *dataPtr)
 
void get (rownr_t rownr, double *dataPtr)
 
void get (rownr_t rownr, Complex *dataPtr)
 
void get (rownr_t rownr, DComplex *dataPtr)
 
void get (rownr_t rownr, String *dataPtr)
 
void get (rownr_t rownr, void *dataPtr)
 This function is the get for all non-standard data types. More...
 
void put (rownr_t rownr, const Bool *dataPtr)
 Put the scalar value into the given row. More...
 
void put (rownr_t rownr, const uChar *dataPtr)
 
void put (rownr_t rownr, const Short *dataPtr)
 
void put (rownr_t rownr, const uShort *dataPtr)
 
void put (rownr_t rownr, const Int *dataPtr)
 
void put (rownr_t rownr, const uInt *dataPtr)
 
void put (rownr_t rownr, const Int64 *dataPtr)
 
void put (rownr_t rownr, const float *dataPtr)
 
void put (rownr_t rownr, const double *dataPtr)
 
void put (rownr_t rownr, const Complex *dataPtr)
 
void put (rownr_t rownr, const DComplex *dataPtr)
 
void put (rownr_t rownr, const String *dataPtr)
 
void put (rownr_t rownr, const void *dataPtr)
 This function is the put for all non-standard data types. More...
 
virtual void putScalarColumnCellsV (const RefRows &rownrs, const ArrayBase &dataPtr)
 Put some scalar values in the column. More...
 
virtual void getArrayColumnV (ArrayBase &data)
 Get all array values in the column. More...
 
virtual void putArrayColumnV (const ArrayBase &data)
 Put all array values in the column. More...
 
virtual void getArrayColumnCellsV (const RefRows &rownrs, ArrayBase &data)
 Get some array values in the column. More...
 
virtual void putArrayColumnCellsV (const RefRows &rownrs, const ArrayBase &data)
 Put some array values in the column. More...
 
virtual void getColumnSliceV (const Slicer &slicer, ArrayBase &data)
 Get a section of all arrays in the column. More...
 
virtual void putColumnSliceV (const Slicer &slicer, const ArrayBase &data)
 Put into a section of all arrays in the column. More...
 
virtual void getColumnSliceCellsV (const RefRows &rownrs, const Slicer &slicer, ArrayBase &data)
 Get a section of some arrays in the column. More...
 
virtual void putColumnSliceCellsV (const RefRows &rownrs, const Slicer &slicer, const ArrayBase &data)
 Put into a section of some arrays in the column. More...
 
void throwGet () const
 Throw an "invalid operation" exception for the default implementation of get. More...
 
void throwPut () const
 Throw an "invalid operation" exception for the default implementation of put. More...
 
void setColumnName (const String &colName)
 Set the column name. More...
 
const StringcolumnName () const
 Get rhe column name. More...
 

Private Member Functions

 ISMIndColumn (const ISMIndColumn &)
 Forbid copy constructor. More...
 
ISMIndColumnoperator= (const ISMIndColumn &)
 Forbid assignment. More...
 
void init (ByteIO::OpenOption fileOption)
 Initialize part of the object and open/create the file. More...
 
void clear ()
 Clear the object (used by destructor and init). More...
 
virtual Bool compareValue (const void *val1, const void *val2) const
 Compare the values to check if a value to be put matches the value in the previous or next row. More...
 
StIndArraygetShape (rownr_t rownr)
 Read the shape at the given row. More...
 
StIndArrayputShape (rownr_t rownr, const IPosition &shape)
 Put the shape for an array being put. More...
 
StIndArrayputShapeSliced (rownr_t rownr)
 Put the shape for an array of which a slice is being put. More...
 
StIndArraygetArrayPtr (rownr_t rownr)
 Return a pointer to the array in the given row (for a get). More...
 
StIndArrayputArrayPtr (rownr_t rownr, const IPosition &shape, Bool copyData)
 When needed, create an array in the given row with the given shape. More...
 

Private Attributes

uInt seqnr_p
 The (unique) sequence number of the column. More...
 
IPosition fixedShape_p
 The shape of all arrays in case it is fixed. More...
 
Bool shapeIsFixed_p
 Switch indicating if the shape is fixed. More...
 
StManArrayFileiosfile_p
 The file containing the arrays. More...
 
StIndArray indArray_p
 The indirect array object. More...
 
Bool foundArray_p
 The indirect array exists for the row interval last accessed. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from casacore::ISMColumn
static Conversion::ValueFunctiongetReaduInt (Bool asCanonical)
 Get the function needed to read/write a uInt and rownr from/to external format. More...
 
static Conversion::ValueFunctiongetReadRownr (Bool asCanonical)
 
static Conversion::ValueFunctiongetWriteuInt (Bool asCanonical)
 
static Conversion::ValueFunctiongetWriteRownr (Bool asCanonical)
 
- Static Public Member Functions inherited from casacore::StManColumnBase
static Bool isNativeDataType (int dtype)
 Test if the given data type is supported by storage managers. More...
 
- Protected Member Functions inherited from casacore::ISMColumn
Bool isLastValueInvalid (rownr_t rownr)
 Test if the last value is invalid for this row. More...
 
void getValue (rownr_t rownr, void *value, Bool setCache)
 Get the value for this row. More...
 
void putValue (rownr_t rownr, const void *value)
 Put the value for this row. More...
 
- Protected Member Functions inherited from casacore::DataManagerColumn
virtual void getOther (rownr_t rownr, void *dataPtr)
 This function is the get for all non-standard data types. More...
 
virtual void putOther (rownr_t rownr, const void *dataPtr)
 This function is the put for all non-standard data types. More...
 
void getScalarColumnBase (ArrayBase &dataPtr)
 The default implementations of get and put functions. More...
 
void putScalarColumnBase (const ArrayBase &dataPtr)
 
void getScalarColumnCellsBase (const RefRows &rownrs, ArrayBase &dataPtr)
 
void putScalarColumnCellsBase (const RefRows &rownrs, const ArrayBase &dataPtr)
 
void getArrayColumnBase (ArrayBase &data)
 
void putArrayColumnBase (const ArrayBase &data)
 
void getArrayColumnCellsBase (const RefRows &rownrs, ArrayBase &data)
 
void putArrayColumnCellsBase (const RefRows &rownrs, const ArrayBase &data)
 
void getSliceBase (rownr_t rownr, const Slicer &slicer, ArrayBase &data)
 
void putSliceBase (rownr_t rownr, const Slicer &slicer, const ArrayBase &data)
 
void getColumnSliceBase (const Slicer &slicer, ArrayBase &data)
 
void putColumnSliceBase (const Slicer &slicer, const ArrayBase &data)
 
void getColumnSliceCellsBase (const RefRows &rownrs, const Slicer &slicer, ArrayBase &data)
 
void putColumnSliceCellsBase (const RefRows &rownrs, const Slicer &slicer, const ArrayBase &data)
 
- Protected Attributes inherited from casacore::ISMColumn
ISMBasestmanPtr_p
 Pointer to the parent storage manager. More...
 
uInt fixedLength_p
 Length of column cell value in storage format (0 = variable length). More...
 
uInt colnr_p
 Column sequence number of this column. More...
 
IPosition shape_p
 The shape of the column. More...
 
uInt nrelem_p
 Number of elements in a value for this column. More...
 
uInt nrcopy_p
 Number of values to be copied. More...
 
rownr_t startRow_p
 Cache for interval for which last value read is valid. More...
 
rownr_t endRow_p
 
void * lastValue_p
 
rownr_t lastRowPut_p
 The last row for which a value has been put. More...
 
uInt typeSize_p
 The size of the data type in local format. More...
 
Conversion::ValueFunctionwriteFunc_p
 Pointer to a convert function for writing. More...
 
Conversion::ValueFunctionreadFunc_p
 Pointer to a convert function for reading. More...
 
ObjCompareFunc * compareFunc_p
 Pointer to a compare function. More...
 

Detailed Description

A column of Incremental storage manager for indirect arrays.

Intended use:

Internal

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Prerequisite

Etymology

ISMIndColumn represents a Column in the Incremental Storage Manager containing INDirect arrays.

Synopsis

ISMIndColumn is the implementation of an ISMColumn class to handle indirect arrays. The arrays (shape and data) are stored in a separate file using class StIndArray. The file offset of the beginning of the array in stored in the ISM using the standard ISMColumn functions.

ISMIndColumn contains functions which are called when ISMColumn duplicates or removes a value. In that way the array can also be duplicated or removed in the StIndArray file by incrementing or decrementing the reference count manitained in the file.

Unlike ISMColumn it is not tested if a value put is equal to the value in the previous or next row, because it is too time-consuming to do so (although this behaviour could be changed in the future). Instead the user should not put equal values to prevent storing equal values.

Note that an indirect array can have a fixed shape. In that case adding a row results in reserving space for the array in the StIndArray file, so for each row an array is present. On the other hand adding a row does nothing for variable shaped arrays. So when no data is put or shape is set, a row may contain no array at all. In that case the function isShapeDefined returns False for that row.

To Do

Definition at line 99 of file ISMIndColumn.h.

Constructor & Destructor Documentation

casacore::ISMIndColumn::ISMIndColumn ( ISMBase parent,
int  dataType,
uInt  colnr 
)

Create a column of the given data type.

It keeps the pointer to its parent (but does not own it).

virtual casacore::ISMIndColumn::~ISMIndColumn ( )
virtual

Frees up the storage.

casacore::ISMIndColumn::ISMIndColumn ( const ISMIndColumn )
private

Forbid copy constructor.

Member Function Documentation

virtual void casacore::ISMIndColumn::addRow ( rownr_t  newNrrow,
rownr_t  oldNrrow 
)
virtual

Add (newNrrow-oldNrrow) rows to the column.

Reimplemented from casacore::ISMColumn.

virtual Bool casacore::ISMIndColumn::canChangeShape ( ) const
virtual

This storage manager can handle changing array shapes.

Reimplemented from casacore::DataManagerColumn.

void casacore::ISMIndColumn::clear ( )
private

Clear the object (used by destructor and init).

virtual Bool casacore::ISMIndColumn::compareValue ( const void *  val1,
const void *  val2 
) const
privatevirtual

Compare the values to check if a value to be put matches the value in the previous or next row.

It always return False, because comparing large arrays is too expensive (it could be changed in the future).

Reimplemented from casacore::ISMColumn.

virtual void casacore::ISMIndColumn::doCreate ( ISMBucket bucket)
virtual

Let the column object create its array file.

Reimplemented from casacore::ISMColumn.

virtual Bool casacore::ISMIndColumn::flush ( rownr_t  nrrow,
Bool  fsync 
)
virtual

Flush and optionally fsync the data.

Reimplemented from casacore::ISMColumn.

StIndArray* casacore::ISMIndColumn::getArrayPtr ( rownr_t  rownr)
private

Return a pointer to the array in the given row (for a get).

virtual void casacore::ISMIndColumn::getArrayV ( rownr_t  rownr,
ArrayBase  
)
virtual

Get an array value in the given row.

The buffer pointed to by dataPtr has to have the correct length (which is guaranteed by the ArrayColumn get function).

Reimplemented from casacore::ISMColumn.

virtual void casacore::ISMIndColumn::getFile ( rownr_t  nrrow)
virtual

Let the column object open an existing file.

Reimplemented from casacore::ISMColumn.

StIndArray* casacore::ISMIndColumn::getShape ( rownr_t  rownr)
private

Read the shape at the given row.

This will cache the information in the StIndArray object for that row.

virtual void casacore::ISMIndColumn::getSliceV ( rownr_t  rownr,
const Slicer ,
ArrayBase  
)
virtual

Get a section of the array in the given row.

The array has to have the correct length (which is guaranteed by the ArrayColumn getSlice function).

Reimplemented from casacore::DataManagerColumn.

virtual void casacore::ISMIndColumn::handleCopy ( rownr_t  rownr,
const char *  value 
)
virtual

Handle the duplication of a value; i.e.

increment its reference count.

Reimplemented from casacore::ISMColumn.

virtual void casacore::ISMIndColumn::handleRemove ( rownr_t  rownr,
const char *  value 
)
virtual

Handle the removal of a value; i.e.

decrement its reference count.

Reimplemented from casacore::ISMColumn.

void casacore::ISMIndColumn::init ( ByteIO::OpenOption  fileOption)
private

Initialize part of the object and open/create the file.

It is used by doCreate and getFile.

virtual Bool casacore::ISMIndColumn::isShapeDefined ( rownr_t  rownr)
virtual

Is the shape defined (i.e.

is there an array) in this row?

Reimplemented from casacore::DataManagerColumn.

virtual uInt casacore::ISMIndColumn::ndim ( rownr_t  rownr)
virtual

Get the dimensionality of the item in the given row.

Reimplemented from casacore::ISMColumn.

ISMIndColumn& casacore::ISMIndColumn::operator= ( const ISMIndColumn )
private

Forbid assignment.

StIndArray* casacore::ISMIndColumn::putArrayPtr ( rownr_t  rownr,
const IPosition shape,
Bool  copyData 
)
private

When needed, create an array in the given row with the given shape.

When the array is created, its data are copied when the flag is set.

virtual void casacore::ISMIndColumn::putArrayV ( rownr_t  rownr,
const ArrayBase  
)
virtual

Put an array value into the given row.

The buffer pointed to by dataPtr has to have the correct length (which is guaranteed by the ArrayColumn put function).

Reimplemented from casacore::ISMColumn.

StIndArray* casacore::ISMIndColumn::putShape ( rownr_t  rownr,
const IPosition shape 
)
private

Put the shape for an array being put.

When there are multiple rows in the interval, it will split the interval.

StIndArray* casacore::ISMIndColumn::putShapeSliced ( rownr_t  rownr)
private

Put the shape for an array of which a slice is being put.

It gets the shape for the given row. When there are multiple rows in the interval, it will split the interval and copy the data.

virtual void casacore::ISMIndColumn::putSliceV ( rownr_t  rownr,
const Slicer ,
const ArrayBase  
)
virtual

Put into a section of the array in the given row.

The array has to have the correct length (which is guaranteed by the ArrayColumn putSlice function).

Reimplemented from casacore::DataManagerColumn.

virtual void casacore::ISMIndColumn::reopenRW ( )
virtual

Let the column reopen its data files for read/write access.

Reimplemented from casacore::ISMColumn.

virtual void casacore::ISMIndColumn::resync ( rownr_t  nrrow)
virtual

Resync the storage manager with the new file contents.

virtual void casacore::ISMIndColumn::setShape ( rownr_t  rownr,
const IPosition shape 
)
virtual

Set the shape of the array in the given row and allocate the array in the file.

Reimplemented from casacore::DataManagerColumn.

virtual void casacore::ISMIndColumn::setShapeColumn ( const IPosition shape)
virtual

Set the (fixed) shape of the arrays in the entire column.

Reimplemented from casacore::ISMColumn.

virtual IPosition casacore::ISMIndColumn::shape ( rownr_t  rownr)
virtual

Get the shape of the array in the given row.

Reimplemented from casacore::ISMColumn.

Member Data Documentation

IPosition casacore::ISMIndColumn::fixedShape_p
private

The shape of all arrays in case it is fixed.

Definition at line 221 of file ISMIndColumn.h.

Bool casacore::ISMIndColumn::foundArray_p
private

The indirect array exists for the row interval last accessed.

Definition at line 229 of file ISMIndColumn.h.

StIndArray casacore::ISMIndColumn::indArray_p
private

The indirect array object.

Definition at line 227 of file ISMIndColumn.h.

StManArrayFile* casacore::ISMIndColumn::iosfile_p
private

The file containing the arrays.

Definition at line 225 of file ISMIndColumn.h.

uInt casacore::ISMIndColumn::seqnr_p
private

The (unique) sequence number of the column.

Definition at line 219 of file ISMIndColumn.h.

Bool casacore::ISMIndColumn::shapeIsFixed_p
private

Switch indicating if the shape is fixed.

Definition at line 223 of file ISMIndColumn.h.


The documentation for this class was generated from the following file: