28 #ifndef TABLES_TABLEPARSE_H 29 #define TABLES_TABLEPARSE_H 32 #include <casacore/casa/aips.h> 33 #include <casacore/tables/Tables/Table.h> 34 #include <casacore/tables/Tables/TableDesc.h> 35 #include <casacore/tables/TaQL/ExprNode.h> 36 #include <casacore/tables/TaQL/TaQLResult.h> 37 #include <casacore/tables/TaQL/ExprGroup.h> 38 #include <casacore/casa/BasicSL/String.h> 39 #include <casacore/casa/Utilities/Sort.h> 40 #include <casacore/casa/Containers/Block.h> 48 class TableExprNodeSet;
49 class TableExprNodeSetElem;
50 class TableExprNodeIndex;
53 template<
class T>
class Vector;
152 const Table& tempTable);
154 const std::vector<const Table*>& tempTables);
161 const std::vector<const Table*>& tempTables,
164 const std::vector<const Table*>& tempTables,
220 Bool orderGiven()
const;
225 void checkNode()
const;
282 void setColumnName (
const String& name);
285 const String& columnName()
const;
301 void adaptUnit (
const Unit& columnUnit);
373 {
return commandType_p; }
386 void execute (
Bool showTimings,
Bool setInGiving,
401 void show (ostream& os)
const;
408 void handleGroupby (
const vector<TableExprNode>&,
Bool rollup);
417 void handleCreTab (
const String& tableName,
const Record& dmInfo);
420 void handleColSpec (
const String& columnName,
const String& dataType,
442 void handleSort (
const std::vector<TableParseSort>& sortList,
455 void addTable (
Int tabnr,
const String& name,
458 const vector<const Table*> tempTables,
459 const vector<TableParseSelect*>& stack);
462 void replaceTable (
const Table& table);
493 void handleColumnFinish (
Bool distinct);
496 void handleGiving (
const String& name,
Int type);
505 const Table& getTable()
const;
515 Int testGroupAggr (vector<TableExprNodeRep*>& aggr)
const;
518 vector<TableExprNodeRep*> getAggrNodes()
const;
538 void doUpdate (
Bool showTimings,
const Table& origTable,
547 void doDelete (
Bool showTimings,
Table& table);
564 void makeProjectExprTable();
568 void makeProjectExprSel();
572 { applySelNodes_p.push_back (node); }
583 (
bool showTimings, vector<TableExprNodeRep*> aggrNodes,
587 void doHaving (
Bool showTimings,
595 (
const vector<TableExprNodeRep*>& aggrNodes);
598 void doSort (
Bool showTimings);
601 void doLimOff (
Bool showTimings);
612 template<
typename TCOL,
typename TNODE>
626 DataType makeDataType (DataType dtype,
const String& dtstr,
653 Bool checkError)
const;
661 void handleWildColumn (
Int stringType,
const String& name);
665 void addColumnDesc (
TableDesc& td, DataType dtype,
682 const vector<TableParseSelect*>& stack);
694 vector<CountedPtr<TableExprGroupFuncSet> > doGroupByAggrSingleKey
695 (
const vector<TableExprNodeRep*>& aggrNodes)
702 vector<CountedPtr<TableExprGroupFuncSet> > funcSets;
703 std::map<T, int> keyFuncMap;
710 for (
uInt i=0; i<rownrs_p.size(); ++i) {
712 groupbyNodes_p[0].get (rowid, key);
713 if (key != lastKey) {
714 typename std::map<T, int>::iterator iter = keyFuncMap.find (key);
715 if (iter == keyFuncMap.end()) {
716 groupnr = funcSets.size();
717 keyFuncMap[key] = groupnr;
720 groupnr = iter->second;
724 funcSets[groupnr]->apply (rowid);
731 vector<CountedPtr<TableExprGroupFuncSet> > doGroupByAggrMultipleKeys
732 (
const vector<TableExprNodeRep*>& aggrNodes);
820 { columnName_p = name; }
822 {
return columnName_p; }
824 {
return indexPtr_p; }
826 {
return indexNode_p; }
832 { node_p.adaptUnit (columnUnit); }
843 {
return columnNames_p; }
849 { update_p.push_back (upd); }
A Vector of integers, for indexing into Array<T> objects.
CommandType commandType_p
Block< Bool > projectExprSelColumn_p
A 1-D Specialization of the Array class.
vector< TableExprNode > groupbyNodes_p
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
void setColumnName(const String &name)
Set the column name.
TableExprNodeSet * resultSet_p
Bool orderGiven() const
Is the order given?
Main interface class to a read/write table.
TableExprNodeIndex * indexPtr_p
TableExprNode indexNode_p
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Class to hold multiple table expression nodes.
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
Handle class for a table column expression tree.
Order
Enumerate the sort order:
void setRownr(uInt rownr)
Set the row number.
TableExprNodeIndex * indexPtr() const
Get the pointer to the indices.
Sort::Order getOrder(const TableParseSort &key) const
Get the order for this key.
void adaptUnit(const Unit &columnUnit)
Adapt the possible unit of the expression to the possible unit of the column.
Abstract base class for a node in a table column expression tree.
TableParse & operator=(const TableParse &)
Assignment (copy semantics).
const Table & table() const
Get table object.
vector< TableExprNode > applySelNodes_p
vector< TableParse > fromTables_p
Select-class for flex/bison scanner/parser for TableParse.
Sort::Order order() const
Get the sort order.
Referenced counted pointer for constant data.
const TableExprNode & node() const
Get the expression node.
Class to hold the table expression nodes for an element in a set.
Class to hold the result of a TaQL command.
Class with static members defining the TaQL style.
LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
CommandType commandType() const
Return the command type.
Block< uInt > projectExprSubset_p
Block< String > columnDtypes_p
const Block< String > & getColumnNames() const
Get the projected column names.
Block< TableRecord > columnKeywords_p
A hierarchical collection of named fields of various types.
bool Bool
Define the standard types used by Casacore.
Bool test(const String &shortHand) const
Test if shorthand matches.
Read/write access to a table column.
Class containing the results of aggregated values in a group.
Block< String > columnNames_p
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
A hierarchical collection of named fields of various types.
Block< TableExprNode > columnExpr_p
TableExprNode getNode() const
Return the expression node.
TableParse()
Default constructor for container class.
Helper class for sort keys in TableParse.
Specify which elements to extract from an n-dimensional array.
const TableExprNode & node() const
Get the expression node.
Class to hold values from table grammar parser.
TableExprNode havingNode_p
TableParseSelect * insSel_p
The identification of a TaQL selection subject.
void addUpdate(TableParseUpdate *upd)
Add an update object.
Block< String > columnOldNames_p
const TableExprNode & indexNode() const
Get the index expression node.
String: the storage and methods of handling collections of characters.
Define the structure of a Casacore table.
const Table & getTable() const
Get the resulting table.
TaQLResult tableCommand(const String &command)
const String & shorthand() const
Get the shorthand.
The index of an array element in a table select expression.
void addApplySelNode(const TableExprNode &node)
Add a column node to applySelNodes_p.
const String & columnName() const
Get the column name.
this file contains all the compiler specific defines
Helper class for updates in TableParse.
std::vector< TableParseUpdate * > update_p
std::vector< TableParseSort > sort_p