casacore
|
#include <TableVector.h>
Public Member Functions | |
TableVector () | |
The default constructor creates a null table vector. More... | |
TableVector (const Table &, const String &columnName) | |
Create a read/write table vector from the given table column name. More... | |
TableVector (const TableColumn &column) | |
Create a read/write table vector from the given table column. More... | |
TableVector (const TableVector< T > &) | |
Create a table vector from another one (reference semantics) More... | |
TableVector (const Vector< T > &) | |
Create a table vector containing the given Vector (reference semantics). More... | |
TableVector (rownr_t leng) | |
Create a table vector containing a Vector with the given length. More... | |
~TableVector () | |
Destruct the object. More... | |
TableVector< T > & | operator= (const TableVector< T > &) |
Assign a table vector to another one (copy semantics). More... | |
Bool | isNull () const |
Test if the table vector is null, i.e. More... | |
void | throwIfNull () const |
Throw an exception if the table vector is null, i.e. More... | |
void | reference (const TableVector< T > &) |
Make a reference to the table vector of the other TableVector. More... | |
Vector< T > | makeVector () const |
Make a (normal) Vector from a TableVector (copy semantics). More... | |
T | operator() (rownr_t index) const |
Get the value of a single pixel. More... | |
TableVector< T > & | operator= (const T &) |
Set all elements to a value. More... | |
void | set (const T &value) |
void | set (rownr_t index, const T &value) |
Put a value into a single pixel. More... | |
uInt | ndim () const |
Get nr of dimensions (is always 1). More... | |
rownr_t | nelements () const |
Get nr of elements (ie. More... | |
Bool | conform (const TableVector< T > &) const |
Test if the shape of the given table vector conforms. More... | |
Bool | conform (const Vector< T > &) const |
Test if the shape of the given vector conforms. More... | |
Bool | ok () const |
Test if internal state is correct. More... | |
TabVecRep< T > & | tabVec () |
Return the TabVecRep reference. More... | |
const TabVecRep< T > & | tabVec () const |
TableVector (TabVecRep< T > &) | |
Create a TableVector from a TabVecRep as result of an operation. More... | |
Protected Member Functions | |
void | destruct () |
Destruct the object. More... | |
Protected Attributes | |
TabVecRep< T > * | tabVecPtr_p |
Templated readonly table column vectors
Public interface
TableVector allows to operate on a column in a readonly table as a vector.
A TableVector object is a read/write view of data in a Table. This means that the vector data can be changed if the underlying column is writable.
Table vectors can be used in the same way as the normal vectors. They allow to handle a column in a table as a vector. Many mathematical and logical operations are defined for them in TabVecMath.h and TabVecLogic.h. In fact, constructors exist to convert a TableColumn or a Vector object to a TableVector, so they can often directly be used in a table vector expression. There are 2 kinds of table vectors:
TableVector is implemented by referencing the counted TabVecRep object. A default constructor is defined to allow construction of an array of TableVector objects. However, it constructs an object not referencing anything. Functions like operator() 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.
It is very useful to be able to handle a column as a vector. To handle a column in a readonly table, a TableVector class is needed, otherwise output operations could not be forbidden.
Definition at line 118 of file TableVector.h.
casacore::TableVector< T >::TableVector | ( | ) |
The default constructor creates a null table vector.
This does not contain an actual vector and cannot be used until it references an actual vector (using function reference). Its sole purpose is to be able to construct an array of TableVectors. Note that operator(), 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.
casacore::TableVector< T >::TableVector | ( | const Table & | , |
const String & | columnName | ||
) |
Create a read/write table vector from the given table column name.
Only scalar columns are supported.
casacore::TableVector< T >::TableVector | ( | const TableColumn & | column | ) |
Create a read/write table vector from the given table column.
Only scalar columns are supported. This constructor converts a TableColumn to a TableVector and allows the use of TableColumn objects in table vector expressions.
casacore::TableVector< T >::TableVector | ( | const TableVector< T > & | ) |
Create a table vector from another one (reference semantics)
casacore::TableVector< T >::TableVector | ( | const Vector< T > & | ) |
Create a table vector containing the given Vector (reference semantics).
This constructor converts a Vector to a TableVector and allows the use of Vector objects in table vector expressions.
casacore::TableVector< T >::TableVector | ( | rownr_t | leng | ) |
Create a table vector containing a Vector with the given length.
casacore::TableVector< T >::~TableVector | ( | ) |
Destruct the object.
|
inline |
Create a TableVector from a TabVecRep as result of an operation.
Definition at line 259 of file TableVector.h.
References casacore::TabVecRep< T >::link().
|
inline |
Test if the shape of the given table vector conforms.
Definition at line 237 of file TableVector.h.
References casacore::TableVector< T >::tabVecPtr_p.
|
inline |
Test if the shape of the given vector conforms.
Definition at line 240 of file TableVector.h.
|
protected |
Destruct the object.
It decreases the reference count in the underlying object.
|
inline |
Test if the table vector is null, i.e.
has no actual vector. This is the case if the default constructor has been used.
Definition at line 224 of file TableVector.h.
References casacore::False, and casacore::True.
Vector<T> casacore::TableVector< T >::makeVector | ( | ) | const |
Make a (normal) Vector from a TableVector (copy semantics).
|
inline |
Get nr of dimensions (is always 1).
Definition at line 228 of file TableVector.h.
|
inline |
Bool casacore::TableVector< T >::ok | ( | ) | const |
Test if internal state is correct.
|
inline |
Get the value of a single pixel.
Definition at line 245 of file TableVector.h.
|
inline |
Set all elements to a value.
Definition at line 281 of file TableVector.h.
References casacore::value().
|
inline |
Assign a table vector to another one (copy semantics).
The vectors must have equal length.
Definition at line 264 of file TableVector.h.
References casacore::TableVector< T >::tabVec().
void casacore::TableVector< T >::reference | ( | const TableVector< T > & | ) |
Make a reference to the table vector of the other TableVector.
It will replace an already existing reference. It handles null objects correctly.
|
inline |
Definition at line 276 of file TableVector.h.
References casacore::value().
|
inline |
Put a value into a single pixel.
tabvec(i) = value;
Definition at line 271 of file TableVector.h.
References casacore::value().
|
inline |
Return the TabVecRep reference.
Definition at line 253 of file TableVector.h.
Referenced by casacore::crossProduct(), casacore::indgen(), casacore::innerProduct(), casacore::max(), casacore::min(), casacore::minMax(), casacore::norm(), casacore::TableVector< T >::operator=(), casacore::pow(), casacore::product(), and casacore::sum().
|
inline |
Definition at line 250 of file TableVector.h.
void casacore::TableVector< T >::throwIfNull | ( | ) | const |
Throw an exception if the table vector is null, i.e.
if function isNull() is true.
|
protected |
Definition at line 207 of file TableVector.h.
Referenced by casacore::TableVector< T >::conform().