casacore
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::TableParseUpdate Class Reference

More...

#include <TableParseUpdate.h>

Public Member Functions

 TableParseUpdate ()
 
 TableParseUpdate (const String &columnName, const String &columnNameMask, const TableExprNode &, Bool checkAggr=True)
 Construct from a column name and expression.
 
 TableParseUpdate (const String &columnName, const String &columnNameMask, const TableExprNodeSet &indices, const TableExprNode &, const TaQLStyle &)
 Construct from a column name, subscripts or mask, and expression.
 
 TableParseUpdate (const String &columnName, const String &columnNameMask, const TableExprNodeSet &indices1, const TableExprNodeSet &indices2, const TableExprNode &, const TaQLStyle &)
 Construct from a column name, subscripts and mask, and expression.
 
void handleIndices (const TableExprNodeSet &indices, const TaQLStyle &style)
 Handle the subscripts or mask.
 
void setNode (const TableExprNode &node)
 Set the node expression (used by TableParseQuery::doInsert).
 
void setColumnName (const String &name)
 Set the column name.
 
void setColumnNameMask (const String &name)
 Set the column name for the mask.
 
const StringcolumnName () const
 Get the column name.
 
const StringcolumnNameMask () const
 Get the possible column name for the mask.
 
void adaptUnit (const Unit &columnUnit)
 Adapt the possible unit of the expression to the possible unit of the column.
 
void check (const Table &origTable, const Table &updTable) const
 Check if the update column and expression specifications match.
 
void updateColumn (TableColumn &col, ArrayColumn< Bool > &maskCol, rownr_t row, const TableExprId &rowid)
 Update the values in the column with the values of the node_p expression.
 

Private Member Functions

template<typename TCOL , typename TNODE >
void updateValue (rownr_t row, const TableExprId &rowid, Bool isScalarCol, const TableExprNode &node, const Array< Bool > &mask, TableColumn &col, const Slicer *slicerPtr, ArrayColumn< Bool > &maskCol)
 Update the values in the columns (helpers of updateColumn).
 
template<typename TCOL , typename TNODE >
void updateScalar (rownr_t row, const TableExprId &rowid, const TableExprNode &node, TableColumn &col)
 
template<typename TCOL , typename TNODE >
void updateArray (rownr_t row, const TableExprId &rowid, const TableExprNode &node, const Array< TNODE > &res, ArrayColumn< TCOL > &col)
 
template<typename TCOL , typename TNODE >
void updateSlice (rownr_t row, const TableExprId &rowid, const TableExprNode &node, const Array< TNODE > &res, const Slicer &slice, ArrayColumn< TCOL > &col)
 
template<typename TCOL , typename TNODE >
void copyMaskedValue (rownr_t row, ArrayColumn< TCOL > &acol, const Slicer *slicerPtr, const TNODE *val, size_t incr, const Array< Bool > &mask)
 
Array< BoolmakeMaskSlice (const Array< Bool > &mask, const IPosition &shapeCol, const Slicer *slicerPtr)
 
void checkMaskColumn (Bool hasMask, const ArrayColumn< Bool > &maskCol, const TableColumn &col)
 

Private Attributes

String columnName_p
 
String columnNameMask_p
 
Bool maskFirst_p
 
TableExprNodeIndexindexPtr_p
 
TableExprNode indexNode_p
 
TableExprNode mask_p
 
TableExprNode node_p
 

Detailed Description

Manage TaQL UPDATE command handling

Intended use:

Internal

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Synopsis

TableParseUpdate holds the column name, optional indices, optional mask, and new value expression of a column to be updated. Furthermore, it has functions to perform updates in the column and possibly mask column using the expression and possible slice.

Definition at line 62 of file TableParseUpdate.h.

Constructor & Destructor Documentation

◆ TableParseUpdate() [1/4]

casacore::TableParseUpdate::TableParseUpdate ( )
inline

Definition at line 65 of file TableParseUpdate.h.

◆ TableParseUpdate() [2/4]

casacore::TableParseUpdate::TableParseUpdate ( const String columnName,
const String columnNameMask,
const TableExprNode ,
Bool  checkAggr = True 
)

Construct from a column name and expression.

By default it checks if no aggregate functions are used.

◆ TableParseUpdate() [3/4]

casacore::TableParseUpdate::TableParseUpdate ( const String columnName,
const String columnNameMask,
const TableExprNodeSet indices,
const TableExprNode ,
const TaQLStyle  
)

Construct from a column name, subscripts or mask, and expression.

It checks if no aggregate functions are used.

◆ TableParseUpdate() [4/4]

casacore::TableParseUpdate::TableParseUpdate ( const String columnName,
const String columnNameMask,
const TableExprNodeSet indices1,
const TableExprNodeSet indices2,
const TableExprNode ,
const TaQLStyle  
)

Construct from a column name, subscripts and mask, and expression.

It checks if no aggregate functions are used. It checks if one of the indices represents subscripts, the other a mask.

Member Function Documentation

◆ adaptUnit()

void casacore::TableParseUpdate::adaptUnit ( const Unit columnUnit)
inline

Adapt the possible unit of the expression to the possible unit of the column.

Definition at line 121 of file TableParseUpdate.h.

References casacore::TableExprNode::adaptUnit(), and node_p.

◆ check()

void casacore::TableParseUpdate::check ( const Table origTable,
const Table updTable 
) const

Check if the update column and expression specifications match.

Also check if the number of rows is correct.

◆ checkMaskColumn()

void casacore::TableParseUpdate::checkMaskColumn ( Bool  hasMask,
const ArrayColumn< Bool > &  maskCol,
const TableColumn col 
)
private

◆ columnName()

const String & casacore::TableParseUpdate::columnName ( ) const
inline

Get the column name.

Definition at line 112 of file TableParseUpdate.h.

References columnName_p.

◆ columnNameMask()

const String & casacore::TableParseUpdate::columnNameMask ( ) const
inline

Get the possible column name for the mask.

Definition at line 116 of file TableParseUpdate.h.

References columnNameMask_p.

◆ copyMaskedValue()

template<typename TCOL , typename TNODE >
void casacore::TableParseUpdate::copyMaskedValue ( rownr_t  row,
ArrayColumn< TCOL > &  acol,
const Slicer slicerPtr,
const TNODE *  val,
size_t  incr,
const Array< Bool > &  mask 
)
private

◆ handleIndices()

void casacore::TableParseUpdate::handleIndices ( const TableExprNodeSet indices,
const TaQLStyle style 
)

Handle the subscripts or mask.

It checks if subscripts or mask is not already used.

◆ makeMaskSlice()

Array< Bool > casacore::TableParseUpdate::makeMaskSlice ( const Array< Bool > &  mask,
const IPosition shapeCol,
const Slicer slicerPtr 
)
private

◆ setColumnName()

void casacore::TableParseUpdate::setColumnName ( const String name)
inline

Set the column name.

Definition at line 104 of file TableParseUpdate.h.

References columnName_p.

◆ setColumnNameMask()

void casacore::TableParseUpdate::setColumnNameMask ( const String name)
inline

Set the column name for the mask.

Definition at line 108 of file TableParseUpdate.h.

References columnNameMask_p.

◆ setNode()

void casacore::TableParseUpdate::setNode ( const TableExprNode node)
inline

Set the node expression (used by TableParseQuery::doInsert).

Definition at line 100 of file TableParseUpdate.h.

References node_p.

◆ updateArray()

template<typename TCOL , typename TNODE >
void casacore::TableParseUpdate::updateArray ( rownr_t  row,
const TableExprId rowid,
const TableExprNode node,
const Array< TNODE > &  res,
ArrayColumn< TCOL > &  col 
)
private

◆ updateColumn()

void casacore::TableParseUpdate::updateColumn ( TableColumn col,
ArrayColumn< Bool > &  maskCol,
rownr_t  row,
const TableExprId rowid 
)

Update the values in the column with the values of the node_p expression.

The column can contain scalars of arrays. Possible only array slices are updated. The mask column values are also updated if a mask is used.

◆ updateScalar()

template<typename TCOL , typename TNODE >
void casacore::TableParseUpdate::updateScalar ( rownr_t  row,
const TableExprId rowid,
const TableExprNode node,
TableColumn col 
)
private

◆ updateSlice()

template<typename TCOL , typename TNODE >
void casacore::TableParseUpdate::updateSlice ( rownr_t  row,
const TableExprId rowid,
const TableExprNode node,
const Array< TNODE > &  res,
const Slicer slice,
ArrayColumn< TCOL > &  col 
)
private

◆ updateValue()

template<typename TCOL , typename TNODE >
void casacore::TableParseUpdate::updateValue ( rownr_t  row,
const TableExprId rowid,
Bool  isScalarCol,
const TableExprNode node,
const Array< Bool > &  mask,
TableColumn col,
const Slicer slicerPtr,
ArrayColumn< Bool > &  maskCol 
)
private

Update the values in the columns (helpers of updateColumn).

It converts the data type of the expression to that opf the column.

Member Data Documentation

◆ columnName_p

String casacore::TableParseUpdate::columnName_p
private

Definition at line 174 of file TableParseUpdate.h.

Referenced by columnName(), and setColumnName().

◆ columnNameMask_p

String casacore::TableParseUpdate::columnNameMask_p
private

Definition at line 175 of file TableParseUpdate.h.

Referenced by columnNameMask(), and setColumnNameMask().

◆ indexNode_p

TableExprNode casacore::TableParseUpdate::indexNode_p
private

Definition at line 178 of file TableParseUpdate.h.

◆ indexPtr_p

TableExprNodeIndex* casacore::TableParseUpdate::indexPtr_p
private

Definition at line 177 of file TableParseUpdate.h.

◆ mask_p

TableExprNode casacore::TableParseUpdate::mask_p
private

Definition at line 179 of file TableParseUpdate.h.

◆ maskFirst_p

Bool casacore::TableParseUpdate::maskFirst_p
private

Definition at line 176 of file TableParseUpdate.h.

◆ node_p

TableExprNode casacore::TableParseUpdate::node_p
private

Definition at line 180 of file TableParseUpdate.h.

Referenced by adaptUnit(), and setNode().


The documentation for this class was generated from the following file: