A ROScalarQuantColumn object is used much in the same way as a ROScalarColumn object.
Quantum<Double> q(5.3, "keV"); // "QuantScalar" has previously been defined as a Quantum column // by means of a TableQuantumDesc. This example assumes the column // already contains quanta. ROScalarQuantColumn<Double> qCol(qtab, "QuantScalar"); // return and print quanta as stored in the column for (i = 0; i < qtab.nrow(); i++) { cout << qCol(i) << endl; } // The following retrieves and converts the quanta to GHz. They // are then divided by the Quantum constant QC::h (Planck). for (i=0; i < qtab.nrow(); i++) { cout << (qCol(i, "GHz"))/(QC::h); }
Create the ROScalarQuantColumn from the specified table and column name. The default unit for data retrieved is the unit in which they were stored.
Create the ROScalarQuantColumn from the specified table and column name. The default unit for data retrieved is the given unit (the data is converted as needed).
Copy constructor (copy semantics).
Change the reference to another column.
Attach a column to the object. Optionally supply a default unit
which has the same meaning as the constructor unit argument.
Get the quantum stored in the specified row.
Get the quantum in the specified row, converted to the given unit.
Get the quantum stored in the specified row.
Get the quantum in the specified row, converted to the unit in other.
Get the quantum stored in the specified row.
Return the quantum stored in the specified row.
Return the quantum stored in the specified row, converted to the
given unit.
Return the quantum stored in the specified row.
Return the quantum in the specified row, converted to the unit in
other.
Return the quantum stored in the specified row.
Test whether the Quantum column has variable units
Returns the column's value for Units as a string.
An empty string is returned if the column has variable units.
Test if the object is null.
Throw an exception if the object is null.
Get access to itsUnitsCol.
Assignment makes no sense in a read only class.
Declaring this operator private makes it unusable.
Comparison is not defined, since its semantics are unclear.
Initialize the ROScalarQuantColumn from the specified table and column.
Deletes allocated memory etc. Called by destructor and any member
which needs to reallocate data.
Get the data without possible conversion.
Create the ROScalarQuantColumn from the specified table and column name.
The default unit for data retrieved is the unit in which they were stored.
Copy constructor (copy semantics).
Change the reference to another column.
Attach a column to the object.
Put a quantum into the table. If the column supports variable units
the q's unit is stored into the unit column defined in the
TableQuantumDesc object. If units are fixed for the column, the
quantum is converted as needed.
Assignment facility offered via reference() member.
Declaring this operator private makes it unusable.
Comparison is not defined, since its semantics are unclear.
Deletes allocated memory etc. Called by destructor and any member
which needs to reallocate data.
void attach (const Table& tab, const String& columnName)
void attach (const Table& tab, const String& columnName, const Unit&)
void get (uInt rownr, Quantum<T>& q, const Unit&) const
void get (uInt rownr, Quantum<T>& q, const Quantum<T>& other) const
void get (uInt rownr, Quantum<T>& q) const
Quantum<T> operator() (uInt rownr, const Unit&) const
Quantum<T> operator() (uInt rownr, const Quantum<T>& other) const
Quantum<T> operator() (uInt rownr) const
Bool isUnitVariable() const
const String& getUnits() const
Bool isNull() const
void throwIfNull() const
const ROScalarColumn<String>* unitsCol() const
ROScalarQuantColumn& operator= (const ROScalarQuantColumn<T>& that)
Bool operator== (const ROScalarQuantColumn<T>& that)
void init (const Table& tab, const String& columnName)
void cleanUp()
void getData (uInt rownr, Quantum<T>& q) const
template<class T> class ScalarQuantColumn : public ROScalarQuantColumn<T>
Interface
Description
Review Status
Prerequisite
Synopsis
The ScalarQuantColumn class provides read/write access to Quanta
stored in a Quantum Table column. The column should previously have
been defined as a Quantum column by means of the
TableQuantumDesc object.
In addition to the operations provided by its read-only partner,
ROScalarQuantColumn, use
of a ScalarQuantColumn object allows the insertion of Quanta into a column.
Quantum Units
Example
Quantum<Double> q(5.3, "keV");
// "QuantScalar" has previously been defined as a Quantum column
// by means of a TableQuantumDesc.
ScalarQuantColumn<Double> qCol(qtab, "QuantScalar");
for (uInt i=0; i < qtab.nrow(); i++) {
qCol.put(i, q);
}
Motivation
Add support for Quanta in the Tables system.
Thrown Exceptions
To Do
Member Description
ScalarQuantColumn()
The default constructor creates a null object. Useful for creating
arrays of ScalarQuantColumn objects. Attempting to use a null object
will produce a segmentation fault so care needs to be taken to
initialise the objects by using the attach() member before any attempt
is made to use the object. The isNull() member can be used to test
if a ScalarQuantColumn object is null.
ScalarQuantColumn (const Table& tab, const String& columnName)
ScalarQuantColumn (const ScalarQuantColumn<T>& that)
~ScalarQuantColumn()
void reference (const ScalarQuantColumn<T>& that)
void attach (const Table& tab, const String& columnName)
void put (uInt rownr, const Quantum<T>& q)
ScalarQuantColumn& operator= (const ScalarQuantColumn<T>& that)
Bool operator== (const ScalarQuantColumn<T>& that)
void cleanUp()