The classes ROScalarColumn
A default constructor is defined to allow construction of an array
of ROTableColumn objects. However, this constructs an object not
referencing a column. Functions like get, etc. will fail (i.e. result
in a segmentation fault) when used on such objects. The functions
isNull and throwIfNull can be used to test on this.
The functions attach and reference can fill in the object.
The assignment operator is not defined for this class, because it was
felt it would be too confusing. Instead the function reference can
be used to do assignment with reference semantics. An assignment
with copy semantics makes no sense for a readonly column.
Construct the object for a column in the table using its name.
Construct the object for a column in the table using its index.
This allows to loop through all columns in a table as:
Copy constructor (reference semantics).
Clone the object.
Change the reference to another column.
This is in fact an assignment operator with reference semantics.
It removes the reference to the current column and creates
a reference to the column referenced in the other object.
It will handle null objects correctly.
Attach a column to the object.
This is in fact only a shorthand for
<
Test if the object is null, i.e. does not reference a column.
Throw an exception if the object is null, i.e.
if function isNull() is True.
Get const access to the column keyword set.
Get const access to the column description.
ColumnDesc functions have to be used to get the data type, etc..
Get the Table object this column belongs to.
Get the number of rows in the column.
Can the shape of an already existing non-FixedShape array be changed?
This depends on the storage manager. Most storage managers
can handle it, but TiledDataStMan and TiledColumnStMan can not.
Get the global #dimensions of an array (ie. for all cells in column).
This is always set for fixed shape arrays.
Otherwise, 0 will be returned.
Get the global shape of an array (ie. for all cells in the column).
This is always set for fixed shape arrays.
Otherwise, a 0-dim shape will be returned.
Test if the given cell contains a defined value.
Get the #dimensions of an array in a particular cell.
Get the shape of an array in a particular cell.
Get the value of a scalar in the given row.
Data type promotion is possible.
These functions only work for the standard data types.
Get the value from the row and convert it to the required type.
This can only be used for scalar columns with a standard data type.
Get the value of a scalar in the given row.
These functions work for all data types.
Data type promotion is possible for the standard data types.
The functions are primarily meant for ScalarColumn
Check if the row number is valid.
It throws an exception if out of range.
Set the maximum cache size (in bytes) to be used by a storage manager.
Get the baseColPtr_p of this ROTableColumn object.
Get the baseColPtr_p of another ROTableColumn object.
This is needed for function put, because baseColPtr_p is a
protected member of ROTableColumn. Another TableColumn has
no access to that.
The classes ScalarColumn
A default constructor is defined to allow construction of an array
of TableColumn objects. However, this constructs an object not
referencing a column. Functions like get, etc. will fail (i.e. result
in a segmentation fault) is used on such objects. The functions
isNull and throwIfNull can be used to test on this.
The functions attach and reference can fill in the object.
The assignment operator is not defined for this class, because it was
felt it would be too confusing. Instead the function reference can
be used to do assignment with reference semantics. An assignment
with copy semantics can be done with a putColumn function.
Construct the object for a column in the table using its name.
Construct the object for a column in the table using its index.
This allows to loop through all columns in a table as:
Copy constructor (reference semantics).
Clone the object.
Change the reference to another column.
This is in fact an assignment operator with reference semantics.
It removes the reference to the current column and creates
a reference to the column referenced in the other object.
It will handle null objects correctly.
Attach a column to the object.
This is in fact only a shorthand for
Get access to the column keyword set.
Copy the value of a cell of that column to a cell of this column.
This function only works for the standard data types.
Data type promotion will be done if needed.
An exception is thrown if the data cannot be converted.
Use the same row numbers for both cells.
Copy the value of a cell of that column to a cell of this column.
This function only works for the standard data types.
Data type promotion will be done if needed.
An exception is thrown if the data cannot be converted.
Use possibly different row numbers for that (i.e. input) and
and this (i.e. output) cell.
Copy the values of that column to this column.
The numbers of rows in both columns must be equal.
Data type promotion is possible.
An exception is thrown if the data cannot be converted.
This function is useful to copy one column to another without
knowing their data types.
In fact, this function is an assignment operator with copy semantics.
Put the value of a scalar in the given row.
Data type promotion is possible.
These functions only work for the standard data types.
Example
See module Tables.
Member Description
ROTableColumn()
The default constructor creates a null object, i.e. it
does not reference a table column.
The sole purpose of this constructor is to allow construction
of an array of ROTableColumn objects.
The functions reference and attach can be used to make a null object
reference a column.
Note that get functions, etc. will cause a segmentation fault
when operating on a null object. It was felt it was too expensive
to test on null over and over again. The user should use the isNull
or throwIfNull function in case of doubt.
ROTableColumn (const Table&, const String& columnName)
ROTableColumn (const Table&, uInt columnIndex)
for (uInt=0; i<tab.ncolumn(); i++) {
ROTableColumn tabcol(tab,i);
}
ROTableColumn (const ROTableColumn&)
virtual ~ROTableColumn()
virtual ROTableColumn* clone() const
void reference (const ROTableColumn&)
void attach (const Table& table, const String& columnName)
void attach (const Table& table, uInt columnIndex)
reference (ROTableColumn (table, columnName));
Bool isNull() const
void throwIfNull() const
const TableRecord& keywordSet() const
const ColumnDesc& columnDesc() const
Table table() const
uInt nrow() const
Bool canChangeShape() const
uInt ndimColumn() const
IPosition shapeColumn() const
Bool isDefined (uInt rownr) const
uInt ndim (uInt rownr) const
IPosition shape (uInt rownr) const
void getScalar (uInt rownr, Bool& value) const
void getScalar (uInt rownr, uChar& value) const
void getScalar (uInt rownr, Short& value) const
void getScalar (uInt rownr, uShort& value) const
void getScalar (uInt rownr, Int& value) const
void getScalar (uInt rownr, uInt& value) const
void getScalar (uInt rownr, float& value) const
void getScalar (uInt rownr, double& value) const
void getScalar (uInt rownr, Complex& value) const
void getScalar (uInt rownr, DComplex& value) const
void getScalar (uInt rownr, String& value) const
Bool asBool (uInt rownr) const
uChar asuChar (uInt rownr) const
Short asShort (uInt rownr) const
uShort asuShort (uInt rownr) const
Int asInt (uInt rownr) const
uInt asuInt (uInt rownr) const
float asfloat (uInt rownr) const
double asdouble (uInt rownr) const
Complex asComplex (uInt rownr) const
DComplex asDComplex (uInt rownr) const
String asString (uInt rownr) const
void getScalarValue (uInt rownr, Bool* value, const String&) const
void getScalarValue (uInt rownr, uChar* value, const String&) const
void getScalarValue (uInt rownr, Short* value, const String&) const
void getScalarValue (uInt rownr, uShort* value, const String&) const
void getScalarValue (uInt rownr, Int* value, const String&) const
void getScalarValue (uInt rownr, uInt* value, const String&) const
void getScalarValue (uInt rownr, float* value, const String&) const
void getScalarValue (uInt rownr, double* value, const String&) const
void getScalarValue (uInt rownr, Complex* value, const String&) const
void getScalarValue (uInt rownr, DComplex* value, const String&) const
void getScalarValue (uInt rownr, String* value, const String&) const
void getScalarValue (uInt rownr, void* value, const String& dataTypeId) const
void checkRowNumber (uInt rownr) const
void setMaximumCacheSize (uInt nbytes) const
BaseColumn* baseColPtr () const
BaseColumn* baseColPtr (const ROTableColumn& that) const
ROTableColumn& operator= (const ROTableColumn&)
Assignment makes no sense for a readonly class.
Declaring this operator private, makes it unusable.
class TableColumn : virtual public ROTableColumn
Interface
Description
Review Status
Prerequisite
Synopsis
The class TableColumn augments the class ROTableColumn
with write access to a table column.
Example
See module Tables.
Member Description
TableColumn()
The default constructor creates a null object, i.e. it
does not reference a table column.
The sole purpose of this constructor is to allow construction
of an array of TableColumn objects.
The functions reference and attach can be used to make a null object
reference a column.
Note that get functions, etc. will cause a segmentation fault
when operating on a null object. It was felt it was too expensive
to test on null over and over again. The user should use the isNull
function in case of doubt.
TableColumn (const Table&, const String& columnName)
TableColumn (const Table&, uInt columnIndex)
for (uInt=0; i<tab.ncolumn(); i++) {
TableColumn tabcol(tab,i);
}
TableColumn (const TableColumn&)
~TableColumn()
virtual ROTableColumn* clone() const
void reference (const TableColumn&)
void attach (const Table& table, const String& columnName)
void attach (const Table& table, uInt columnIndex)
reference (TableColumn (table, columnName));
TableRecord& rwKeywordSet()
void put (uInt rownr, const ROTableColumn& that)
virtual void put (uInt thisRownr, const ROTableColumn& that, uInt thatRownr)
void putColumn (const ROTableColumn& that)
void putScalar (uInt rownr, const Bool& value)
void putScalar (uInt rownr, const uChar& value)
void putScalar (uInt rownr, const Short& value)
void putScalar (uInt rownr, const uShort& value)
void putScalar (uInt rownr, const Int& value)
void putScalar (uInt rownr, const uInt& value)
void putScalar (uInt rownr, const float& value)
void putScalar (uInt rownr, const double& value)
void putScalar (uInt rownr, const Complex& value)
void putScalar (uInt rownr, const DComplex& value)
void putScalar (uInt rownr, const String& value)
void putScalar (uInt rownr, const Char* value)
TableColumn& operator= (const TableColumn&)
Assigning one column to another suggests a deep copy.
Because the copy constructor has reference semantics, it was
felt it would be too confusing to allow assignment.
Instead the function reference (with reference semantics) and
putColumn (with copy semantics) exist.
Declaring this operator private, makes it unusable.