casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExprNode.h
Go to the documentation of this file.
1 //# ExprNode.h: Handle class for a table column expression tree
2 //# Copyright (C) 1994,1995,1996,1997,1998,2000,2001,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: ExprNode.h 21277 2012-10-31 16:07:31Z gervandiepen $
27 
28 #ifndef TABLES_EXPRNODE_H
29 #define TABLES_EXPRNODE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
41 
42 namespace casacore { //# NAMESPACE CASACORE - BEGIN
43 
44 //# Forward Declarations
45 class Table;
46 class String;
47 class Regex;
48 class StringDistance;
49 class Unit;
50 class Record;
51 class TableRecord;
52 class TableExprNodeBinary;
53 class TableExprNodeSet;
54 template<class T> class Block;
55 template<class T> class Array;
56 template<class T> class MArray;
57 
58 
59 // <summary>
60 // Handle class for a table column expression tree
61 // </summary>
62 
63 // <use visibility=export>
64 
65 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
66 // </reviewed>
67 
68 // <prerequisite>
69 //# Classes you should understand before using this one.
70 // <li> <linkto class=Table>Table</linkto>
71 // <li> Note 199 describing
72 // <a href="../notes/199.html">
73 // TaQL</a>
74 // </prerequisite>
75 
76 // <etymology>
77 // TableExprNode represents a node in the tree reflecting a
78 // table select expression.
79 // </etymology>
80 
81 // <synopsis>
82 // TableExprNode is the class to store a table select expression,
83 // making it possible to select rows from the table. The selected
84 // rows form a table which is a view of the original table.
85 // <p>
86 // TableExprNode is a handle class for the counted referenced class
87 // TableExprNodeRep.
88 // Classes (like TableExprNodePlusXX) derived from TableExprNodeRep
89 // hold the individual
90 // nodes in the expression, i.e. the operators and operands. The nodes
91 // form a binary tree reflecting the expression.
92 // E.g. the expression 2*COLUMN results in the node TableExprNodeTimes
93 // with its children TableExprNodeConst and TableExprNodeColumn.
94 // Constant subexpressions (like 2*3) are evaluated immediately and
95 // only the result is stored as a node.
96 // <p>
97 // There are a few TableExprNode constructors taking a constant scalar or array.
98 // In this way constant value are automatically converted to the
99 // appropriate TableExprNodeConst object.
100 // <p>
101 // The derived classes also reflect the data type of the node.
102 // Data types Bool, Int64, Double, DComplex and String are used.
103 // Char, uChar, Short, uShort, Int and uInt are converted to Int64,
104 // float to Double, and Complex to DComplex.
105 // Binary operators +, -, *, /, %, &, }, ^, ==, >=, >, <, <= and != are
106 // recognized. Also &&, ||, parentheses and unary +, -, ~ and ! are recognized.
107 // For strings the binary operator + can also be used.
108 // The operators have the normal C++ precedence.
109 // Furthermore functions (such as sin, max, ceil) can be used in an expression.
110 // <br>Operator() can be used to take a slice from an array.
111 // <p>
112 // The Table function col has to be used to create a TableExprNode
113 // object for a column in the table. The Table
114 // <linkto file="Table.h#keycol">operator()</linkto> can be used
115 // the do the actual selection from the top TableExprNode object.
116 // </synopsis>
117 
118 // <example>
119 // <srcblock>
120 // // Select from table X all rows where column RA<5 and where column
121 // // SWITCH is true.
122 // Table table("X");
123 // Table subtable = table(table.col("RA") < 5 && table.col("SWITCH"));
124 //
125 // // Select from that result all rows where the concatenation of
126 // // the strings in columns STR1 and STR2 is equal to the string
127 // // in keyword STRKEY.
128 // Table subsub = subtable(subtable.col("STR1") + subtable.col("STR2")
129 // == subtable.key("STRKEY"));
130 // </srcblock>
131 // </example>
132 
133 // <motivation>
134 // Having TableExprNode as a handle class makes it possible to
135 // handle temporary objects created by the compiler in a smooth way.
136 // TableExprNode and its derivations allow to store an expression
137 // before actually evaluating it. This also allows the classes to
138 // be used by the table expression parser defined in TableParse and
139 // TableGram.
140 //
141 // For each operator a special derived class is implemented.
142 // Another approach could have been to store the operator as
143 // a flag and switch on that. However, that causes extra overhead
144 // and the C++ virtual function mechanism is the designed for
145 // these purposes.
146 // </motivation>
147 
148 // <todo asof="$DATE:$">
149 //# A List of bugs, limitations, extensions or planned refinements.
150 // <li> add operations on arrays
151 // <li> add selection by comparing with a set of values
152 // </todo>
153 
154 
156 {
157 public:
158  TableExprNode ();
159 
160  // Unary operators on numeric TableExprNode's.
161  // <group>
162  TableExprNode operator+ () const;
163  TableExprNode operator- () const;
164  // </group>
165  // Unary NOT-operator on boolean TableExprNode's.
166  TableExprNode operator! () const;
167  // Unary bitwise negate-operator on integer TableExprNode's.
168  TableExprNode operator~ () const;
169 
170  // Slicing in a node containing an array. It is possible to
171  // address a single pixel or an n-dimensional subarray.
172  // In case of a single pixel the result is a scalar node.
173  // Otherwise the result is an array node with the same dimensionality
174  // as the source.
175  // <br>Note that there exist TableExprNodeSet constructors to
176  // convert an <src>IPosition</src> or <src>Slicer</src> object
177  // automatically to a <src>TableExprNodeSet</src>.
178  // An <src>IPosition</src> addresses a single element and results in
179  // a scalar node, while a <src>Slicer</src> can address multiple
180  // elements and always results in an array node.
182 
183  // The IN operator to test if a value is contained in an array or set.
184  // The array can also be a scalar.
185  // <group>
187  const TaQLStyle& = TaQLStyle(0)) const;
188  TableExprNode in (const TableExprNodeSet& set,
189  const TaQLStyle& = TaQLStyle(0)) const;
190  // </group>
191 
192  // Use a unit for the given TableExprNode.
193  // Note that if a column has a unit, it is automatically set. In that case
194  // this can be used to convert units.
195  TableExprNode useUnit (const Unit& unit) const;
196 
197  // Constructors to convert a constant value to a TableExprNode.
198  // The constructor for char* is also supported to convert a
199  // character-array to a string, since a two step conversion
200  // is not done automatically.
201  // <group>
202  TableExprNode (const Bool& value);
203  TableExprNode (const Int64& value);
204  TableExprNode (const Int& value);
205  TableExprNode (const uInt& value);
206  TableExprNode (const Float& value);
207  TableExprNode (const Double& value);
208  TableExprNode (const Complex& value);
209  TableExprNode (const DComplex& value);
210  TableExprNode (const String& value);
211  TableExprNode (const std::string& value);
212  TableExprNode (const char*);
213  TableExprNode (const Regex& value);
214  TableExprNode (const StringDistance& value);
215  TableExprNode (const TaqlRegex& value);
216  TableExprNode (const MVTime& value);
217  TableExprNode (const Array<Bool>& value);
218  TableExprNode (const Array<uChar>& value);
219  TableExprNode (const Array<Short>& value);
220  TableExprNode (const Array<uShort>& value);
221  TableExprNode (const Array<Int>& value);
222  TableExprNode (const Array<uInt>& value);
223  TableExprNode (const Array<Int64>& value);
224  TableExprNode (const Array<Float>& value);
225  TableExprNode (const Array<Double>& value);
226  TableExprNode (const Array<Complex>& value);
227  TableExprNode (const Array<DComplex>& value);
228  TableExprNode (const Array<String>& value);
229  TableExprNode (const Array<MVTime>& value);
230  TableExprNode (const MArray<Bool>& value);
231  TableExprNode (const MArray<uChar>& value);
232  TableExprNode (const MArray<Short>& value);
233  TableExprNode (const MArray<uShort>& value);
234  TableExprNode (const MArray<Int>& value);
235  TableExprNode (const MArray<uInt>& value);
236  TableExprNode (const MArray<Int64>& value);
237  TableExprNode (const MArray<Float>& value);
238  TableExprNode (const MArray<Double>& value);
239  TableExprNode (const MArray<Complex>& value);
240  TableExprNode (const MArray<DComplex>& value);
241  TableExprNode (const MArray<String>& value);
242  TableExprNode (const MArray<MVTime>& value);
243  // </group>
244 
245  // Construct a node from a node representation shared pointer
246  // which increments the reference count.
247  TableExprNode (const TENShPtr&);
248 
249  // Construct from a node representation. It takes over the pointer, so the
250  // object gets deleted automatically.
252  : node_p(TENShPtr(rep)) {}
253 
254  // copy constructor (reference semantics).
255  TableExprNode (const TableExprNode&);
256 
257  // Assignment (reference semantics).
259 
260  // The destructor deletes all the underlying TableExprNode objects,
261  ~TableExprNode ();
262 
263  // Does the node contain no actual node?
264  Bool isNull() const
265  { return !node_p; }
266 
267  // Do not apply the selection.
269  { node_p->disableApplySelection(); }
270 
271  // Re-create the column object for a selection of rows.
272  // Nothing is done if the node does not represent a column object.
273  void applySelection (const Vector<uInt>& rownrs)
274  { node_p->applySelection (rownrs); }
275 
276  // Get the unit of the expression.
277  const Unit& unit() const
278  { return node_p->unit(); }
279 
280  // Get the attributes of the expression.
281  const Record& attributes() const
282  { return node_p->attributes(); }
283 
284  // Get the data type of the expression.
285  // Currently the only possible values are TpBool, TpInt, TpDouble,
286  // TpDComplex, TpString, and TpOther.
287  // The latter is returned for a date or regex.
288  DataType dataType() const;
289 
290  // Is the expression a scalar?
291  Bool isScalar() const
292  { return (node_p->valueType() == TableExprNodeRep::VTScalar); }
293 
294  // Get the number of rows in the table associated with this expression.
295  // One is returned if the expression is a constant.
296  // Zero is returned if no table is associated with it.
297  uInt nrow() const
298  { return node_p->nrow(); }
299 
300  // Get a value for this node in the given row.
301  // These functions are implemented in the derived classes and
302  // will usually invoke the get in their children and apply the
303  // operator on the resulting values.
304  // <group>
305  void get (const TableExprId& id, Bool& value) const;
306  void get (const TableExprId& id, Int64& value) const;
307  void get (const TableExprId& id, Double& value) const;
308  void get (const TableExprId& id, DComplex& value) const;
309  void get (const TableExprId& id, String& value) const;
310  void get (const TableExprId& id, TaqlRegex& value) const;
311  void get (const TableExprId& id, MVTime& value) const;
312  void get (const TableExprId& id, MArray<Bool>& value) const;
313  void get (const TableExprId& id, MArray<Int64>& value) const;
314  void get (const TableExprId& id, MArray<Double>& value) const;
315  void get (const TableExprId& id, MArray<DComplex>& value) const;
316  void get (const TableExprId& id, MArray<String>& value) const;
317  void get (const TableExprId& id, MArray<MVTime>& value) const;
318  void get (const TableExprId& id, Array<Bool>& value) const;
319  void get (const TableExprId& id, Array<Int64>& value) const;
320  void get (const TableExprId& id, Array<Double>& value) const;
321  void get (const TableExprId& id, Array<DComplex>& value) const;
322  void get (const TableExprId& id, Array<String>& value) const;
323  void get (const TableExprId& id, Array<MVTime>& value) const;
324  Bool getBool (const TableExprId& id) const;
325  Int64 getInt (const TableExprId& id) const;
326  Double getDouble (const TableExprId& id) const;
327  DComplex getDComplex (const TableExprId& id) const;
328  MVTime getDate (const TableExprId& id) const;
329  String getString (const TableExprId& id) const;
330  Array<Bool> getArrayBool (const TableExprId& id) const;
331  Array<Int64> getArrayInt (const TableExprId& id) const;
332  Array<Double> getArrayDouble (const TableExprId& id) const;
333  Array<DComplex> getArrayDComplex (const TableExprId& id) const;
334  Array<String> getArrayString (const TableExprId& id) const;
335  Array<MVTime> getArrayDate (const TableExprId& id) const;
336  // Get a value as an array, even it it is a scalar.
337  // This is useful in case one can give an argument as scalar or array.
338  // <group>
339  MArray<Bool> getBoolAS (const TableExprId& id) const;
340  MArray<Int64> getIntAS (const TableExprId& id) const;
341  MArray<Double> getDoubleAS (const TableExprId& id) const;
342  MArray<DComplex> getDComplexAS (const TableExprId& id) const;
343  MArray<String> getStringAS (const TableExprId& id) const;
344  MArray<MVTime> getDateAS (const TableExprId& id) const;
345  // </group>
346 
347  // </group>
348 
349  // Get the data type for doing a getColumn on the expression.
350  // This is the data type of the column if the expression
351  // consists of a single column only.
352  // Otherwise it is the expression data type as returned by
353  // function <src>dataType</src>.
354  DataType getColumnDataType() const;
355 
356  // Get the value of the expression evaluated for the entire column.
357  // The data of function called should match the data type as
358  // returned by function <src>getColumnDataType</src>.
359  // <group>
360  Array<Bool> getColumnBool (const Vector<uInt>& rownrs) const;
361  Array<uChar> getColumnuChar (const Vector<uInt>& rownrs) const;
362  Array<Short> getColumnShort (const Vector<uInt>& rownrs) const;
363  Array<uShort> getColumnuShort (const Vector<uInt>& rownrs) const;
364  Array<Int> getColumnInt (const Vector<uInt>& rownrs) const;
365  Array<uInt> getColumnuInt (const Vector<uInt>& rownrs) const;
366  Array<Int64> getColumnInt64 (const Vector<uInt>& rownrs) const;
367  Array<Float> getColumnFloat (const Vector<uInt>& rownrs) const;
368  Array<Double> getColumnDouble (const Vector<uInt>& rownrs) const;
369  Array<Complex> getColumnComplex (const Vector<uInt>& rownrs) const;
370  Array<DComplex> getColumnDComplex (const Vector<uInt>& rownrs) const;
371  Array<String> getColumnString (const Vector<uInt>& rownrs) const;
372  // </group>
373 
374  // Show the tree.
375  void show (ostream&) const;
376 
377  // Convert the tree to a number of range vectors which at least
378  // select the same things.
379  // This function is very useful to convert the expression to
380  // some intervals covering the select expression. This can
381  // be used to do a rough fast selection via an index and do the
382  // the slower final selection on that much smaller subset.
383  // The function can only convert direct comparisons of columns
384  // with constants (via ==, !=, >, >=, < or <=) and their combinations
385  // using && or ||.
387 
388  // Check if tables used in expression have the same number of
389  // rows as the given table.
390  Bool checkTableSize (const Table& table, Bool canBeConst) const;
391 
392  // Get table. This gets the Table object to which a
393  // TableExprNode belongs. A TableExprNode belongs to the Table to
394  // which the column(s) used in an expression belong. Note that
395  // all columns in an expression have to belong to the same table.
396  const Table& table() const;
397 
398  // Create a column node on behalf of the Table class.
399  // For builtin data types another type of node is created than
400  // for other data types.
401  static TableExprNode newColumnNode (const Table& tab,
402  const String& name,
403  const Vector<String>& fieldNames);
404 
405  // Create a TableExprNodeConst for a table keyword
406  // (which is handled as a constant).
407  static TableExprNode newKeyConst (const TableRecord&,
408  const Vector<String>& fieldNames);
409 
410  // Handle all field names except the last one. ALl of them must
411  // be records. The last record is returned.
412  // fullName is filled with the full keyword name separated by dots.
413  static TableRecord* findLastKeyRec (const TableRecord& keyset,
414  const Vector<String>& fieldNames,
415  String& fullName);
416 
417  // Throw invalid data type exception.
418  static void throwInvDT (const String& message);
419 
420  // Create function node of the given type with the given arguments.
421  // <group>
423  const TableExprNodeSet& set,
424  const Table& table,
425  const TaQLStyle& = TaQLStyle(0));
427  const TableExprNode& node);
429  const TableExprNode& node1,
430  const TableExprNode& node2);
432  const TableExprNode& node1,
433  const TableExprNode& node2,
434  const TableExprNode& node3);
436  const TableExprNode& array,
437  const TableExprNodeSet& axes);
439  const TableExprNode& array,
440  const TableExprNode& node,
441  const TableExprNodeSet& axes);
442  // </group>
443 
444  // Create a user defined function node.
445  static TableExprNode newUDFNode (const String& name,
446  const TableExprNodeSet& set,
447  const Table& table,
448  const TaQLStyle& = TaQLStyle(0));
449 
450  // Create cone function node of the given type with the given arguments.
451  // <group>
453  const TableExprNodeSet& set,
454  uInt origin = 0);
456  const TableExprNode& node1,
457  const TableExprNode& node2);
459  const TableExprNode& node1,
460  const TableExprNode& node2,
461  const TableExprNode& node3);
462  // </group>
463 
464  // Create rownumber() function node.
465  // Origin indicates whether the first row should be zero (for C++ binding)
466  // or an other value (one for TaQL binding).
467  static TableExprNode newRownrNode (const Table& table, uInt origin);
468 
469  // Create rowid() function node.
470  // Origin is always 0.
471  static TableExprNode newRowidNode (const Table& table);
472 
473  // Create rand() function node.
474  static TableExprNode newRandomNode (const Table& table);
475 
476  // Create ArrayElement node for the given array with the given index.
477  // The origin is 0 for C++ and 1 for TaQL.
478  static TableExprNode newArrayPartNode (const TableExprNode& arrayNode,
479  const TableExprNodeSet& indices,
480  const TaQLStyle& = TaQLStyle(0));
481 
482  // returns const pointer to the underlying TableExprNodeRep object.
483  const TENShPtr& getRep() const;
484  const TableExprNodeRep* getNodeRep() const;
485 
486  // Adapt the unit of the expression to the given unit (if not empty).
487  void adaptUnit (const Unit&);
488 
489  // Construct a new node for the given operation.
490  // <group>
491  TENShPtr newPlus (const TENShPtr& right) const;
492  TENShPtr newMinus (const TENShPtr& right) const;
493  TENShPtr newTimes (const TENShPtr& right) const;
494  TENShPtr newDivide (const TENShPtr& right) const;
495  TENShPtr newModulo (const TENShPtr& right) const;
496  TENShPtr newBitAnd (const TENShPtr& right) const;
497  TENShPtr newBitOr (const TENShPtr& right) const;
498  TENShPtr newBitXor (const TENShPtr& right) const;
499  TENShPtr newEQ (const TENShPtr& right) const;
500  TENShPtr newNE (const TENShPtr& right) const;
501  TENShPtr newGE (const TENShPtr& right) const;
502  TENShPtr newGT (const TENShPtr& right) const;
503  TENShPtr newIN (const TENShPtr& right, const TaQLStyle&) const;
504  TENShPtr newOR (const TENShPtr& right) const;
505  TENShPtr newAND (const TENShPtr& right) const;
506  // </group>
507 
508 private:
509  // Put the new binary node object in a shared pointer.
510  // Set the node's info and adapt the children if needed.
511  // If the node is constant, it is evaluated and returned as result.
513  const TENShPtr& right=TENShPtr()) const;
514 
515  // convert Block of TableExprNode to vector of TENShPtr.
516  static std::vector<TENShPtr> convertBlockTEN (Block<TableExprNode>& nodes);
517 
518  // The actual (counted referenced) representation of a node.
520 };
521 
522 
523 
525  { node_p->ranges (blrange); }
526 
527 //# Get the table from which the node is derived.
528 inline const Table& TableExprNode::table() const
529  { return node_p->table(); }
530 
531 //# Get the value of an expression.
532 inline void TableExprNode::get (const TableExprId& id, Bool& value) const
533  { value = node_p->getBool (id); }
534 inline void TableExprNode::get (const TableExprId& id, Int64& value) const
535  { value = node_p->getInt (id); }
536 inline void TableExprNode::get (const TableExprId& id, Double& value) const
537  { value = node_p->getDouble (id); }
538 inline void TableExprNode::get (const TableExprId& id, DComplex& value) const
539  { value = node_p->getDComplex (id); }
540 inline void TableExprNode::get (const TableExprId& id, String& value) const
541  { value = node_p->getString (id); }
542 inline void TableExprNode::get (const TableExprId& id, TaqlRegex& value) const
543  { value = node_p->getRegex (id); }
544 inline void TableExprNode::get (const TableExprId& id, MVTime& value) const
545  { value = node_p->getDate (id); }
546 inline void TableExprNode::get (const TableExprId& id,
547  MArray<Bool>& value) const
548  { value = node_p->getArrayBool (id); }
549 inline void TableExprNode::get (const TableExprId& id,
550  MArray<Int64>& value) const
551  { value = node_p->getArrayInt (id); }
552 inline void TableExprNode::get (const TableExprId& id,
553  MArray<Double>& value) const
554  { value = node_p->getArrayDouble (id); }
555 inline void TableExprNode::get (const TableExprId& id,
556  MArray<DComplex>& value) const
557  { value = node_p->getArrayDComplex (id); }
558 inline void TableExprNode::get (const TableExprId& id,
559  MArray<String>& value) const
560  { value = node_p->getArrayString (id); }
561 inline void TableExprNode::get (const TableExprId& id,
562  MArray<MVTime>& value) const
563  { value = node_p->getArrayDate (id); }
564 inline void TableExprNode::get (const TableExprId& id,
565  Array<Bool>& value) const
566  { value = node_p->getArrayBool (id).array(); }
567 inline void TableExprNode::get (const TableExprId& id,
568  Array<Int64>& value) const
569  { value = node_p->getArrayInt (id).array(); }
570 inline void TableExprNode::get (const TableExprId& id,
571  Array<Double>& value) const
572  { value = node_p->getArrayDouble (id).array(); }
573 inline void TableExprNode::get (const TableExprId& id,
574  Array<DComplex>& value) const
575  { value = node_p->getArrayDComplex (id).array(); }
576 inline void TableExprNode::get (const TableExprId& id,
577  Array<String>& value) const
578  { value = node_p->getArrayString (id).array(); }
579 inline void TableExprNode::get (const TableExprId& id,
580  Array<MVTime>& value) const
581  { value = node_p->getArrayDate (id).array(); }
582 inline Bool TableExprNode::getBool (const TableExprId& id) const
583  { return node_p->getBool (id); }
584 inline Int64 TableExprNode::getInt (const TableExprId& id) const
585  { return node_p->getInt (id); }
587  { return node_p->getDouble (id); }
589  { return node_p->getDComplex (id); }
590 inline MVTime TableExprNode::getDate (const TableExprId& id) const
591  { return node_p->getDate (id); }
593  { return node_p->getString (id); }
595  { return node_p->getArrayBool (id).array(); }
597  { return node_p->getArrayInt (id).array(); }
599  { return node_p->getArrayDouble (id).array(); }
601  { return node_p->getArrayDComplex (id).array(); }
603  { return node_p->getArrayString (id).array(); }
605  { return node_p->getArrayDate (id).array(); }
607  { return node_p->getBoolAS (id); }
609  { return node_p->getIntAS (id); }
611  { return node_p->getDoubleAS (id); }
613  { return node_p->getDComplexAS (id); }
615  { return node_p->getStringAS (id); }
617  { return node_p->getDateAS (id); }
618 
620  { return node_p->getColumnBool (rownrs); }
622  { return node_p->getColumnuChar (rownrs); }
624  { return node_p->getColumnShort (rownrs); }
626  { return node_p->getColumnuShort (rownrs); }
628  { return node_p->getColumnInt (rownrs); }
630  { return node_p->getColumnuInt (rownrs); }
632  { return node_p->getColumnInt64 (rownrs); }
634  { return node_p->getColumnFloat (rownrs); }
636  { return node_p->getColumnDouble (rownrs); }
638  { return node_p->getColumnComplex (rownrs); }
640  { return node_p->getColumnDComplex (rownrs); }
642  { return node_p->getColumnString (rownrs); }
643 
644 inline void TableExprNode::show (ostream& os) const
645  { node_p->show (os, 0); }
646 inline const TENShPtr& TableExprNode::getRep() const
647  { return node_p; }
649  { return node_p.get(); }
650 
651 
652 
653 // Define all global functions operating on a TableExprNode.
654 // <group name=GlobalTableExprNode>
655 
656  //# Define the operations we allow.
657  //# Note that the arguments are defined as const. This is necessary
658  //# because the compiler generates temporaries when converting a constant
659  //# to a TableExprNode using the constructors. Temporaries has to be const.
660  //# However, we have to delete created nodes, so lnode_p and rnode_p
661  //# cannot be const. The const arguments are casted to a non-const in
662  //# the function fill which calls the non-const function simplify.
663 
664  // Arithmetic operators for numeric TableExprNode's.
665  // <group>
666  // + is also defined for strings (means concatenation).
668  const TableExprNode& right);
670  const TableExprNode& right);
672  const TableExprNode& right);
674  const TableExprNode& right);
676  const TableExprNode& right);
678  const TableExprNode& right);
680  const TableExprNode& right);
682  const TableExprNode& right);
683  // </group>
684 
685  // Comparison operators.
686  // <group>
688  const TableExprNode& right);
690  const TableExprNode& right);
691  // Not defined for Bool.
692  // <group>
694  const TableExprNode& right);
696  const TableExprNode& right);
698  const TableExprNode& right);
700  const TableExprNode& right);
701  // </group>
702  // </group>
703 
704  // Logical operators to combine boolean TableExprNode's.
705  // A null TableExprNode object is ignored, so it is possible to
706  // build up a full expression gradually.
707  // <group>
709  const TableExprNode& right);
711  const TableExprNode& right);
712  // </group>
713 
714  // Functions to return whether a value is "relatively" near another.
715  // Returns <src> tol > abs(val2 - val1)/max(abs(val1),(val2))</src>.
716  // If tol <= 0, returns val1 == val2. If either val is 0.0, takes
717  // care of area around the minimum number that can be represented.
718  // <br>The nearAbs functions return whether a value is "absolutely" near
719  // another. Returns <src> tol > abs(val2 - val1)</src>.
720  // Default tolerance is 1.0e-13.
721  // They operate on scalars and arrays.
722  // <group>
723  TableExprNode near (const TableExprNode& left,
724  const TableExprNode& right);
725  TableExprNode near (const TableExprNode& left,
726  const TableExprNode& right,
727  const TableExprNode& tolerance);
728  TableExprNode nearAbs (const TableExprNode& left,
729  const TableExprNode& right);
730  TableExprNode nearAbs (const TableExprNode& left,
731  const TableExprNode& right,
732  const TableExprNode& tolerance);
733  // </group>
734 
735  // Angular distance between positions.
736  // Both arguments have to be arrays. If both arrays contain 2 values
737  // (ra and dec), the result is a scalar.
738  // Otherwise the arrays have to contain a multiple of 2 values and the
739  // result is a 2-dim array giving the distance of each position in the
740  // first array to each position in the second array.
741  TableExprNode angdist (const TableExprNode& pos1,
742  const TableExprNode& pos2);
743 
744  // Angular distance as above, but only pair-wise enties are used if
745  // both arguments are arrays.
746  TableExprNode angdistx (const TableExprNode& pos1,
747  const TableExprNode& pos2);
748 
749  // Cone search; test if the position of a source is inside a cone.
750  // <br>Argument <src>sourcePos</src> must be a double array
751  // containing two values (ra and dec of source) in radians.
752  // <br>Argument <src>cones</src> must be a double array
753  // specifying the position of the cone centers and radii in radians.
754  // So the array must contain three values (ra,dec,radius)
755  // or a multiple of it.
756  // <group>
757  // The result is a bool array telling for each cone if it contains the
758  // source. If there is only one cone, the result is a scalar.
759  TableExprNode cones (const TableExprNode& sourcePos,
760  const TableExprNode& cones);
761  // The result is always a Bool scalar telling if any cone contains
762  // the source.
763  TableExprNode anyCone (const TableExprNode& sourcePos,
764  const TableExprNode& cones);
765  // The sourcePos can contain multiple sources.
766  // The result is a double array giving the index of the first
767  // cone containing the corresponding source.
768  // If there is one source, the result is a double scalar.
769  TableExprNode findCone (const TableExprNode& sourcePos,
770  const TableExprNode& cones);
771  // </group>
772 
773  // Cone search as above.
774  // However, the cone positions and radii are specified separately
775  // and (virtually) a larger array containing every combination of
776  // position/radius is formed.
777  // <group>
778  TableExprNode cones (const TableExprNode& sourcePos,
779  const TableExprNode& conePos,
780  const TableExprNode& radii);
781  TableExprNode anyCone (const TableExprNode& sourcePos,
782  const TableExprNode& conePos,
783  const TableExprNode& radii);
784  TableExprNode findCone (const TableExprNode& sourcePos,
785  const TableExprNode& conePos,
786  const TableExprNode& radii);
787  // </group>
788 
789  // Transcendental functions that can be applied to essentially all numeric
790  // nodes containing scalars or arrays.
791  // <group>
792  TableExprNode sin (const TableExprNode& node);
793  TableExprNode sinh (const TableExprNode& node);
794  TableExprNode cos (const TableExprNode& node);
795  TableExprNode cosh (const TableExprNode& node);
796  TableExprNode exp (const TableExprNode& node);
797  TableExprNode log (const TableExprNode& node);
798  TableExprNode log10 (const TableExprNode& node);
799  TableExprNode pow (const TableExprNode& x, const TableExprNode& exp);
800  TableExprNode square (const TableExprNode& node);
801  TableExprNode cube (const TableExprNode& node);
802  TableExprNode sqrt (const TableExprNode& node);
803  TableExprNode norm (const TableExprNode& node);
804  // </group>
805 
806  // Transcendental functions applied to to nodes containing scalars or
807  // arrays with double values.
808  // They are invalid for Complex nodes.
809  // <group>
810  TableExprNode asin (const TableExprNode& node);
811  TableExprNode acos (const TableExprNode& node);
812  TableExprNode atan (const TableExprNode& node);
814  const TableExprNode& x);
815  TableExprNode tan (const TableExprNode& node);
816  TableExprNode tanh (const TableExprNode& node);
817  TableExprNode sign (const TableExprNode& node);
818  TableExprNode round (const TableExprNode& node);
819  TableExprNode ceil (const TableExprNode& node);
820  TableExprNode abs (const TableExprNode& node);
821  TableExprNode floor (const TableExprNode& node);
822  TableExprNode fmod (const TableExprNode& x,
823  const TableExprNode& y);
824  // </group>
825 
826  // String functions on scalars or arrays.
827  // <group>
828  TableExprNode strlength (const TableExprNode& node);
829  TableExprNode upcase (const TableExprNode& node);
830  TableExprNode downcase (const TableExprNode& node);
832  TableExprNode trim (const TableExprNode& node);
833  TableExprNode ltrim (const TableExprNode& node);
834  TableExprNode rtrim (const TableExprNode& node);
835  TableExprNode substr (const TableExprNode& str,
836  const TableExprNode& pos);
837  TableExprNode substr (const TableExprNode& str,
838  const TableExprNode& pos,
839  const TableExprNode& npos);
840  TableExprNode replace (const TableExprNode& str,
841  const TableExprNode& patt);
842  TableExprNode replace (const TableExprNode& str,
843  const TableExprNode& patt,
844  const TableExprNode& repl);
845  // </group>
846 
847  // Functions for regular expression matching and
848  // pattern matching. Defined for scalars and arrays.
849  // <br><src>pattern</src> is for a file name like pattern.
850  // <br><src>sqlpattern</src> is for an SQL like pattern.
851  // <group>
852  TableExprNode regex (const TableExprNode& node);
853  TableExprNode pattern (const TableExprNode& node);
854  TableExprNode sqlpattern (const TableExprNode& node);
855  // </group>
856 
857  // Functions for date-values. Defined for scalars and arrays.
858  //# Note, ctod is called ctodt, because Mac OS-X defines a macro
859  //# ctod in param.h
860  // <group>
861  TableExprNode datetime (const TableExprNode& node);
862  TableExprNode mjdtodate (const TableExprNode& node);
863  TableExprNode mjd (const TableExprNode& node);
864  TableExprNode date (const TableExprNode& node);
865  TableExprNode year (const TableExprNode& node);
866  TableExprNode month (const TableExprNode& node);
867  TableExprNode day (const TableExprNode& node);
868  TableExprNode cmonth (const TableExprNode& node);
869  TableExprNode weekday (const TableExprNode& node);
870  TableExprNode cdow (const TableExprNode& node);
871  TableExprNode ctodt (const TableExprNode& node);
872  TableExprNode cdate (const TableExprNode& node);
873  TableExprNode ctime (const TableExprNode& node);
874  TableExprNode week (const TableExprNode& node);
875  TableExprNode time (const TableExprNode& node);
876  // </group>
877 
878  // Functions for angle-values. Defined for scalars and arrays.
879  // dhms converts pairs of values to hms and dms and only works for arrays.
880  // <group>
881  TableExprNode hms (const TableExprNode& node);
882  TableExprNode dms (const TableExprNode& node);
883  TableExprNode hdms (const TableExprNode& node);
884  // </group>
885 
886  // Function to convert any value to a string.
887  // See TaQL note 199 for possible format values.
888  // <group>
889  TableExprNode toString (const TableExprNode& node);
890  TableExprNode toString (const TableExprNode& node,
891  const TableExprNode& format);
892  // </group>
893 
894  // Function to test if a scalar or array is NaN (not-a-number).
895  // It results in a Bool scalar or array.
896  TableExprNode isNaN (const TableExprNode& node);
897 
898  // Function to test if a scalar or array is finite.
899  // It results in a Bool scalar or array.
900  TableExprNode isFinite (const TableExprNode& node);
901 
902  // Minimum or maximum of 2 nodes.
903  // Makes sense for numeric and String values. For Complex values
904  // the norm is compared.
905  // One or both arguments can be scalar or array.
906  // <group>
907  TableExprNode min (const TableExprNode& a, const TableExprNode& b);
908  TableExprNode max (const TableExprNode& a, const TableExprNode& b);
909  // </group>
910 
911  // The complex conjugate of a complex node.
912  // Defined for scalars and arrays.
913  TableExprNode conj (const TableExprNode& node);
914 
915  // The real part of a complex node.
916  // Defined for scalars and arrays.
917  TableExprNode real (const TableExprNode& node);
918 
919  // The imaginary part of a complex node.
920  // Defined for scalars and arrays.
921  TableExprNode imag (const TableExprNode& node);
922 
923  // Convert double, bool, or string to int (using floor).
924  TableExprNode integer (const TableExprNode& node);
925 
926  // Convert numeric or string value to bool (0, no, false, - means false)
927  TableExprNode boolean (const TableExprNode& node);
928 
929  // The amplitude (i.e. sqrt(re*re + im*im)) of a complex node.
930  // This is a synonym for function abs.
931  // Defined for scalars and arrays.
932  TableExprNode amplitude (const TableExprNode& node);
933 
934  // The phase (i.e. atan2(im, re)) of a complex node.
935  // This is a synonym for function arg.
936  // Defined for scalars and arrays.
937  TableExprNode phase (const TableExprNode& node);
938 
939  // The arg (i.e. atan2(im, re)) of a complex node.
940  // Defined for scalars and arrays.
941  TableExprNode arg (const TableExprNode& node);
942 
943  // Form a complex number from two Doubles.
944  // One or both arguments can be scalar or array.
946  const TableExprNode& imag);
947  // Form a complex number from a string.
948  // Defined for scalars and arrays.
950 
951  // Functions operating on a Double or Complex scalar or array resulting in
952  // a scalar with the same data type.
953  // <group>
954  TableExprNode sum (const TableExprNode& array);
955  TableExprNode product (const TableExprNode& array);
956  TableExprNode sumSquare (const TableExprNode& array);
957  // </group>
958 
959  // Functions operating on a Double scalar or array resulting in
960  // a Double scalar.
961  // <group>
962  TableExprNode min (const TableExprNode& array);
963  TableExprNode max (const TableExprNode& array);
964  TableExprNode mean (const TableExprNode& array);
965  TableExprNode variance (const TableExprNode& array);
966  TableExprNode stddev (const TableExprNode& array);
967  TableExprNode avdev (const TableExprNode& array);
968  TableExprNode rms (const TableExprNode& array);
969  TableExprNode median (const TableExprNode& array);
970  TableExprNode fractile (const TableExprNode& array,
971  const TableExprNode& fraction);
972  // </group>
973 
974  // <group>
975  TableExprNode any (const TableExprNode& array);
976  TableExprNode all (const TableExprNode& array);
977  TableExprNode ntrue (const TableExprNode& array);
978  TableExprNode nfalse (const TableExprNode& array);
979  // </group>
980 
981  // The partial version of the functions above.
982  // They are applied to the array subsets defined by the axes in the set
983  // using the partialXXX functions in ArrayMath.
984  // The axes must be 0-relative.
985  // <group>
986  TableExprNode sums (const TableExprNode& array,
987  const TableExprNodeSet& collapseAxes);
988  TableExprNode products (const TableExprNode& array,
989  const TableExprNodeSet& collapseAxes);
990  TableExprNode sumSquares (const TableExprNode& array,
991  const TableExprNodeSet& collapseAxes);
992  TableExprNode mins (const TableExprNode& array,
993  const TableExprNodeSet& collapseAxes);
994  TableExprNode maxs (const TableExprNode& array,
995  const TableExprNodeSet& collapseAxes);
996  TableExprNode means (const TableExprNode& array,
997  const TableExprNodeSet& collapseAxes);
998  TableExprNode variances (const TableExprNode& array,
999  const TableExprNodeSet& collapseAxes);
1000  TableExprNode stddevs (const TableExprNode& array,
1001  const TableExprNodeSet& collapseAxes);
1002  TableExprNode avdevs (const TableExprNode& array,
1003  const TableExprNodeSet& collapseAxes);
1004  TableExprNode rmss (const TableExprNode& array,
1005  const TableExprNodeSet& collapseAxes);
1006  TableExprNode medians (const TableExprNode& array,
1007  const TableExprNodeSet& collapseAxes);
1008  TableExprNode fractiles (const TableExprNode& array,
1009  const TableExprNode& fraction,
1010  const TableExprNodeSet& collapseAxes);
1011  TableExprNode anys (const TableExprNode& array,
1012  const TableExprNodeSet& collapseAxes);
1013  TableExprNode alls (const TableExprNode& array,
1014  const TableExprNodeSet& collapseAxes);
1015  TableExprNode ntrues (const TableExprNode& array,
1016  const TableExprNodeSet& collapseAxes);
1017  TableExprNode nfalses (const TableExprNode& array,
1018  const TableExprNodeSet& collapseAxes);
1019  // </group>
1020 
1021  // Functions operating for each element on a box around that element.
1022  // The elements at the edges (where no full box can be made) are set to 0.
1023  // <group>
1024  TableExprNode runningMin (const TableExprNode& array,
1025  const TableExprNodeSet& halfBoxWidth);
1026  TableExprNode runningMax (const TableExprNode& array,
1027  const TableExprNodeSet& halfBoxWidth);
1028  TableExprNode runningMean (const TableExprNode& array,
1029  const TableExprNodeSet& halfBoxWidth);
1031  const TableExprNodeSet& halfBoxWidth);
1033  const TableExprNodeSet& halfBoxWidth);
1035  const TableExprNodeSet& halfBoxWidth);
1036  TableExprNode runningRms (const TableExprNode& array,
1037  const TableExprNodeSet& halfBoxWidth);
1039  const TableExprNodeSet& halfBoxWidth);
1040  TableExprNode runningAny (const TableExprNode& array,
1041  const TableExprNodeSet& halfBoxWidth);
1042  TableExprNode runningAll (const TableExprNode& array,
1043  const TableExprNodeSet& halfBoxWidth);
1044  // </group>
1045 
1046  // Create an array of the given shape and fill it with the values.
1047  // The <src>values</src> array is rewound as needed.
1048  TableExprNode array (const TableExprNode& values,
1049  const TableExprNodeSet& shape);
1050 
1051  // Form a masked array.
1052  TableExprNode marray (const TableExprNode& array,
1053  const TableExprNode& mask);
1054 
1055  // Get the data array of a masked array.
1056  TableExprNode arrayData (const TableExprNode& array);
1057 
1058  // Flatten a masked array (get unmasked elements).
1059  TableExprNode arrayFlatten (const TableExprNode& array);
1060 
1061  // Get the mask of a masked array.
1062  // If the array has no mask, it return an array with all False values.
1063  TableExprNode arrayMask (const TableExprNode& array);
1064 
1065  // Get the diagonal of a (masked) array;
1066  // If the array is not a Matrix, it will take the diagonals of the
1067  // subarrays given by the two axes in the axes argument. Those
1068  // axes have to have the same length (thus each subarray is a Matrix).
1069  // If no axes are given, they default to the first two axes.
1070  // <br>The <src>diag</src> argument tells which diagonal to take.
1071  // 0 is the main diagonal, >0 is above main diagonal, <0 is below.
1072  TableExprNode diagonal (const TableExprNode& array);
1073  TableExprNode diagonal (const TableExprNode& array,
1074  const TableExprNode& firstAxis);
1075  TableExprNode diagonal (const TableExprNode& array,
1076  const TableExprNode& firstAxis,
1077  const TableExprNode& diag);
1078 
1079  // Transpose all axes of a (masked) array.
1080  TableExprNode transpose (const TableExprNode& array);
1081  // Transpose a (masked) array by making the given axes the first axes.
1082  TableExprNode transpose (const TableExprNode& array,
1083  const TableExprNode& axes);
1084 
1085  // Function operating on a field resulting in a bool scalar.
1086  // It can be used to test if a column has an array in the current row.
1087  // It can also be used to test if a record contains a field.
1088  TableExprNode isdefined (const TableExprNode& array);
1089 
1090  // Functions operating on any scalar or array resulting in a Double scalar.
1091  // A scalar has 1 element and dimensionality 0.
1092  // <group>
1093  TableExprNode nelements (const TableExprNode& array);
1094  TableExprNode ndim (const TableExprNode& array);
1095  // </group>
1096 
1097  // Function operating on any scalar or array resulting in a Double array
1098  // containing the shape. A scalar has shape [1].
1099  TableExprNode shape (const TableExprNode& array);
1100 
1101  // Function resembling the ternary <src>?:</src> construct in C++.
1102  // The argument "condition" has to be a Bool value.
1103  // If an element in "condition" is True, the corresponding element from
1104  // "arg1" is taken, otherwise it is taken from "arg2".
1105  // The arguments can be scalars or array or any combination.
1106  TableExprNode iif (const TableExprNode& condition,
1107  const TableExprNode& arg1,
1108  const TableExprNode& arg2);
1109 // </group>
1110 
1111 
1112 
1114  const TableExprNode& right)
1115 {
1116  return left.newPlus (right.getRep());
1117 }
1119  const TableExprNode& right)
1120 {
1121  return left.newMinus (right.getRep());
1122 }
1124  const TableExprNode& right)
1125 {
1126  return left.newTimes (right.getRep());
1127 }
1129  const TableExprNode& right)
1130 {
1131  return left.newDivide (right.getRep());
1132 }
1134  const TableExprNode& right)
1135 {
1136  return left.newModulo (right.getRep());
1137 }
1139  const TableExprNode& right)
1140 {
1141  return left.newBitAnd (right.getRep());
1142 }
1144  const TableExprNode& right)
1145 {
1146  return left.newBitOr (right.getRep());
1147 }
1149  const TableExprNode& right)
1150 {
1151  return left.newBitXor (right.getRep());
1152 }
1154  const TableExprNode& right)
1155 {
1156  return left.newEQ (right.getRep());
1157 }
1159  const TableExprNode& right)
1160 {
1161  return left.newNE (right.getRep());
1162 }
1164  const TableExprNode& right)
1165 {
1166  return left.newGT (right.getRep());
1167 }
1169  const TableExprNode& right)
1170 {
1171  return left.newGE (right.getRep());
1172 }
1174  const TableExprNode& right)
1175 {
1176  return right.newGE (left.getRep());
1177 }
1179  const TableExprNode& right)
1180 {
1181  return right.newGT (left.getRep());
1182 }
1184  const TaQLStyle& style) const
1185 {
1186  return newIN (right.getRep(), style);
1187 }
1189 {
1190  // C++ indexing is 0-based.
1191  return newArrayPartNode (*this, indices, TaQLStyle(0));
1192 }
1193 
1194 inline TableExprNode near (const TableExprNode& left,
1195  const TableExprNode& right)
1196 {
1198  left, right);
1199 }
1200 inline TableExprNode near (const TableExprNode& left,
1201  const TableExprNode& right,
1202  const TableExprNode& tolerance)
1203 {
1205  left, right, tolerance);
1206 }
1208  const TableExprNode& right)
1209 {
1211  left, right);
1212 }
1214  const TableExprNode& right,
1215  const TableExprNode& tolerance)
1216 {
1218  left, right, tolerance);
1219 }
1221  const TableExprNode& pos2)
1222 {
1224  pos1, pos2);
1225 }
1227  const TableExprNode& pos2)
1228 {
1230  pos1, pos2);
1231 }
1232 inline TableExprNode cones (const TableExprNode& sourcePos,
1233  const TableExprNode& cones)
1234 {
1236  sourcePos, cones);
1237 }
1238 inline TableExprNode anyCone (const TableExprNode& sourcePos,
1239  const TableExprNode& cones)
1240 {
1242  sourcePos, cones);
1243 }
1244 inline TableExprNode findCone (const TableExprNode& sourcePos,
1245  const TableExprNode& cones)
1246 {
1248  sourcePos, cones);
1249 }
1250 inline TableExprNode cones (const TableExprNode& sourcePos,
1251  const TableExprNode& conePos,
1252  const TableExprNode& radii)
1253 {
1255  sourcePos, conePos, radii);
1256 }
1257 inline TableExprNode anyCone (const TableExprNode& sourcePos,
1258  const TableExprNode& conePos,
1259  const TableExprNode& radii)
1260 {
1262  sourcePos, conePos, radii);
1263 }
1264 inline TableExprNode findCone (const TableExprNode& sourcePos,
1265  const TableExprNode& conePos,
1266  const TableExprNode& radii)
1267 {
1269  sourcePos, conePos, radii);
1270 }
1271 inline TableExprNode cos (const TableExprNode& node)
1272 {
1274 }
1275 inline TableExprNode cosh (const TableExprNode& node)
1276 {
1278 }
1279 inline TableExprNode exp (const TableExprNode& node)
1280 {
1282 }
1283 inline TableExprNode log (const TableExprNode& node)
1284 {
1286 }
1287 inline TableExprNode log10 (const TableExprNode& node)
1288 {
1290 }
1291 inline TableExprNode pow (const TableExprNode& x, const TableExprNode& y)
1292 {
1294 }
1295 inline TableExprNode sin (const TableExprNode& node)
1296 {
1298 }
1299 inline TableExprNode sinh (const TableExprNode& node)
1300 {
1302 }
1303 inline TableExprNode square (const TableExprNode& node)
1304 {
1306  node);
1307 }
1308 inline TableExprNode cube (const TableExprNode& node)
1309 {
1311  node);
1312 }
1313 inline TableExprNode sqrt (const TableExprNode& node)
1314 {
1316 }
1317 inline TableExprNode norm (const TableExprNode& node)
1318 {
1320 }
1321 inline TableExprNode acos (const TableExprNode& node)
1322 {
1324 }
1325 inline TableExprNode asin (const TableExprNode& node)
1326 {
1328 }
1329 inline TableExprNode atan (const TableExprNode& node)
1330 {
1332 }
1333 inline TableExprNode atan2 (const TableExprNode& y, const TableExprNode& x)
1334 {
1336 }
1337 inline TableExprNode sign (const TableExprNode& node)
1338 {
1340 }
1341 inline TableExprNode round (const TableExprNode& node)
1342 {
1344 }
1345 inline TableExprNode ceil (const TableExprNode& node)
1346 {
1348 }
1349 inline TableExprNode abs (const TableExprNode& node)
1350 {
1352 }
1353 inline TableExprNode floor (const TableExprNode& node)
1354 {
1356 }
1357 inline TableExprNode fmod (const TableExprNode& x, const TableExprNode& y)
1358 {
1360 }
1361 inline TableExprNode tan (const TableExprNode& node)
1362 {
1364 }
1365 inline TableExprNode tanh (const TableExprNode& node)
1366 {
1368 }
1369 inline TableExprNode min (const TableExprNode& a, const TableExprNode& b)
1370 {
1372 }
1373 inline TableExprNode max (const TableExprNode& a, const TableExprNode& b)
1374 {
1376 }
1377 inline TableExprNode real (const TableExprNode& node)
1378 {
1380 }
1381 inline TableExprNode imag (const TableExprNode& node)
1382 {
1384 }
1386 {
1388 }
1390 {
1392 }
1393 inline TableExprNode conj (const TableExprNode& node)
1394 {
1396 }
1398 {
1400 }
1401 inline TableExprNode arg (const TableExprNode& node)
1402 {
1404 }
1405 inline TableExprNode phase (const TableExprNode& node)
1406 {
1408 }
1410  const TableExprNode& imag)
1411 {
1413  real, imag);
1414 }
1416 {
1418  node);
1419 }
1421 {
1423  node);
1424 }
1425 inline TableExprNode upcase (const TableExprNode& node)
1426 {
1428  node);
1429 }
1431 {
1433  node);
1434 }
1436 {
1438  node);
1439 }
1440 inline TableExprNode regex (const TableExprNode& node)
1441 {
1443 }
1445 {
1447  node);
1448 }
1450 {
1452  node);
1453 }
1455 {
1457  node);
1458 }
1460 {
1462  node);
1463 }
1464 inline TableExprNode mjd (const TableExprNode& node)
1465 {
1467 }
1468 inline TableExprNode date (const TableExprNode& node)
1469 {
1471 }
1472 inline TableExprNode year (const TableExprNode& node)
1473 {
1475 }
1476 inline TableExprNode month (const TableExprNode& node)
1477 {
1479 }
1480 inline TableExprNode day (const TableExprNode& node)
1481 {
1483 }
1484 inline TableExprNode cmonth (const TableExprNode& node)
1485 {
1487  node);
1488 }
1490 {
1492  node);
1493 }
1494 inline TableExprNode cdow (const TableExprNode& node)
1495 {
1497 }
1498 inline TableExprNode ctodt (const TableExprNode& node)
1499 {
1501 }
1502 inline TableExprNode cdate (const TableExprNode& node)
1503 {
1505 }
1506 inline TableExprNode ctime (const TableExprNode& node)
1507 {
1509 }
1510 inline TableExprNode hms (const TableExprNode& node)
1511 {
1513 }
1514 inline TableExprNode dms (const TableExprNode& node)
1515 {
1517 }
1518 inline TableExprNode hdms (const TableExprNode& node)
1519 {
1521 }
1523 {
1525  node);
1526 }
1528  const TableExprNode& format)
1529 {
1531  node, format);
1532 }
1533 inline TableExprNode week (const TableExprNode& node)
1534 {
1536 }
1537 inline TableExprNode time (const TableExprNode& node)
1538 {
1540 }
1541 inline TableExprNode trim (const TableExprNode& node)
1542 {
1544 }
1545 inline TableExprNode ltrim (const TableExprNode& node)
1546 {
1548 }
1549 inline TableExprNode rtrim (const TableExprNode& node)
1550 {
1552 }
1553 inline TableExprNode substr (const TableExprNode& node,
1554  const TableExprNode& pos)
1555 {
1557  node, pos);
1558 }
1559 inline TableExprNode substr (const TableExprNode& node,
1560  const TableExprNode& pos,
1561  const TableExprNode& npos)
1562 {
1564  node, pos, npos);
1565 }
1567  const TableExprNode& patt)
1568 {
1570  node, patt);
1571 }
1573  const TableExprNode& patt,
1574  const TableExprNode& repl)
1575 {
1577  node, patt, repl);
1578 }
1579 inline TableExprNode isNaN (const TableExprNode& node)
1580 {
1582 }
1583 inline TableExprNode isInf (const TableExprNode& node)
1584 {
1586 }
1588 {
1590  node);
1591 }
1592 inline TableExprNode min (const TableExprNode& node)
1593 {
1595  node);
1596 }
1597 inline TableExprNode max (const TableExprNode& node)
1598 {
1600  node);
1601 }
1602 inline TableExprNode sum (const TableExprNode& node)
1603 {
1605  node);
1606 }
1608 {
1610  node);
1611 }
1613 {
1615  node);
1616 }
1617 inline TableExprNode mean (const TableExprNode& node)
1618 {
1620  node);
1621 }
1623 {
1625  node);
1626 }
1627 inline TableExprNode stddev (const TableExprNode& node)
1628 {
1630  node);
1631 }
1632 inline TableExprNode avdev (const TableExprNode& node)
1633 {
1635  node);
1636 }
1637 inline TableExprNode rms (const TableExprNode& node)
1638 {
1640  node);
1641 }
1642 inline TableExprNode median (const TableExprNode& node)
1643 {
1645  node);
1646 }
1648  const TableExprNode& fraction)
1649 {
1651  node, fraction);
1652 }
1653 inline TableExprNode any (const TableExprNode& node)
1654 {
1656 }
1657 inline TableExprNode all (const TableExprNode& node)
1658 {
1660 }
1661 inline TableExprNode ntrue (const TableExprNode& node)
1662 {
1664 }
1665 inline TableExprNode nfalse (const TableExprNode& node)
1666 {
1668 }
1669 inline TableExprNode sums (const TableExprNode& array,
1670  const TableExprNodeSet& axes)
1671 {
1673  array, axes);
1674 }
1675 inline TableExprNode products (const TableExprNode& array,
1676  const TableExprNodeSet& axes)
1677 {
1679  array, axes);
1680 }
1682  const TableExprNodeSet& axes)
1683 {
1685  array, axes);
1686 }
1687 inline TableExprNode mins (const TableExprNode& array,
1688  const TableExprNodeSet& axes)
1689 {
1691  array, axes);
1692 }
1693 inline TableExprNode maxs (const TableExprNode& array,
1694  const TableExprNodeSet& axes)
1695 {
1697  array, axes);
1698 }
1699 inline TableExprNode means (const TableExprNode& array,
1700  const TableExprNodeSet& axes)
1701 {
1703  array, axes);
1704 }
1706  const TableExprNodeSet& axes)
1707 {
1709  array, axes);
1710 }
1711 inline TableExprNode stddevs (const TableExprNode& array,
1712  const TableExprNodeSet& axes)
1713 {
1715  array, axes);
1716 }
1717 inline TableExprNode avdevs (const TableExprNode& array,
1718  const TableExprNodeSet& axes)
1719 {
1721  array, axes);
1722 }
1723 inline TableExprNode rmss (const TableExprNode& array,
1724  const TableExprNodeSet& axes)
1725 {
1727  array, axes);
1728 }
1729 inline TableExprNode medians (const TableExprNode& array,
1730  const TableExprNodeSet& axes)
1731 {
1733  array, axes);
1734 }
1736  const TableExprNode& fraction,
1737  const TableExprNodeSet& axes)
1738 {
1740  array, fraction, axes);
1741 }
1742 inline TableExprNode anys (const TableExprNode& array,
1743  const TableExprNodeSet& axes)
1744 {
1746  array, axes);
1747 }
1748 inline TableExprNode alls (const TableExprNode& array,
1749  const TableExprNodeSet& axes)
1750 {
1752  array, axes);
1753 }
1754 inline TableExprNode ntrues (const TableExprNode& array,
1755  const TableExprNodeSet& axes)
1756 {
1758  array, axes);
1759 }
1760 inline TableExprNode nfalses (const TableExprNode& array,
1761  const TableExprNodeSet& axes)
1762 {
1764  array, axes);
1765 }
1767  const TableExprNodeSet& halfBoxWidth)
1768 {
1770  node, halfBoxWidth);
1771 }
1773  const TableExprNodeSet& halfBoxWidth)
1774 {
1776  node, halfBoxWidth);
1777 }
1779  const TableExprNodeSet& halfBoxWidth)
1780 {
1782  node, halfBoxWidth);
1783 }
1785  const TableExprNodeSet& halfBoxWidth)
1786 {
1788  node, halfBoxWidth);
1789 }
1791  const TableExprNodeSet& halfBoxWidth)
1792 {
1794  node, halfBoxWidth);
1795 }
1797  const TableExprNodeSet& halfBoxWidth)
1798 {
1800  node, halfBoxWidth);
1801 }
1803  const TableExprNodeSet& halfBoxWidth)
1804 {
1806  node, halfBoxWidth);
1807 }
1809  const TableExprNodeSet& halfBoxWidth)
1810 {
1812  node, halfBoxWidth);
1813 }
1815  const TableExprNodeSet& halfBoxWidth)
1816 {
1818  node, halfBoxWidth);
1819 }
1821  const TableExprNodeSet& halfBoxWidth)
1822 {
1824  node, halfBoxWidth);
1825 }
1827  const TableExprNodeSet& halfBoxWidth)
1828 {
1830  node, halfBoxWidth);
1831 }
1833  const TableExprNodeSet& halfBoxWidth)
1834 {
1836  node, halfBoxWidth);
1837 }
1839  const TableExprNodeSet& halfBoxWidth)
1840 {
1842  node, halfBoxWidth);
1843 }
1845  const TableExprNodeSet& halfBoxWidth)
1846 {
1848  node, halfBoxWidth);
1849 }
1851  const TableExprNodeSet& halfBoxWidth)
1852 {
1854  node, halfBoxWidth);
1855 }
1857  const TableExprNodeSet& halfBoxWidth)
1858 {
1860  node, halfBoxWidth);
1861 }
1863  const TableExprNodeSet& halfBoxWidth)
1864 {
1866  node, halfBoxWidth);
1867 }
1869  const TableExprNodeSet& halfBoxWidth)
1870 {
1872  node, halfBoxWidth);
1873 }
1875  const TableExprNodeSet& halfBoxWidth)
1876 {
1878  node, halfBoxWidth);
1879 }
1881  const TableExprNodeSet& halfBoxWidth)
1882 {
1884  node, halfBoxWidth);
1885 }
1886 inline TableExprNode array (const TableExprNode& values,
1887  const TableExprNodeSet& shape)
1888 {
1890  values, shape);
1891 }
1892 inline TableExprNode marray (const TableExprNode& array,
1893  const TableExprNode& mask)
1894 {
1896  array, mask);
1897 }
1899 {
1901  array);
1902 }
1904 {
1906  array);
1907 }
1909 {
1911  array);
1912 }
1914 {
1915  // Needs an empty axes argument.
1917  array,
1919 }
1921  const TableExprNodeSet& axes)
1922 {
1924  array, axes);
1925 }
1926 inline TableExprNode diagonal (const TableExprNode& array)
1927 {
1929  array,
1931 }
1933 {
1935 }
1937 {
1939 }
1940 inline TableExprNode ndim (const TableExprNode& node)
1941 {
1943 }
1944 inline TableExprNode shape (const TableExprNode& node)
1945 {
1947 }
1948 inline TableExprNode iif (const TableExprNode& condition,
1949  const TableExprNode& arg1,
1950  const TableExprNode& arg2)
1951 {
1953  condition, arg1, arg2);
1954 }
1955 
1956 
1957 
1958 } //# NAMESPACE CASACORE - END
1959 
1960 #endif
LatticeExprNode log10(const LatticeExprNode &expr)
CountedPtr< TableExprNodeRep > TENShPtr
Definition: ExprNodeRep.h:56
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
TableExprNode dms(const TableExprNode &node)
Definition: ExprNode.h:1514
TableExprNode boxedStddev(const TableExprNode &node, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1850
TableExprNode anyCone(const TableExprNode &sourcePos, const TableExprNode &cones)
The result is always a Bool scalar telling if any cone contains the source.
Definition: ExprNode.h:1238
int Int
Definition: aipstype.h:50
TableExprNode transpose(const TableExprNode &array)
Transpose all axes of a (masked) array.
Definition: ExprNode.h:1913
return angles as dms strings
Definition: ExprFuncNode.h:264
TableExprNode alls(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1748
LatticeExprNode log(const LatticeExprNode &expr)
Array< MVTime > getArrayDate(const TableExprId &id) const
Definition: ExprNode.h:604
TableExprNode useUnit(const Unit &unit) const
Use a unit for the given TableExprNode.
TENShPtr newIN(const TENShPtr &right, const TaQLStyle &) const
TENShPtr newTimes(const TENShPtr &right) const
LatticeExprNode arg(const LatticeExprNode &expr)
TableExprNode means(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1699
TableExprNode runningRms(const TableExprNode &array, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1802
uInt nrow() const
Get the number of rows in the table associated with this expression.
Definition: ExprNode.h:297
TableExprNode downcase(const TableExprNode &node)
Definition: ExprNode.h:1430
LatticeExprNode median(const LatticeExprNode &expr)
MArray< Double > getDoubleAS(const TableExprId &id) const
Definition: ExprNode.h:610
for Int, Double or Complex returning Double or Complex
Definition: ExprFuncNode.h:118
String getString(const TableExprId &id) const
Definition: ExprNode.h:592
Array< Int64 > getColumnInt64(const Vector< uInt > &rownrs) const
Definition: ExprNode.h:631
TableExprNode time(const TableExprNode &node)
Definition: ExprNode.h:1537
for any array returning Bool scalar
Definition: ExprFuncNode.h:220
TENShPtr newModulo(const TENShPtr &right) const
Main interface class to a read/write table.
Definition: Table.h:153
LatticeExprNode operator/(const LatticeExprNode &left, const LatticeExprNode &right)
TableExprNode runningVariance(const TableExprNode &array, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1784
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
DComplex getDComplex(const TableExprId &id) const
Definition: ExprNode.h:588
cone search functions, implemented in derived class
Definition: ExprFuncNode.h:279
LatticeExprNode imag(const LatticeExprNode &expr)
TableExprNode variances(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1705
for Bool array returning Int scalar
Definition: ExprFuncNode.h:201
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition: ExprNode.h:1886
Class to hold multiple table expression nodes.
Definition: ExprNodeSet.h:311
LatticeExprNode sum(const LatticeExprNode &expr)
TableExprNode(TableExprNodeRep *rep)
Construct from a node representation.
Definition: ExprNode.h:251
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
TableExprNode weekday(const TableExprNode &node)
Definition: ExprNode.h:1489
Handle class for a table column expression tree.
Definition: ExprNode.h:155
LatticeExprNode operator%(const LatticeExprNode &left, const LatticeExprNode &right)
Double getDouble(const TableExprId &id) const
Definition: ExprNode.h:586
TableExprNode runningAll(const TableExprNode &array, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1820
TableExprNode phase(const TableExprNode &node)
The phase (i.e.
Definition: ExprNode.h:1405
TENShPtr newMinus(const TENShPtr &right) const
TableExprNode operator+() const
Unary operators on numeric TableExprNode&#39;s.
TableExprNode ltrim(const TableExprNode &node)
Definition: ExprNode.h:1545
static TableExprNode newRandomNode(const Table &table)
Create rand() function node.
t * get() const
Get the underlying pointer.
Definition: CountedPtr.h:183
Bool near(const GaussianBeam &left, const GaussianBeam &other, const Double relWidthTol, const Quantity &absPaTol)
for Int, Double, Complex or String returning Bool
Definition: ExprFuncNode.h:288
LatticeExprNode ntrue(const LatticeExprNode &expr)
for Int, Double or DComplex returning Double
Definition: ExprFuncNode.h:110
LatticeExprNode operator!=(const LatticeExprNode &left, const LatticeExprNode &right)
Bool getBool(const TableExprId &id) const
Definition: ExprNode.h:582
DataType dataType() const
Get the data type of the expression.
Array< uInt > getColumnuInt(const Vector< uInt > &rownrs) const
Definition: ExprNode.h:629
const Table & table() const
Get table.
Definition: ExprNode.h:528
TableExprNode mins(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1687
LatticeExprNode fractile(const LatticeExprNode &expr, const LatticeExprNode &fraction)
Determine the value of the element at the part fraction from the beginning of the given lattice...
void adaptUnit(const Unit &)
Adapt the unit of the expression to the given unit (if not empty).
TableExprNode maxs(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1693
angular distance returning radians
Definition: ExprFuncNode.h:276
TableExprNode year(const TableExprNode &node)
Definition: ExprNode.h:1472
TableExprNode operator&(const TableExprNode &left, const TableExprNode &right)
Definition: ExprNode.h:1138
static TableExprNode newFunctionNode(TableExprFuncNode::FunctionType, const TableExprNodeSet &set, const Table &table, const TaQLStyle &=TaQLStyle(0))
Create function node of the given type with the given arguments.
LatticeExprNode exp(const LatticeExprNode &expr)
TableExprNode mjd(const TableExprNode &node)
Definition: ExprNode.h:1464
TENShPtr newAND(const TENShPtr &right) const
void applySelection(const Vector< uInt > &rownrs)
Re-create the column object for a selection of rows.
Definition: ExprNode.h:273
TENShPtr newOR(const TENShPtr &right) const
TableExprNode month(const TableExprNode &node)
Definition: ExprNode.h:1476
Abstract base class for a node in a table column expression tree.
Definition: ExprNodeRep.h:157
Array< Double > getArrayDouble(const TableExprId &id) const
Definition: ExprNode.h:598
static TableExprNode newKeyConst(const TableRecord &, const Vector< String > &fieldNames)
Create a TableExprNodeConst for a table keyword (which is handled as a constant). ...
TableExprNode boxedAvdev(const TableExprNode &node, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1856
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
TableExprNode marray(const TableExprNode &array, const TableExprNode &mask)
Form a masked array.
Definition: ExprNode.h:1892
MArray< MVTime > getDateAS(const TableExprId &id) const
Definition: ExprNode.h:616
TableExprNode runningMax(const TableExprNode &array, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1772
TableExprNode strlength(const TableExprNode &node)
String functions on scalars or arrays.
Definition: ExprNode.h:1420
LatticeExprNode any(const LatticeExprNode &expr)
Functions operating on a logical expression resulting in a scalar; Functions &quot;any&quot; (are any pixels &quot;T...
TableExprNode boxedMedian(const TableExprNode &node, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1868
LatticeExprNode floor(const LatticeExprNode &expr)
TableExprNode arrayMask(const TableExprNode &array)
Get the mask of a masked array.
Definition: ExprNode.h:1903
TableExprNode cones(const TableExprNode &sourcePos, const TableExprNode &cones)
Cone search; test if the position of a source is inside a cone.
Definition: ExprNode.h:1232
TableExprNode boolean(const TableExprNode &node)
Convert numeric or string value to bool (0, no, false, - means false)
Definition: ExprNode.h:1389
static TableExprNode newRowidNode(const Table &table)
Create rowid() function node.
MVEarthMagnetic operator*(const RotMatrix &left, const MVEarthMagnetic &right)
Rotate a EarthMagnetic vector with rotation matrix and other multiplications.
LatticeExprNode cos(const LatticeExprNode &expr)
DataType getColumnDataType() const
Get the data type for doing a getColumn on the expression.
void get(const TableExprId &id, Bool &value) const
Get a value for this node in the given row.
Definition: ExprNode.h:532
for any array returning Int scalar
Definition: ExprFuncNode.h:225
for any array returning Int array
Definition: ExprFuncNode.h:228
for Int, Double, Bool or String returning Int (using floor)
Definition: ExprFuncNode.h:116
TableExprNode rtrim(const TableExprNode &node)
Definition: ExprNode.h:1549
TableExprNode pattern(const TableExprNode &node)
Definition: ExprNode.h:1444
LatticeExprNode operator>=(const LatticeExprNode &left, const LatticeExprNode &right)
void ranges(Block< TableExprRange > &)
Convert the tree to a number of range vectors which at least select the same things.
Definition: ExprNode.h:524
TENShPtr node_p
The actual (counted referenced) representation of a node.
Definition: ExprNode.h:519
const TableExprNodeRep * getNodeRep() const
Definition: ExprNode.h:648
defines physical units
Definition: Unit.h:189
LatticeExprNode conj(const LatticeExprNode &expr)
void show(ostream &) const
Show the tree.
Definition: ExprNode.h:644
Array< Int64 > getArrayInt(const TableExprId &id) const
Definition: ExprNode.h:596
Array< uShort > getColumnuShort(const Vector< uInt > &rownrs) const
Definition: ExprNode.h:625
~TableExprNode()
The destructor deletes all the underlying TableExprNode objects,.
for any type returning array of that type
Definition: ExprFuncNode.h:210
for Int, Double or DComplex returning Int, Double or Complex
Definition: ExprFuncNode.h:102
TableExprNode & operator=(const TableExprNode &)
Assignment (reference semantics).
LatticeExprNode nfalse(const LatticeExprNode &expr)
MVTime getDate(const TableExprId &id) const
Definition: ExprNode.h:590
void disableApplySelection()
Do not apply the selection.
Definition: ExprNode.h:268
Array< String > getArrayString(const TableExprId &id) const
Definition: ExprNode.h:602
special function resembling if statement
Definition: ExprFuncNode.h:274
for Double or DComplex returning Double
Definition: ExprFuncNode.h:114
TableExprNode medians(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1729
TableExprNode sumSquares(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1681
TableExprNode operator~() const
Unary bitwise negate-operator on integer TableExprNode&#39;s.
Array< Short > getColumnShort(const Vector< uInt > &rownrs) const
Definition: ExprNode.h:623
TENShPtr newBitOr(const TENShPtr &right) const
LatticeExprNode tanh(const LatticeExprNode &expr)
TableExprNode ntrues(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1754
for Int, Double or DComplex array returning Bool
Definition: ExprFuncNode.h:216
TableExprNode fractiles(const TableExprNode &array, const TableExprNode &fraction, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1735
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
TableExprNode boxedAny(const TableExprNode &node, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1874
LatticeExprNode avdev(const LatticeExprNode &expr)
const Unit & unit() const
Get the unit of the expression.
Definition: ExprNode.h:277
TableExprNode isInf(const TableExprNode &node)
Definition: ExprNode.h:1583
TableExprNode arrayFlatten(const TableExprNode &array)
Flatten a masked array (get unmasked elements).
Definition: ExprNode.h:1908
TENShPtr newDivide(const TENShPtr &right) const
for Int, Double or DComplex returning Double or Complex
Definition: ExprFuncNode.h:91
LatticeExprNode replace(const LatticeExprNode &arg1, const LatticeExprNode &arg2)
This function replaces every masked-off element in the first argument with the corresponding element ...
for Int, or Double or Complex returning Bool (2 is with default tolerance)
Definition: ExprFuncNode.h:86
Array< Complex > getColumnComplex(const Vector< uInt > &rownrs) const
Definition: ExprNode.h:637
TableExprNode operator!() const
Unary NOT-operator on boolean TableExprNode&#39;s.
static TableExprNode newRownrNode(const Table &table, uInt origin)
Create rownumber() function node.
TENShPtr newGT(const TENShPtr &right) const
Array< Double > getColumnDouble(const Vector< uInt > &rownrs) const
Definition: ExprNode.h:635
double Double
Definition: aipstype.h:55
TableExprNode cdate(const TableExprNode &node)
Definition: ExprNode.h:1502
LatticeExprNode abs(const LatticeExprNode &expr)
Numerical 1-argument functions which result in a real number regardless of input expression type...
Regular expression class.
Definition: Regex.h:198
return angles as hms/dms strings
Definition: ExprFuncNode.h:266
TableExprNode in(const TableExprNode &array, const TaQLStyle &=TaQLStyle(0)) const
The IN operator to test if a value is contained in an array or set.
Definition: ExprNode.h:1183
TableExprNode arrayData(const TableExprNode &array)
Get the data array of a masked array.
Definition: ExprNode.h:1898
TableExprNode trim(const TableExprNode &node)
Definition: ExprNode.h:1541
Class with static members defining the TaQL style.
Definition: TaQLStyle.h:64
LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
LatticeExprNode operator<=(const LatticeExprNode &left, const LatticeExprNode &right)
Array< DComplex > getArrayDComplex(const TableExprId &id) const
Definition: ExprNode.h:600
MArray< String > getStringAS(const TableExprId &id) const
Definition: ExprNode.h:614
for Int, Double or Complex array returning the same
Definition: ExprFuncNode.h:133
LatticeExprNode formComplex(const LatticeExprNode &left, const LatticeExprNode &right)
Form a complex number from two real numbers.
TableExprNode boxedAll(const TableExprNode &node, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1880
LatticeExprNode iif(const LatticeExprNode &condition, const LatticeExprNode &arg1, const LatticeExprNode &arg2)
Function resembling the ternary ?: construct in C++.
LatticeExprNode nelements(const LatticeExprNode &expr)
1-argument function to get the number of elements in a lattice.
TableExprNode anys(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1742
TableExprNode boxedMax(const TableExprNode &node, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1832
LatticeExprNode sign(const LatticeExprNode &expr)
LatticeExprNode sqrt(const LatticeExprNode &expr)
TableExprNode products(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1675
LatticeExprNode tan(const LatticeExprNode &expr)
for Int or Double returning Int or Double
Definition: ExprFuncNode.h:125
TableExprNode isFinite(const TableExprNode &node)
Function to test if a scalar or array is finite.
Definition: ExprNode.h:1587
TableExprNode runningAny(const TableExprNode &array, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1814
LatticeExprNode atan(const LatticeExprNode &expr)
MArray< Int64 > getIntAS(const TableExprId &id) const
Definition: ExprNode.h:608
TENShPtr setBinaryNodeInfo(TableExprNodeBinary *tsnptr, const TENShPtr &right=TENShPtr()) const
Put the new binary node object in a shared pointer.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
TableExprNode product(const TableExprNode &array)
Definition: ExprNode.h:1607
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
TENShPtr newGE(const TENShPtr &right) const
TableExprNode upcase(const TableExprNode &node)
Definition: ExprNode.h:1425
TableExprNode cube(const TableExprNode &node)
Definition: ExprNode.h:1308
LatticeExprNode stddev(const LatticeExprNode &expr)
TableExprNode runningMedian(const TableExprNode &array, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1808
TableExprNode angdistx(const TableExprNode &pos1, const TableExprNode &pos2)
Angular distance as above, but only pair-wise enties are used if both arguments are arrays...
Definition: ExprNode.h:1226
static std::vector< TENShPtr > convertBlockTEN(Block< TableExprNode > &nodes)
convert Block of TableExprNode to vector of TENShPtr.
for DComplex or String returning DComplex
Definition: ExprFuncNode.h:131
LatticeExprNode round(const LatticeExprNode &expr)
Array< Bool > getArrayBool(const TableExprId &id) const
Definition: ExprNode.h:594
float Float
Definition: aipstype.h:54
TableExprNode runningStddev(const TableExprNode &array, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1790
return angles as hms strings
Definition: ExprFuncNode.h:262
TableExprNode substr(const TableExprNode &str, const TableExprNode &pos)
Definition: ExprNode.h:1553
TableExprNode toString(const TableExprNode &node)
Function to convert any value to a string.
Definition: ExprNode.h:1522
TableExprNode operator-() const
TableExprNode sqlpattern(const TableExprNode &node)
Definition: ExprNode.h:1449
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
Definition: ExprNode.h:1944
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:182
LatticeExprNode operator>(const LatticeExprNode &left, const LatticeExprNode &right)
static TableExprNode newColumnNode(const Table &tab, const String &name, const Vector< String > &fieldNames)
Create a column node on behalf of the Table class.
virtual Origin origin() const =0
ABSTRACT METHODS //.
TableExprNode cmonth(const TableExprNode &node)
Definition: ExprNode.h:1484
TableExprNode operator|(const TableExprNode &left, const TableExprNode &right)
Definition: ExprNode.h:1143
LatticeExprNode atan2(const LatticeExprNode &left, const LatticeExprNode &right)
Numerical 2-argument functions.
TableExprNode integer(const TableExprNode &node)
Convert double, bool, or string to int (using floor).
Definition: ExprNode.h:1385
TableExprNode runningMean(const TableExprNode &array, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1778
TableExprNode findCone(const TableExprNode &sourcePos, const TableExprNode &cones)
The sourcePos can contain multiple sources.
Definition: ExprNode.h:1244
TableExprNode boxedMean(const TableExprNode &node, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1838
simple 1-D array
TENShPtr newBitXor(const TENShPtr &right) const
TableExprNode nfalses(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1760
TableExprNode boxedVariance(const TableExprNode &node, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1844
TableExprNode angdist(const TableExprNode &pos1, const TableExprNode &pos2)
Angular distance between positions.
Definition: ExprNode.h:1220
for Int or Double array returning Int or Double
Definition: ExprFuncNode.h:146
TableExprNode isdefined(const TableExprNode &array)
Function operating on a field resulting in a bool scalar.
Definition: ExprNode.h:1932
TableExprNode boxedRms(const TableExprNode &node, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1862
const Record & attributes() const
Get the attributes of the expression.
Definition: ExprNode.h:281
LatticeExprNode operator+(const LatticeExprNode &expr)
Global functions operating on a LatticeExprNode.
TableExprNode regex(const TableExprNode &node)
Functions for regular expression matching and pattern matching.
Definition: ExprNode.h:1440
LatticeExprNode fmod(const LatticeExprNode &left, const LatticeExprNode &right)
TableExprNode day(const TableExprNode &node)
Definition: ExprNode.h:1480
The identification of a TaQL selection subject.
Definition: TableExprId.h:97
MArray< Bool > getBoolAS(const TableExprId &id) const
Get a value as an array, even it it is a scalar.
Definition: ExprNode.h:606
LatticeExprNode asin(const LatticeExprNode &expr)
Array< DComplex > getColumnDComplex(const Vector< uInt > &rownrs) const
Definition: ExprNode.h:639
TableExprNode cdow(const TableExprNode &node)
Definition: ExprNode.h:1494
TableExprNode boxedMin(const TableExprNode &node, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1826
LatticeExprNode mean(const LatticeExprNode &expr)
TENShPtr newEQ(const TENShPtr &right) const
TableExprNode rms(const TableExprNode &array)
Definition: ExprNode.h:1637
TableExprNode runningAvdev(const TableExprNode &array, const TableExprNodeSet &halfBoxWidth)
Definition: ExprNode.h:1796
Bool checkTableSize(const Table &table, Bool canBeConst) const
Check if tables used in expression have the same number of rows as the given table.
LatticeExprNode sinh(const LatticeExprNode &expr)
for Int, Double or DComplex returning Int or Double
Definition: ExprFuncNode.h:107
Class to handle a Regex or StringDistance.
Definition: ExprNodeRep.h:81
LatticeExprNode acos(const LatticeExprNode &expr)
TableExprNode square(const TableExprNode &node)
Definition: ExprNode.h:1303
TableExprNode runningMin(const TableExprNode &array, const TableExprNodeSet &halfBoxWidth)
Functions operating for each element on a box around that element.
Definition: ExprNode.h:1766
MArray< DComplex > getDComplexAS(const TableExprId &id) const
Definition: ExprNode.h:612
for Bool array returning Bool
Definition: ExprFuncNode.h:192
static TableExprNode newUDFNode(const String &name, const TableExprNodeSet &set, const Table &table, const TaQLStyle &=TaQLStyle(0))
Create a user defined function node.
TableExprNode sumSquare(const TableExprNode &array)
Definition: ExprNode.h:1612
TableExprNode capitalize(const TableExprNode &node)
Definition: ExprNode.h:1435
LatticeExprNode operator-(const LatticeExprNode &expr)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
static TableRecord * findLastKeyRec(const TableRecord &keyset, const Vector< String > &fieldNames, String &fullName)
Handle all field names except the last one.
TableExprNode nearAbs(const TableExprNode &left, const TableExprNode &right)
Definition: ExprNode.h:1207
Array< Int > getColumnInt(const Vector< uInt > &rownrs) const
Definition: ExprNode.h:627
Bool operator==(const MVTime &lh, const MVTime &rh)
is equal operator, uses operator Double which returns days
Definition: MVTime.h:465
static TableExprNode newArrayPartNode(const TableExprNode &arrayNode, const TableExprNodeSet &indices, const TaQLStyle &=TaQLStyle(0))
Create ArrayElement node for the given array with the given index.
TableExprNode stddevs(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1711
TENShPtr newPlus(const TENShPtr &right) const
Construct a new node for the given operation.
TableExprNode datetime(const TableExprNode &node)
Functions for date-values.
Definition: ExprNode.h:1454
LatticeExprNode operator^(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode operator<(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode isNaN(const LatticeExprNode &expr)
Test if a value is a NaN.
Array< String > getColumnString(const Vector< uInt > &rownrs) const
Definition: ExprNode.h:641
TableExprNode avdevs(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1717
Class to deal with Levensthein distance of strings.
TableExprNode mjdtodate(const TableExprNode &node)
Definition: ExprNode.h:1459
Bool isNull() const
Does the node contain no actual node?
Definition: ExprNode.h:264
TableExprNode ctodt(const TableExprNode &node)
Definition: ExprNode.h:1498
static void throwInvDT(const String &message)
Throw invalid data type exception.
LatticeExprNode variance(const LatticeExprNode &expr)
LatticeExprNode ceil(const LatticeExprNode &expr)
TENShPtr newNE(const TENShPtr &right) const
LatticeExprNode pow(const LatticeExprNode &left, const LatticeExprNode &right)
for Int or Double array returning Double
Definition: ExprFuncNode.h:155
Class to handle date/time type conversions and I/O.
Definition: MVTime.h:269
TableExprNode rmss(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
Definition: ExprNode.h:1723
TableExprNode ctime(const TableExprNode &node)
Definition: ExprNode.h:1506
Array< Float > getColumnFloat(const Vector< uInt > &rownrs) const
Definition: ExprNode.h:633
TableExprNode hms(const TableExprNode &node)
Functions for angle-values.
Definition: ExprNode.h:1510
LatticeExprNode all(const LatticeExprNode &expr)
Bool isScalar() const
Is the expression a scalar?
Definition: ExprNode.h:291
TableExprNode diagonal(const TableExprNode &array)
Get the diagonal of a (masked) array; If the array is not a Matrix, it will take the diagonals of the...
Definition: ExprNode.h:1926
Array< uChar > getColumnuChar(const Vector< uInt > &rownrs) const
Definition: ExprNode.h:621
Abstract base class for a node having 0, 1, or 2 child nodes.
Definition: ExprNodeRep.h:558
TableExprNode operator()(const TableExprNodeSet &indices)
Slicing in a node containing an array.
Definition: ExprNode.h:1188
TableExprNode sums(const TableExprNode &array, const TableExprNodeSet &collapseAxes)
The partial version of the functions above.
Definition: ExprNode.h:1669
LatticeExprNode operator||(const LatticeExprNode &left, const LatticeExprNode &right)
TENShPtr newBitAnd(const TENShPtr &right) const
LatticeExprNode cosh(const LatticeExprNode &expr)
TableExprNode week(const TableExprNode &node)
Definition: ExprNode.h:1533
TableExprNode hdms(const TableExprNode &node)
Definition: ExprNode.h:1518
LatticeExprNode real(const LatticeExprNode &expr)
Int64 getInt(const TableExprId &id) const
Definition: ExprNode.h:584
const TENShPtr & getRep() const
returns const pointer to the underlying TableExprNodeRep object.
Definition: ExprNode.h:646
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
LatticeExprNode sin(const LatticeExprNode &expr)
Numerical 1-argument functions.
for Int, Double, DComplex, Bool or String returning Double
Definition: ExprFuncNode.h:112
static TableExprNode newConeNode(TableExprFuncNode::FunctionType, const TableExprNodeSet &set, uInt origin=0)
Create cone function node of the given type with the given arguments.
LatticeExprNode operator&&(const LatticeExprNode &left, const LatticeExprNode &right)
Logical binary operators.
TableExprNode norm(const TableExprNode &node)
Definition: ExprNode.h:1317
unsigned int uInt
Definition: aipstype.h:51
Array< Bool > getColumnBool(const Vector< uInt > &rownrs) const
Get the value of the expression evaluated for the entire column.
Definition: ExprNode.h:619
TableExprNode date(const TableExprNode &node)
Definition: ExprNode.h:1468
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
TableExprNode amplitude(const TableExprNode &node)
The amplitude (i.e.
Definition: ExprNode.h:1397