VirtScaCol.h
Classes
- VirtualScalarColumn -- Templated base class for virtual scalar column (full description)
Interface
- Public Members
- VirtualScalarColumn()
- virtual ~VirtualScalarColumn()
- int dataType() const
- String dataTypeId() const
- virtual Bool isWritable() const
- Protected Members
- Bool canAccessScalarColumn (Bool& reask) const
- virtual void get (uInt rownr, T& data) = 0
- virtual void put (uInt rownr, const T& data)
- virtual void getScalarColumn (Vector<T>& data)
- virtual void putScalarColumn (const Vector<T>& data)
- virtual uInt getBlock (uInt rownr, uInt nrmax, T* dataPtr)
- virtual void putBlock (uInt rownr, uInt nrmax, const T* dataPtr)
- Private Members
- void getBoolV (uInt rownr, Bool* dataPtr)
- void getuCharV (uInt rownr, uChar* dataPtr)
- void getShortV (uInt rownr, Short* dataPtr)
- void getuShortV (uInt rownr, uShort* dataPtr)
- void getIntV (uInt rownr, Int* dataPtr)
- void getuIntV (uInt rownr, uInt* dataPtr)
- void getfloatV (uInt rownr, float* dataPtr)
- void getdoubleV (uInt rownr, double* dataPtr)
- void getComplexV (uInt rownr, Complex* dataPtr)
- void getDComplexV (uInt rownr, DComplex* dataPtr)
- void getStringV (uInt rownr, String* dataPtr)
- void getOtherV (uInt rownr, void* dataPtr)
- void putBoolV (uInt rownr, const Bool* dataPtr)
- void putuCharV (uInt rownr, const uChar* dataPtr)
- void putShortV (uInt rownr, const Short* dataPtr)
- void putuShortV (uInt rownr, const uShort* dataPtr)
- void putIntV (uInt rownr, const Int* dataPtr)
- void putuIntV (uInt rownr, const uInt* dataPtr)
- void putfloatV (uInt rownr, const float* dataPtr)
- void putdoubleV (uInt rownr, const double* dataPtr)
- void putComplexV (uInt rownr, const Complex* dataPtr)
- void putDComplexV (uInt rownr, const DComplex* dataPtr)
- void putStringV (uInt rownr, const String* dataPtr)
- void putOtherV (uInt rownr, const void* dataPtr)
- void getScalarColumnV (void* dataPtr)
- void putScalarColumnV (const void* dataPtr)
- uInt getBlockV (uInt rownr, uInt nrmax, void* dataPtr)
- void putBlockV (uInt rownr, uInt nrmax, const void* dataPtr)
- VirtualScalarColumn (const VirtualScalarColumn<T>&)
- VirtualScalarColumn<T>& operator= (const VirtualScalarColumn<T>&)
Review Status
- Reviewed By:
- Gareth Hunt
- Date Reviewed:
- 94Nov17
Prerequisite
- DataManagerColumn
- VirtualColumnEngine
Etymology
VirtualScalarColumn handles a virtual column containing a scalar.
Synopsis
VirtualScalarColumn is the abstract base class to handle a scalar column
for a virtual column engine.
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.
-
Declare a get/put function with the template parameter as its argument.
The virtual functions get/putBoolV, etc. (defined in DataManagerColumn)
are by default implemented using this (templated) get/put function.
This allows for the default implementation of get/putBlock and
makes life easier for the implementor of a derived class.
However, the disadvantage of this is an extra virtual function call.
(E.g. for a Bool value the first one is getBoolV and the second
one get(T&), where T is Bool). If efficiency is really necessary,
getBoolV, etc. should also be implemented in the derived class.
-
In DataManagerColumn the functions get/putBlockV and get/putColumnV
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 VirtualScalarColumn class, virtual functions
get/putBlock and get/putColumn have been defined. They cast
the void* data argument to T&, so in a derived class no care has
to be taken for that cast.
Furthermore a default implementation of them has been made.
- getBlock gets one value using function get.
- putBlock puts one value at the time using function put.
- getColumn uses function getBlock.
- putColumn uses function putBlock.
If efficiency is an issue, these functions should be implemented
in the derived class.
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.
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.
The class can handle a get/putScalarColumn.
virtual void get (uInt rownr, T& data) = 0
Get the scalar value in the given row.
virtual void put (uInt rownr, const T& data)
Put the scalar value into the given row.
The default implementation throws an exception.
Get all scalar values in the column.
The argument dataPtr is in fact a Vector*, but a void*
is needed to be generic.
The vector pointed to by dataPtr has to have the correct length
(which is guaranteed by the ScalarColumn getColumn function).
Put all scalar values in the column.
The argument dataPtr is in fact a const Vector*, but a const void*
is needed to be generic.
The vector pointed to by dataPtr has to have the correct length
(which is guaranteed by the ScalarColumn putColumn function).
virtual uInt getBlock (uInt rownr, uInt nrmax, T* dataPtr)
Get scalars from the given row on with a maximum of nrmax values.
It returns the actual number of values got.
This can be used to get an entire column of scalars or to get
a part of a column (for a cache for example).
The argument dataPtr is in fact a T*, but a void*
is needed to be generic. It must have length nrmax.
virtual void putBlock (uInt rownr, uInt nrmax, const T* dataPtr)
Put nrmax scalars from the given row on.
It returns the actual number of values put.
This can be used to put an entire column of scalars or to put
a part of a column (for a cache for example).
The argument dataPtr is in fact a const T*, but a const void*
is needed to be generic. It must have length nrmax.
void getOtherV (uInt rownr, void* dataPtr)
Implement the virtual functions defined in DataManagerColumn.
Get the scalar value in the given row.
This function is the get for all non-standard data types.
void getBoolV (uInt rownr, Bool* dataPtr)
void getuCharV (uInt rownr, uChar* dataPtr)
void getShortV (uInt rownr, Short* dataPtr)
void getuShortV (uInt rownr, uShort* dataPtr)
void getIntV (uInt rownr, Int* dataPtr)
void getuIntV (uInt rownr, uInt* dataPtr)
void getfloatV (uInt rownr, float* dataPtr)
void getdoubleV (uInt rownr, double* dataPtr)
void getComplexV (uInt rownr, Complex* dataPtr)
void getDComplexV (uInt rownr, DComplex* dataPtr)
void getStringV (uInt rownr, String* dataPtr)
Implement the virtual functions defined in DataManagerColumn.
Get the scalar value in the given row.
void putOtherV (uInt rownr, const void* dataPtr)
Implement the virtual functions defined in DataManagerColumn.
Put the scalar value into the given row.
This function is the put for all non-standard data types.
void putBoolV (uInt rownr, const Bool* dataPtr)
void putuCharV (uInt rownr, const uChar* dataPtr)
void putShortV (uInt rownr, const Short* dataPtr)
void putuShortV (uInt rownr, const uShort* dataPtr)
void putIntV (uInt rownr, const Int* dataPtr)
void putuIntV (uInt rownr, const uInt* dataPtr)
void putfloatV (uInt rownr, const float* dataPtr)
void putdoubleV (uInt rownr, const double* dataPtr)
void putComplexV (uInt rownr, const Complex* dataPtr)
void putDComplexV (uInt rownr, const DComplex* dataPtr)
void putStringV (uInt rownr, const String* dataPtr)
Implement the virtual functions defined in DataManagerColumn.
Put the scalar value into the given row.
Implement the virtual functions defined in DataManagerColumn.
Get all scalar values in the column.
Implement the virtual functions defined in DataManagerColumn.
Put all scalar values in the column.
uInt getBlockV (uInt rownr, uInt nrmax, void* dataPtr)
Implement the virtual functions defined in DataManagerColumn.
Get scalars from the given row on with a maximum of nrmax values.
void putBlockV (uInt rownr, uInt nrmax, const void* dataPtr)
Implement the virtual functions defined in DataManagerColumn.
Put nrmax scalars from the given row on.
The object cannot be copied.
VirtualScalarColumn<T>& operator= (const VirtualScalarColumn<T>&)
The object cannot be assigned to.