VirtArrCol.h
Classes
- VirtualArrayColumn -- Templated base class for virtual array column (full description)
Interface
- Public Members
- VirtualArrayColumn()
- virtual ~VirtualArrayColumn()
- virtual int dataType() const
- virtual String dataTypeId() const
- virtual Bool isWritable() const
- virtual Bool canAccessSlice (Bool& reask) const
- virtual Bool canAccessArrayColumn (Bool& reask) const
- virtual Bool canAccessColumnSlice (Bool& reask) const
- Protected Members
- virtual void setShapeColumn (const IPosition& shape)
- virtual void setShape (uInt rownr, const IPosition& shape)
- virtual Bool isShapeDefined (uInt rownr)
- virtual uInt ndim (uInt rownr)
- virtual IPosition shape (uInt rownr)
- virtual void getArray (uInt rownr, Array<T>& data) = 0
- virtual void putArray (uInt rownr, const Array<T>& data)
- virtual void getSlice (uInt rownr, const Slicer& slicer, Array<T>& data)
- virtual void putSlice (uInt rownr, const Slicer& slicer, const Array<T>& data)
- virtual void getArrayColumn (Array<T>& data)
- virtual void putArrayColumn (const Array<T>& data)
- virtual void getArrayColumnCells (const RefRows& rownrs, Array<T>& data)
- virtual void putArrayColumnCells (const RefRows& rownrs, const Array<T>& data)
- virtual void getColumnSlice (const Slicer& slicer, Array<T>& data)
- virtual void putColumnSlice (const Slicer& slicer, const Array<T>& data)
- virtual void getColumnSliceCells (const RefRows& rownrs, const Slicer& slicer, Array<T>& data)
- virtual void putColumnSliceCells (const RefRows& rownrs, const Slicer& slicer, const Array<T>& data)
- Private Members
- void getArrayV (uInt rownr, void* dataPtr)
- void putArrayV (uInt rownr, const void* dataPtr)
- void getArrayColumnCellsV (const RefRows& rownrs, void* dataPtr)
- void putArrayColumnCellsV (const RefRows& rownrs, const void* dataPtr)
- void getSliceV (uInt rownr, const Slicer& slicer, void* dataPtr)
- void putSliceV (uInt rownr, const Slicer& slicer, const void* dataPtr)
- void getArrayColumnV (void* dataPtr)
- void putArrayColumnV (const void* dataPtr)
- void getColumnSliceV (const Slicer& slicer, void* dataPtr)
- void putColumnSliceV (const Slicer& slicer, const void* dataPtr)
- virtual void getColumnSliceCellsV (const RefRows& rownrs, const Slicer& slicer, void* dataPtr)
- virtual void putColumnSliceCellsV (const RefRows& rownrs, const Slicer& slicer, const void* dataPtr)
- VirtualArrayColumn (const VirtualArrayColumn<T>&)
- VirtualArrayColumn<T>& operator= (const VirtualArrayColumn<T>&)
Review Status
- Reviewed By:
- Gareth Hunt
- Date Reviewed:
- 94Nov17
Prerequisite
- DataManagerColumn
- VirtualColumnEngine
Etymology
VirtualArrayColumn handles a virtual column containing an array.
Synopsis
VirtualArrayColumn is the abstract base class to handle an array column
for a virtual column engine (both direct and indirect arrays).
It is derived from DataManagerColumn and reimplements some
virtual functions to make life easier for the derived classes.
It does the following:
-
It implements the dataType function, so it is not needed to implement
that in derived classes.
-
It has a default implementation of False for function isWritable.
Thus by default virtual scalar columns are not writable, which will
often be the case. Only if a virtual scalar column can be writable,
it has to be implemented in the derived class.
-
It has a default implementation for the functions dealing with
the array shapes. By default they throw an "invalid operation"
exception, so it is needed to implement them in the derived class.
-
In DataManagerColumn the functions get/putArrayV and get/putSliceV
are defined, which have a void* data argument. This is necessary
to handle arbitrary data types in the non-templated base class
DataManagerColumn.
In this templated VirtualArrayColumn class, virtual functions
get/putArray, get/putSlice, etc. have been defined. They cast
the void* data argument to Array&, so in a derived class no care
has to be taken for that cast.
Furthermore a default implementation of the get/putSlice has been made.
They get/put the entire array (using get/putArray) and access the
required slice. For this purpose the function canAccessSlice has
also been implemented.
By default the get/putArray functions thrown an "invalid operation"
exception, so they have to be implemented in the derived class.
-
Similarly the functions get/putArrayColumnV and get/putColumnSliceV
have been templated to get/putArrayColumn and get/putColumnSlice.
The default implementation of these latter functions handle a
column by looping through its individual cells.
For this purpose the functions canAccessArrayColumn and
canAccessColumnSlice have also been implemented.
-
Similarly the functions get/putArrayColumnCellsV and
get/putColumnSliceCells have been templated to
get/putArrayColumnCells and get/putColumnSliceCells.
However, their implementations throw an exception and the function
canAccessArrayColumnCells has not implemented (so defaults to False).
However, it makes it possible that a derived class
(like ScaledComplexData)
can implement these functions.
An example of a virtual array column class is ScaledComplexData. Note that
this class is (indirectly) multiple derived from VirtualColumnEngine and
VirtualArrayColumn, so it combines the functionality of DataManager
and DataManagerColumn.
This is possible, because one ScaledComplexData engine can handle only one
column.
Motivation
This class reimplements some virtual functions implemented by
DataManagerColumn and types the data argument. In that way they are
easier to implement in derived classes. Furthermore they allow
default implementations.
Template Type Argument Requirements (T)
- default constructor
- copy constructor
- assignment operator
- static String dataTypeId(); // unique name of the class
To Do
Member Description
Create a column.
Frees up the storage.
virtual int dataType() const
Return the data type of the column.
Return the data type Id of the column.
virtual Bool isWritable() const
By default no data can be put in a virtual column.
virtual Bool canAccessSlice (Bool& reask) const
The class can handle a get/putSlice.
The class can handle a get/putArrayColumn.
The class can handle a get/putColumnSlice.
Set the shape of all arrays in the column.
It is only called if the column contains direct arrays.
By default it throws a "not possible" exception.
virtual void setShape (uInt rownr, const IPosition& shape)
Set the shape of an array in the given row.
It is only called if the column contains indirect arrays.
By default it throws a "not possible" exception.
Is the value shape defined in the given row?
By default it throws a "not possible" exception.
virtual uInt ndim (uInt rownr)
Get the dimensionality of the item in the given row.
By default it throws a "not possible" exception.
Get the shape of the item in the given row.
By default it throws a "not possible" exception.
virtual void getArray (uInt rownr, Array<T>& data) = 0
Get the array value in the given row.
The data array has to have the correct shape
(which is guaranteed by the ArrayColumn::get function).
virtual void putArray (uInt rownr, const Array<T>& data)
Put the array value into the given row.
The data array has to have the correct shape
(which is guaranteed by the ArrayColumn::put function).
By default it throws a "not possible" exception.
virtual void getSlice (uInt rownr, const Slicer& slicer, Array<T>& data)
Get a section of the array in the given row.
The data array has to have the correct shape
(which is guaranteed by the ArrayColumn::getSlice function).
The default implementation gets the slice by getting the full
array first.
virtual void putSlice (uInt rownr, const Slicer& slicer, const Array<T>& data)
Put into a section of the array in the given row.
The data array has to have the correct shape
(which is guaranteed by the ArrayColumn::putSlice function).
The default implementation gets the slice by accessing the full
array.
Get an entire column.
The data array has to have the correct shape
(which is guaranteed by the ArrayColum::getColumn function).
The default implementation gets the column row by row.
Put an entire column.
The data array has to have the correct shape
(which is guaranteed by the ArrayColumn::putColumn function).
The default implementation puts the column row by row.
Get some array values in the column.
The data array has to have the correct length
(which is guaranteed by the ArrayColumn::getColumn function).
By default it throws a "not possible" exception.
Put some array values in the column.
The data array has to have the correct length
(which is guaranteed by the ArrayColumn::putColumn function).
By default it throws a "not possible" exception.
Get a section of all arrays in the column.
The data array has to have the correct shape
(which is guaranteed by the ArrayColumn::getColumn function).
The default implementation gets the column row by row.
Put a section of all arrays in the column.
The data array has to have the correct shape
(which is guaranteed by the ArrayColumn putColumn function).
The default implementation puts the column row by row.
Get a section of some arrays in the column.
The data array has to have the correct shape
(which is guaranteed by the ArrayColumn::getColumn function).
By default it throws a "not possible" exception.
Put into a section of some arrays in the column.
The data array has to have the correct shape
(which is guaranteed by the ArrayColumn::putColumn function).
By default it throws a "not possible" exception.
void getArrayV (uInt rownr, void* dataPtr)
Implement the virtual functions defined in DataManagerColumn.
Get the array value in the given row.
void putArrayV (uInt rownr, const void* dataPtr)
Implement the virtual functions defined in DataManagerColumn.
Put the array value into the given row.
Implement the virtual functions defined in DataManagerColumn.
Get some array values in the column.
Implement the virtual functions defined in DataManagerColumn.
Put some array values in the column.
void getSliceV (uInt rownr, const Slicer& slicer, void* dataPtr)
Implement the virtual functions defined in DataManagerColumn.
Get a section of the array in the given row.
void putSliceV (uInt rownr, const Slicer& slicer, const void* dataPtr)
Implement the virtual functions defined in DataManagerColumn.
Put into a section of the array in the given row.
Implement the virtual functions defined in DataManagerColumn.
Get an entire column.
Implement the virtual functions defined in DataManagerColumn.
Put an entire column.
Implement the virtual functions defined in DataManagerColumn.
Get a section of all arrays in the column.
void putColumnSliceV (const Slicer& slicer, const void* dataPtr)
Implement the virtual functions defined in DataManagerColumn.
Put into section of all arrays in the column.
Implement the virtual functions defined in DataManagerColumn.
Get a section of some arrays in the column.
virtual void putColumnSliceCellsV (const RefRows& rownrs, const Slicer& slicer, const void* dataPtr)
Implement the virtual functions defined in DataManagerColumn.
Put into a section of some arrays in the column.
The object cannot be copied.
VirtualArrayColumn<T>& operator= (const VirtualArrayColumn<T>&)
The object cannot be assigned to.