ExprNode.h

Go to the documentation of this file.
00001 //# ExprNode.h: Handle class for a table column expression tree
00002 //# Copyright (C) 1994,1995,1996,1997,1998,2000,2001,2003
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: ExprNode.h 21277 2012-10-31 16:07:31Z gervandiepen $
00027 
00028 #ifndef TABLES_EXPRNODE_H
00029 #define TABLES_EXPRNODE_H
00030 
00031 //# Includes
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/tables/TaQL/ExprNodeRep.h>
00034 #include <casacore/tables/TaQL/ExprRange.h>
00035 #include <casacore/tables/TaQL/ExprFuncNode.h>
00036 #include <casacore/tables/TaQL/ExprConeNode.h>
00037 #include <casacore/tables/TaQL/TaQLStyle.h>
00038 #include <casacore/tables/TaQL/MArray.h>
00039 #include <casacore/casa/Utilities/DataType.h>
00040 #include <casacore/casa/BasicSL/Complex.h>
00041 
00042 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00043 
00044 //# Forward Declarations
00045 class Table;
00046 class String;
00047 class Regex;
00048 class StringDistance;
00049 class Unit;
00050 class TableRecord;
00051 class TableExprNodeSet;
00052 template<class T> class Block;
00053 template<class T> class Array;
00054 template<class T> class MArray;
00055 class TableExprNode;
00056 
00057 
00058 // Define all global functions operating on a TableExprNode.
00059 // <group name=GlobalTableExprNode>
00060 
00061   //# Define the operations we allow.
00062   //# Note that the arguments are defined as const. This is necessary
00063   //# because the compiler generates temporaries when converting a constant
00064   //# to a TableExprNode using the constructors. Temporaries has to be const.
00065   //# However, we have to delete created nodes, so lnode_p and rnode_p
00066   //# cannot be const. The const arguments are casted to a non-const in
00067   //# the function fill which calls the non-const function simplify.
00068 
00069   // Arithmetic operators for numeric TableExprNode's.
00070   // <group>
00071     // + is also defined for strings (means concatenation).
00072     TableExprNode operator+ (const TableExprNode& left,
00073                              const TableExprNode& right);
00074     TableExprNode operator- (const TableExprNode& left,
00075                              const TableExprNode& right);
00076     TableExprNode operator* (const TableExprNode& left,
00077                              const TableExprNode& right);
00078     TableExprNode operator/ (const TableExprNode& left,
00079                              const TableExprNode& right);
00080     TableExprNode operator% (const TableExprNode& left,
00081                              const TableExprNode& right);
00082     TableExprNode operator& (const TableExprNode& left,
00083                              const TableExprNode& right);
00084     TableExprNode operator| (const TableExprNode& left,
00085                              const TableExprNode& right);
00086     TableExprNode operator^ (const TableExprNode& left,
00087                              const TableExprNode& right);
00088   // </group>
00089 
00090   // Comparison operators.
00091   // <group>
00092     TableExprNode operator== (const TableExprNode& left,
00093                               const TableExprNode& right);
00094     TableExprNode operator!= (const TableExprNode& left,
00095                               const TableExprNode& right);
00096     // Not defined for Bool.
00097     // <group>
00098     TableExprNode operator>= (const TableExprNode& left,
00099                               const TableExprNode& right);
00100     TableExprNode operator>  (const TableExprNode& left,
00101                               const TableExprNode& right);
00102     TableExprNode operator<= (const TableExprNode& left, 
00103                               const TableExprNode& right);
00104     TableExprNode operator<  (const TableExprNode& left,
00105                               const TableExprNode& right);
00106     // </group>
00107   // </group>
00108 
00109   // Logical operators to combine boolean TableExprNode's.
00110   // A null TableExprNode object is ignored, so it is possible to
00111   // build up a full expression gradually.
00112   // <group>
00113     TableExprNode operator&& (const TableExprNode& left,
00114                               const TableExprNode& right);
00115     TableExprNode operator|| (const TableExprNode& left,
00116                               const TableExprNode& right);
00117   // </group>
00118 
00119   // Functions to return whether a value is "relatively" near another.
00120   // Returns <src> tol > abs(val2 - val1)/max(abs(val1),(val2))</src>. 
00121   // If tol <= 0, returns val1 == val2. If either val is 0.0, takes
00122   // care of area around the minimum number that can be represented.
00123   // <br>The nearAbs functions return whether a value is "absolutely" near
00124   // another. Returns <src> tol > abs(val2 - val1)</src>.
00125   // Default tolerance is 1.0e-13.
00126   // They operate on scalars and arrays.
00127   // <group>
00128     TableExprNode near    (const TableExprNode& left,
00129                            const TableExprNode& right);
00130     TableExprNode near    (const TableExprNode& left,
00131                            const TableExprNode& right,
00132                            const TableExprNode& tolerance);
00133     TableExprNode nearAbs (const TableExprNode& left,
00134                            const TableExprNode& right);
00135     TableExprNode nearAbs (const TableExprNode& left,
00136                            const TableExprNode& right,
00137                            const TableExprNode& tolerance);
00138   // </group>
00139 
00140   // Angular distance between positions.
00141   // Both arguments have to be arrays. If both arrays contain 2 values
00142   // (ra and dec), the result is a scalar.
00143   // Otherwise the arrays have to contain a multiple of 2 values and the
00144   // result is a 2-dim array giving the distance of each position in the
00145   // first array to each position in the second array.
00146     TableExprNode angdist (const TableExprNode& pos1,
00147                            const TableExprNode& pos2);
00148 
00149   // Angular distance as above, but only pair-wise enties are used if
00150   // both arguments are arrays.
00151     TableExprNode angdistx (const TableExprNode& pos1,
00152                             const TableExprNode& pos2);
00153 
00154   // Cone search; test if the position of a source is inside a cone.
00155   // <br>Argument <src>sourcePos</src> must be a double array
00156   // containing two values (ra and dec of source) in radians.
00157   // <br>Argument <src>cones</src> must be a double array
00158   // specifying the position of the cone centers and radii in radians.
00159   // So the array must contain three values (ra,dec,radius)
00160   // or a multiple of it.
00161   // <group>
00162     // The result is a bool array telling for each cone if it contains the
00163     // source. If there is only one cone, the result is a scalar.
00164     TableExprNode cones (const TableExprNode& sourcePos,
00165                          const TableExprNode& cones);
00166     // The result is always a Bool scalar telling if any cone contains
00167     // the source.
00168     TableExprNode anyCone (const TableExprNode& sourcePos,
00169                            const TableExprNode& cones);
00170     // The sourcePos can contain multiple sources.
00171     // The result is a double array giving the index of the first
00172     // cone containing the corresponding source.
00173     // If there is one source, the result is a double scalar.
00174     TableExprNode findCone (const TableExprNode& sourcePos,
00175                             const TableExprNode& cones);
00176   // </group>
00177 
00178   // Cone search as above.
00179   // However, the cone positions and radii are specified separately
00180   // and (virtually) a larger array containing every combination of
00181   // position/radius is formed.
00182   // <group>
00183     TableExprNode cones (const TableExprNode& sourcePos,
00184                          const TableExprNode& conePos,
00185                          const TableExprNode& radii);
00186     TableExprNode anyCone (const TableExprNode& sourcePos,
00187                            const TableExprNode& conePos,
00188                            const TableExprNode& radii);
00189     TableExprNode findCone (const TableExprNode& sourcePos,
00190                             const TableExprNode& conePos,
00191                             const TableExprNode& radii);
00192   // </group>
00193 
00194   // Transcendental functions that can be applied to essentially all numeric
00195   // nodes containing scalars or arrays.
00196   // <group>
00197     TableExprNode sin    (const TableExprNode& node);
00198     TableExprNode sinh   (const TableExprNode& node);
00199     TableExprNode cos    (const TableExprNode& node);
00200     TableExprNode cosh   (const TableExprNode& node);
00201     TableExprNode exp    (const TableExprNode& node);
00202     TableExprNode log    (const TableExprNode& node);
00203     TableExprNode log10  (const TableExprNode& node);
00204     TableExprNode pow    (const TableExprNode& x, const TableExprNode& exp);
00205     TableExprNode square (const TableExprNode& node);
00206     TableExprNode cube   (const TableExprNode& node);
00207     TableExprNode sqrt   (const TableExprNode& node);
00208     TableExprNode norm   (const TableExprNode& node);
00209   // </group>
00210 
00211   // Transcendental functions applied to to nodes containing scalars or
00212   // arrays with double values.
00213   // They are invalid for Complex nodes.
00214   // <group>
00215     TableExprNode asin  (const TableExprNode& node);
00216     TableExprNode acos  (const TableExprNode& node);
00217     TableExprNode atan  (const TableExprNode& node);
00218     TableExprNode atan2 (const TableExprNode& y,
00219                          const TableExprNode& x);
00220     TableExprNode tan   (const TableExprNode& node);
00221     TableExprNode tanh  (const TableExprNode& node);
00222     TableExprNode sign  (const TableExprNode& node);
00223     TableExprNode round (const TableExprNode& node);
00224     TableExprNode ceil  (const TableExprNode& node);
00225     TableExprNode abs   (const TableExprNode& node);
00226     TableExprNode floor (const TableExprNode& node);
00227     TableExprNode fmod  (const TableExprNode& x,
00228                          const TableExprNode& y);
00229   // </group>
00230 
00231   // String functions on scalars or arrays.
00232   // <group>
00233     TableExprNode strlength (const TableExprNode& node);
00234     TableExprNode upcase    (const TableExprNode& node);
00235     TableExprNode downcase  (const TableExprNode& node);
00236     TableExprNode capitalize(const TableExprNode& node);
00237     TableExprNode trim      (const TableExprNode& node);
00238     TableExprNode ltrim     (const TableExprNode& node);
00239     TableExprNode rtrim     (const TableExprNode& node);
00240     TableExprNode substr    (const TableExprNode& str,
00241                              const TableExprNode& pos);
00242     TableExprNode substr    (const TableExprNode& str,
00243                              const TableExprNode& pos,
00244                              const TableExprNode& npos);
00245     TableExprNode replace   (const TableExprNode& str,
00246                              const TableExprNode& patt);
00247     TableExprNode replace   (const TableExprNode& str,
00248                              const TableExprNode& patt,
00249                              const TableExprNode& repl);
00250   // </group>
00251 
00252   // Functions for regular expression matching and 
00253   // pattern matching. Defined for scalars and arrays.
00254   // <br><src>pattern</src> is for a file name like pattern.
00255   // <br><src>sqlpattern</src> is for an SQL like pattern.
00256   // <group>
00257     TableExprNode regex      (const TableExprNode& node);
00258     TableExprNode pattern    (const TableExprNode& node);
00259     TableExprNode sqlpattern (const TableExprNode& node);
00260   // </group>
00261 
00262   // Functions for date-values. Defined for scalars and arrays.
00263   //# Note, ctod is called ctodt, because Mac OS-X defines a macro
00264   //# ctod in param.h
00265   // <group>
00266     TableExprNode datetime  (const TableExprNode& node);
00267     TableExprNode mjdtodate (const TableExprNode& node);
00268     TableExprNode mjd       (const TableExprNode& node);
00269     TableExprNode date      (const TableExprNode& node);
00270     TableExprNode year      (const TableExprNode& node);
00271     TableExprNode month     (const TableExprNode& node);
00272     TableExprNode day       (const TableExprNode& node);
00273     TableExprNode cmonth    (const TableExprNode& node);
00274     TableExprNode weekday   (const TableExprNode& node);
00275     TableExprNode cdow      (const TableExprNode& node);
00276     TableExprNode ctodt     (const TableExprNode& node);
00277     TableExprNode cdate     (const TableExprNode& node);
00278     TableExprNode ctime     (const TableExprNode& node);
00279     TableExprNode week      (const TableExprNode& node);
00280     TableExprNode time      (const TableExprNode& node);
00281   // </group>
00282 
00283   // Functions for angle-values. Defined for scalars and arrays.
00284   // dhms converts pairs of values to hms and dms and only works for arrays.
00285   // <group>
00286     TableExprNode hms  (const TableExprNode& node);
00287     TableExprNode dms  (const TableExprNode& node);
00288     TableExprNode hdms (const TableExprNode& node);
00289   // </group>
00290 
00291   // Function to convert any value to a string.
00292   // See TaQL note 199 for possible format values.
00293   // <group>
00294     TableExprNode toString (const TableExprNode& node);
00295     TableExprNode toString (const TableExprNode& node,
00296                             const TableExprNode& format);
00297   // </group>
00298 
00299   // Function to test if a scalar or array is NaN (not-a-number).
00300   // It results in a Bool scalar or array.
00301     TableExprNode isNaN (const TableExprNode& node);
00302 
00303   // Function to test if a scalar or array is finite.
00304   // It results in a Bool scalar or array.
00305     TableExprNode isFinite (const TableExprNode& node);
00306 
00307   // Minimum or maximum of 2 nodes.
00308   // Makes sense for numeric and String values. For Complex values
00309   // the norm is compared.
00310   // One or both arguments can be scalar or array.
00311   // <group>
00312     TableExprNode min (const TableExprNode& a, const TableExprNode& b);
00313     TableExprNode max (const TableExprNode& a, const TableExprNode& b);
00314   // </group>
00315 
00316   // The complex conjugate of a complex node.
00317   // Defined for scalars and arrays.
00318     TableExprNode conj (const TableExprNode& node);
00319 
00320   // The real part of a complex node.
00321   // Defined for scalars and arrays.
00322     TableExprNode real (const TableExprNode& node);
00323 
00324   // The imaginary part of a complex node.
00325   // Defined for scalars and arrays.
00326     TableExprNode imag (const TableExprNode& node);
00327 
00328   // Convert double, bool, or string to int (using floor).
00329     TableExprNode integer (const TableExprNode& node);
00330 
00331   // Convert numeric or string value to bool (0, no, false, - means false)
00332     TableExprNode boolean (const TableExprNode& node);
00333 
00334   // The amplitude (i.e. sqrt(re*re + im*im)) of a complex node.
00335   // This is a synonym for function abs.
00336   // Defined for scalars and arrays.
00337     TableExprNode amplitude (const TableExprNode& node);
00338 
00339   // The phase (i.e. atan2(im, re)) of a complex node.
00340   // This is a synonym for function arg.
00341   // Defined for scalars and arrays.
00342     TableExprNode phase (const TableExprNode& node);
00343 
00344   // The arg (i.e. atan2(im, re)) of a complex node.
00345   // Defined for scalars and arrays.
00346     TableExprNode arg (const TableExprNode& node);
00347 
00348   // Form a complex number from two Doubles.
00349   // One or both arguments can be scalar or array.
00350     TableExprNode formComplex (const TableExprNode& real,
00351                                const TableExprNode& imag);
00352   // Form a complex number from a string.
00353   // Defined for scalars and arrays.
00354     TableExprNode formComplex (const TableExprNode& node);
00355 
00356   // Functions operating on a Double or Complex scalar or array resulting in
00357   // a scalar with the same data type.
00358   // <group>
00359     TableExprNode sum (const TableExprNode& array);
00360     TableExprNode product (const TableExprNode& array);
00361     TableExprNode sumSquare (const TableExprNode& array);
00362   // </group>
00363 
00364   // Functions operating on a Double scalar or array resulting in
00365   // a Double scalar.
00366   // <group>
00367     TableExprNode min (const TableExprNode& array);
00368     TableExprNode max (const TableExprNode& array);
00369     TableExprNode mean (const TableExprNode& array);
00370     TableExprNode variance (const TableExprNode& array);
00371     TableExprNode stddev (const TableExprNode& array);
00372     TableExprNode avdev (const TableExprNode& array);
00373     TableExprNode rms (const TableExprNode& array);
00374     TableExprNode median (const TableExprNode& array);
00375     TableExprNode fractile (const TableExprNode& array,
00376                             const TableExprNode& fraction);
00377   // </group>
00378 
00379   // <group>
00380     TableExprNode any (const TableExprNode& array);
00381     TableExprNode all (const TableExprNode& array);
00382     TableExprNode ntrue (const TableExprNode& array);
00383     TableExprNode nfalse (const TableExprNode& array);
00384   // </group>
00385 
00386   // The partial version of the functions above.
00387   // They are applied to the array subsets defined by the axes in the set
00388   // using the partialXXX functions in ArrayMath.
00389   // The axes must be 0-relative.
00390   // <group>
00391     TableExprNode sums (const TableExprNode& array,
00392                         const TableExprNodeSet& collapseAxes);
00393     TableExprNode products (const TableExprNode& array,
00394                             const TableExprNodeSet& collapseAxes);
00395     TableExprNode sumSquares (const TableExprNode& array,
00396                               const TableExprNodeSet& collapseAxes);
00397     TableExprNode mins (const TableExprNode& array,
00398                         const TableExprNodeSet& collapseAxes);
00399     TableExprNode maxs (const TableExprNode& array,
00400                         const TableExprNodeSet& collapseAxes);
00401     TableExprNode means (const TableExprNode& array,
00402                          const TableExprNodeSet& collapseAxes);
00403     TableExprNode variances (const TableExprNode& array,
00404                              const TableExprNodeSet& collapseAxes);
00405     TableExprNode stddevs (const TableExprNode& array,
00406                            const TableExprNodeSet& collapseAxes);
00407     TableExprNode avdevs (const TableExprNode& array,
00408                           const TableExprNodeSet& collapseAxes);
00409     TableExprNode rmss (const TableExprNode& array,
00410                         const TableExprNodeSet& collapseAxes);
00411     TableExprNode medians (const TableExprNode& array,
00412                            const TableExprNodeSet& collapseAxes);
00413     TableExprNode fractiles (const TableExprNode& array,
00414                              const TableExprNode& fraction,
00415                              const TableExprNodeSet& collapseAxes);
00416     TableExprNode anys (const TableExprNode& array,
00417                         const TableExprNodeSet& collapseAxes);
00418     TableExprNode alls (const TableExprNode& array,
00419                         const TableExprNodeSet& collapseAxes);
00420     TableExprNode ntrues (const TableExprNode& array,
00421                           const TableExprNodeSet& collapseAxes);
00422     TableExprNode nfalses (const TableExprNode& array,
00423                            const TableExprNodeSet& collapseAxes);
00424   // </group>
00425 
00426   // Functions operating for each element on a box around that element.
00427   // The elements at the edges (where no full box can be made) are set to 0.
00428   // <group>
00429     TableExprNode runningMin (const TableExprNode& array,
00430                               const TableExprNodeSet& halfBoxWidth);
00431     TableExprNode runningMax (const TableExprNode& array,
00432                               const TableExprNodeSet& halfBoxWidth);
00433     TableExprNode runningMean (const TableExprNode& array,
00434                                const TableExprNodeSet& halfBoxWidth);
00435     TableExprNode runningVariance (const TableExprNode& array,
00436                                    const TableExprNodeSet& halfBoxWidth);
00437     TableExprNode runningStddev (const TableExprNode& array,
00438                                  const TableExprNodeSet& halfBoxWidth);
00439     TableExprNode runningAvdev (const TableExprNode& array,
00440                                 const TableExprNodeSet& halfBoxWidth);
00441     TableExprNode runningRms (const TableExprNode& array,
00442                               const TableExprNodeSet& halfBoxWidth);
00443     TableExprNode runningMedian (const TableExprNode& array,
00444                                  const TableExprNodeSet& halfBoxWidth);
00445     TableExprNode runningAny (const TableExprNode& array,
00446                               const TableExprNodeSet& halfBoxWidth);
00447     TableExprNode runningAll (const TableExprNode& array,
00448                               const TableExprNodeSet& halfBoxWidth);
00449   // </group>
00450 
00451   // Create an array of the given shape and fill it with the values.
00452   // The <src>values</src> array is rewound as needed.
00453     TableExprNode array (const TableExprNode& values,
00454                          const TableExprNodeSet& shape);
00455 
00456   // Form a masked array.
00457     TableExprNode marray (const TableExprNode& array,
00458                           const TableExprNode& mask);
00459 
00460   // Get the data array of a masked array.
00461     TableExprNode arrayData (const TableExprNode& array);
00462 
00463   // Flatten a masked array (get unmasked elements).
00464     TableExprNode arrayFlatten (const TableExprNode& array);
00465 
00466   // Get the mask of a masked array.
00467   // If the array has no mask, it return an array with all False values.
00468     TableExprNode arrayMask (const TableExprNode& array);
00469 
00470   // Get the diagonal of a (masked) array;
00471   // If the array is not a Matrix, it will take the diagonals of the
00472   // subarrays given by the two axes in the axes argument. Those
00473   // axes have to have the same length (thus each subarray is a Matrix).
00474   // If no axes are given, they default to the first two axes.
00475   // <br>The <src>diag</src> argument tells which diagonal to take.
00476   // 0 is the main diagonal, >0 is above main diagonal, <0 is below.
00477     TableExprNode diagonal (const TableExprNode& array);
00478     TableExprNode diagonal (const TableExprNode& array,
00479                             const TableExprNode& firstAxis);
00480     TableExprNode diagonal (const TableExprNode& array,
00481                             const TableExprNode& firstAxis,
00482                             const TableExprNode& diag);
00483 
00484   // Transpose all axes of a (masked) array.
00485     TableExprNode transpose (const TableExprNode& array);
00486   // Transpose a (masked) array by making the given axes the first axes.
00487     TableExprNode transpose (const TableExprNode& array,
00488                              const TableExprNode& axes);
00489 
00490   // Function operating on a field resulting in a bool scalar.
00491   // It can be used to test if a column has an array in the current row.
00492   // It can also be used to test if a record contains a field.
00493     TableExprNode isdefined (const TableExprNode& array);
00494 
00495   // Functions operating on any scalar or array resulting in a Double scalar.
00496   // A scalar has 1 element and dimensionality 0.
00497   // <group>
00498     TableExprNode nelements (const TableExprNode& array);
00499     TableExprNode ndim (const TableExprNode& array);
00500   // </group>
00501 
00502   // Function operating on any scalar or array resulting in a Double array
00503   // containing the shape. A scalar has shape [1].
00504     TableExprNode shape (const TableExprNode& array);
00505 
00506   // Function resembling the ternary <src>?:</src> construct in C++.
00507   // The argument "condition" has to be a Bool value.
00508   // If an element in "condition" is True, the corresponding element from
00509   // "arg1" is taken, otherwise it is taken from "arg2".
00510   // The arguments can be scalars or array or any combination.
00511     TableExprNode iif (const TableExprNode& condition,
00512                        const TableExprNode& arg1,
00513                        const TableExprNode& arg2);
00514 // </group>
00515 
00516 
00517 
00518 // <summary>
00519 // Handle class for a table column expression tree
00520 // </summary>
00521 
00522 // <use visibility=export>
00523 
00524 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
00525 // </reviewed>
00526 
00527 // <prerequisite>
00528 //# Classes you should understand before using this one.
00529 //   <li> <linkto class=Table>Table</linkto>
00530 //   <li> Note 199 describing
00531 //        <a href="../notes/199.html">
00532 //        TaQL</a>
00533 // </prerequisite>
00534 
00535 // <etymology>
00536 // TableExprNode represents a node in the tree reflecting a
00537 // table select expression.
00538 // </etymology>
00539 
00540 // <synopsis> 
00541 // TableExprNode is the class to store a table select expression,
00542 // which allows to select rows from the table. The selected rows form
00543 // a table which is a view of the original table.
00544 // <p>
00545 // TableExprNode is a handle class for the counted referenced class
00546 // TableExprNodeRep.
00547 // Classes (like TableExprNodePlusXX) derived from TableExprNodeRep
00548 // hold the individual
00549 // nodes in the expression, i.e. the operators and operands. The nodes
00550 // form a binary tree reflecting the expression.
00551 // E.g. the expression 2*COLUMN results in the node TableExprNodeTimes
00552 // with its children TableExprNodeConst and TableExprNodeColumn.
00553 // Constant subexpressions (like 2*3) are evaluated immediately and
00554 // only the result is stored as a node.
00555 // <p>
00556 // There are a few TableExprNode constructors taking a constant scalar or array.
00557 // In this way constant value are automatically converted to the
00558 // appropriate TableExprNodeConst object.
00559 // <p>
00560 // The derived classes also reflect the data type of the node.
00561 // Data types Bool, Double, DComplex and String are used.
00562 // Char, uChar, Short, uShort, Int, uInt and float are converted 
00563 // to Double and Complex to DComplex.
00564 // Binary operators +, -, *, /, %, &, }, ^, ==, >=, >, <, <= and != are
00565 // recognized. Also &&, ||, parentheses and unary +, -, ~ and ! are recognized.
00566 // For strings the binary operator + can also be used.
00567 // The operators have the normal C++ precedence.
00568 // Furthermore functions (like sin, max, ceil) can be used in an expression.
00569 // <br>Operator() can be used to take a slice from an array.
00570 // <p>
00571 // The Table function col has to be used to create a TableExprNode
00572 // object for a column in the table. The Table
00573 // <linkto file="Table.h#keycol">operator()</linkto> can be used
00574 // the do the actual selection from the top TableExprNode object.
00575 // </synopsis> 
00576 
00577 // <example>
00578 // <srcblock>
00579 //   // Select from table X all rows where column RA<5 and where column
00580 //   // SWITCH is true.
00581 //   Table table("X");
00582 //   Table subtable = table(table.col("RA") < 5 && table.col("SWITCH"));
00583 //
00584 //   // Select from that result all rows where the concatenation of
00585 //   // the strings in columns STR1 and STR2 is equal to the string
00586 //   // in keyword STRKEY.
00587 //   Table subsub = subtable(subtable.col("STR1") + subtable.col("STR2")
00588 //                           == subtable.key("STRKEY"));
00589 // </srcblock>
00590 // </example>
00591 
00592 // <motivation>
00593 // Having TableExprNode as a handle class makes it possible to
00594 // handle temporary objects created by the compiler in a smooth way.
00595 // TableExprNode and its derivations allow to store an expression
00596 // before actually evaluating it. This also allows the classes to
00597 // be used by the table expression parser defined in TableParse and
00598 // TableGram.
00599 //
00600 // For each operator a special derived class is implemented.
00601 // Another approach could have been to store the operator as
00602 // a flag and switch on that. However, that causes extra overhead
00603 // and the C++ virtual function mechanism is the designed for
00604 // these purposes.
00605 // </motivation>
00606 
00607 // <todo asof="$DATE:$">
00608 //# A List of bugs, limitations, extensions or planned refinements.
00609 //   <li> add operations on arrays
00610 //   <li> add selection by comparing with a set of values
00611 // </todo>
00612 
00613 
00614 class TableExprNode
00615 {
00616     //# Define the next 2 classes as friends to get the node_p.
00617     friend class TableExprNodeRep;
00618     friend class TableParse;
00619 
00620     //# Define the operations we allow.
00621     //# Note that the arguments are defined as const. This is necessary
00622     //# because the compiler generates temporaries when converting a constant
00623     //# to a TableExprNode using the constructors. Temporaries has to be const.
00624     //# However, we have to delete created nodes, so lnode_p and rnode_p
00625     //# cannot be const. The const arguments are casted to a non-const in
00626     //# the function fill which calls the non-const function simplify.
00627 
00628     // Define all global functions as friends.
00629     // <group>
00630     friend TableExprNode operator+ (const TableExprNode& left,
00631                                     const TableExprNode& right);
00632     friend TableExprNode operator- (const TableExprNode& left,
00633                                     const TableExprNode& right);
00634     friend TableExprNode operator* (const TableExprNode& left,
00635                                     const TableExprNode& right);
00636     friend TableExprNode operator/ (const TableExprNode& left,
00637                                     const TableExprNode& right);
00638     friend TableExprNode operator% (const TableExprNode& left,
00639                                     const TableExprNode& right);
00640     friend TableExprNode operator& (const TableExprNode& left,
00641                                     const TableExprNode& right);
00642     friend TableExprNode operator| (const TableExprNode& left,
00643                                     const TableExprNode& right);
00644     friend TableExprNode operator^ (const TableExprNode& left,
00645                                     const TableExprNode& right);
00646     friend TableExprNode operator== (const TableExprNode& left,
00647                                      const TableExprNode& right);
00648     friend TableExprNode operator!= (const TableExprNode& left,
00649                                      const TableExprNode& right);
00650     friend TableExprNode operator>= (const TableExprNode& left,
00651                                      const TableExprNode& right);
00652     friend TableExprNode operator>  (const TableExprNode& left,
00653                                      const TableExprNode& right);
00654     friend TableExprNode operator<= (const TableExprNode& left, 
00655                                      const TableExprNode& right);
00656     friend TableExprNode operator<  (const TableExprNode& left,
00657                                      const TableExprNode& right);
00658     friend TableExprNode operator&& (const TableExprNode& left,
00659                                      const TableExprNode& right);
00660     friend TableExprNode operator|| (const TableExprNode& left,
00661                                      const TableExprNode& right);
00662     friend TableExprNode near    (const TableExprNode& left,
00663                                   const TableExprNode& right);
00664     friend TableExprNode near    (const TableExprNode& left,
00665                                   const TableExprNode& right,
00666                                   const TableExprNode& tolerance);
00667     friend TableExprNode nearAbs (const TableExprNode& left,
00668                                   const TableExprNode& right);
00669     friend TableExprNode nearAbs (const TableExprNode& left,
00670                                   const TableExprNode& right,
00671                                   const TableExprNode& tolerance);
00672     friend TableExprNode angdist (const TableExprNode& pos1,
00673                                   const TableExprNode& pos2);
00674     friend TableExprNode cones (const TableExprNode& sourcePos,
00675                                 const TableExprNode& cones);
00676     friend TableExprNode anyCone (const TableExprNode& sourcePos,
00677                                   const TableExprNode& cones);
00678     friend TableExprNode findCone (const TableExprNode& sourcePos,
00679                                    const TableExprNode& cones);
00680     friend TableExprNode cones (const TableExprNode& sourcePos,
00681                                 const TableExprNode& conePos,
00682                                 const TableExprNode& radii);
00683     friend TableExprNode anyCone (const TableExprNode& sourcePos,
00684                                   const TableExprNode& conePos,
00685                                   const TableExprNode& radii);
00686     friend TableExprNode findCone (const TableExprNode& sourcePos,
00687                                    const TableExprNode& conePos,
00688                                    const TableExprNode& radii);
00689     friend TableExprNode sin    (const TableExprNode& node);
00690     friend TableExprNode sinh   (const TableExprNode& node);
00691     friend TableExprNode cos    (const TableExprNode& node);
00692     friend TableExprNode cosh   (const TableExprNode& node);
00693     friend TableExprNode exp    (const TableExprNode& node);
00694     friend TableExprNode log    (const TableExprNode& node);
00695     friend TableExprNode log10  (const TableExprNode& node);
00696     friend TableExprNode pow    (const TableExprNode& x,
00697                                  const TableExprNode& exp);
00698     friend TableExprNode square (const TableExprNode& node);
00699     friend TableExprNode cube   (const TableExprNode& node);
00700     friend TableExprNode sqrt   (const TableExprNode& node);
00701     friend TableExprNode norm   (const TableExprNode& node);
00702     friend TableExprNode asin  (const TableExprNode& node);
00703     friend TableExprNode acos  (const TableExprNode& node);
00704     friend TableExprNode atan  (const TableExprNode& node);
00705     friend TableExprNode atan2 (const TableExprNode& y,
00706                                 const TableExprNode& x);
00707     friend TableExprNode tan   (const TableExprNode& node);
00708     friend TableExprNode tanh  (const TableExprNode& node);
00709     friend TableExprNode sign  (const TableExprNode& node);
00710     friend TableExprNode round (const TableExprNode& node);
00711     friend TableExprNode ceil  (const TableExprNode& node);
00712     friend TableExprNode abs   (const TableExprNode& node);
00713     friend TableExprNode floor (const TableExprNode& node);
00714     friend TableExprNode fmod  (const TableExprNode& x,
00715                                 const TableExprNode& y);
00716     friend TableExprNode strlength (const TableExprNode& node);
00717     friend TableExprNode upcase    (const TableExprNode& node);
00718     friend TableExprNode downcase  (const TableExprNode& node);
00719     friend TableExprNode capitalize(const TableExprNode& node);
00720     friend TableExprNode trim      (const TableExprNode& node);
00721     friend TableExprNode ltrim     (const TableExprNode& node);
00722     friend TableExprNode rtrim     (const TableExprNode& node);
00723     friend TableExprNode substr    (const TableExprNode& str,
00724                                     const TableExprNode& pos);
00725     friend TableExprNode substr    (const TableExprNode& str,
00726                                     const TableExprNode& pos,
00727                                     const TableExprNode& npos);
00728     friend TableExprNode replace   (const TableExprNode& str,
00729                                     const TableExprNode& patt);
00730     friend TableExprNode replace   (const TableExprNode& str,
00731                                     const TableExprNode& patt,
00732                                     const TableExprNode& repl);
00733     friend TableExprNode regex     (const TableExprNode& node);
00734     friend TableExprNode pattern   (const TableExprNode& node);
00735     friend TableExprNode sqlpattern(const TableExprNode& node);
00736     friend TableExprNode datetime  (const TableExprNode& node);
00737     friend TableExprNode mjdtodate (const TableExprNode& node);
00738     friend TableExprNode mjd       (const TableExprNode& node);
00739     friend TableExprNode date      (const TableExprNode& node);
00740     friend TableExprNode year      (const TableExprNode& node);
00741     friend TableExprNode month     (const TableExprNode& node);
00742     friend TableExprNode day       (const TableExprNode& node);
00743     friend TableExprNode cmonth    (const TableExprNode& node);
00744     friend TableExprNode weekday   (const TableExprNode& node);
00745     friend TableExprNode cdow      (const TableExprNode& node);
00746     friend TableExprNode ctodt     (const TableExprNode& node);
00747     friend TableExprNode cdate     (const TableExprNode& node);
00748     friend TableExprNode ctime     (const TableExprNode& node);
00749     friend TableExprNode week      (const TableExprNode& node);
00750     friend TableExprNode time      (const TableExprNode& node);
00751     friend TableExprNode isNaN     (const TableExprNode& node);
00752     friend TableExprNode isFinite  (const TableExprNode& node);
00753     friend TableExprNode min (const TableExprNode& a, const TableExprNode& b);
00754     friend TableExprNode max (const TableExprNode& a, const TableExprNode& b);
00755     friend TableExprNode conj (const TableExprNode& node);
00756     friend TableExprNode real (const TableExprNode& node);
00757     friend TableExprNode imag (const TableExprNode& node);
00758     friend TableExprNode integer (const TableExprNode& node);
00759     friend TableExprNode boolean (const TableExprNode& node);
00760     friend TableExprNode amplitude (const TableExprNode& node);
00761     friend TableExprNode phase (const TableExprNode& node);
00762     friend TableExprNode arg (const TableExprNode& node);
00763     friend TableExprNode formComplex (const TableExprNode& real,
00764                                       const TableExprNode& imag);
00765     friend TableExprNode formComplex (const TableExprNode& node);
00766     friend TableExprNode sum (const TableExprNode& array);
00767     friend TableExprNode product (const TableExprNode& array);
00768     friend TableExprNode sumSquare (const TableExprNode& array);
00769     friend TableExprNode min (const TableExprNode& array);
00770     friend TableExprNode max (const TableExprNode& array);
00771     friend TableExprNode mean (const TableExprNode& array);
00772     friend TableExprNode variance (const TableExprNode& array);
00773     friend TableExprNode stddev (const TableExprNode& array);
00774     friend TableExprNode avdev (const TableExprNode& array);
00775     friend TableExprNode rms (const TableExprNode& array);
00776     friend TableExprNode median (const TableExprNode& array);
00777     friend TableExprNode fractile (const TableExprNode& array,
00778                                    const TableExprNode& fraction);
00779     friend TableExprNode any (const TableExprNode& array);
00780     friend TableExprNode all (const TableExprNode& array);
00781     friend TableExprNode ntrue (const TableExprNode& array);
00782     friend TableExprNode nfalse (const TableExprNode& array);
00783     friend TableExprNode sums (const TableExprNode& array,
00784                                const TableExprNodeSet& collapseAxes);
00785     friend TableExprNode products (const TableExprNode& array,
00786                                    const TableExprNodeSet& collapseAxes);
00787     friend TableExprNode sumSquares (const TableExprNode& array,
00788                                      const TableExprNodeSet& collapseAxes);
00789     friend TableExprNode mins (const TableExprNode& array,
00790                                const TableExprNodeSet& collapseAxes);
00791     friend TableExprNode maxs (const TableExprNode& array,
00792                                const TableExprNodeSet& collapseAxes);
00793     friend TableExprNode means (const TableExprNode& array,
00794                                 const TableExprNodeSet& collapseAxes);
00795     friend TableExprNode variances (const TableExprNode& array,
00796                                     const TableExprNodeSet& collapseAxes);
00797     friend TableExprNode stddevs (const TableExprNode& array,
00798                                   const TableExprNodeSet& collapseAxes);
00799     friend TableExprNode avdevs (const TableExprNode& array,
00800                                  const TableExprNodeSet& collapseAxes);
00801     friend TableExprNode rmss (const TableExprNode& array,
00802                                const TableExprNodeSet& collapseAxes);
00803     friend TableExprNode medians (const TableExprNode& array,
00804                                   const TableExprNodeSet& collapseAxes);
00805     friend TableExprNode fractiles (const TableExprNode& array,
00806                                     const TableExprNode& fraction,
00807                                     const TableExprNodeSet& collapseAxes);
00808     friend TableExprNode anys (const TableExprNode& array,
00809                                const TableExprNodeSet& collapseAxes);
00810     friend TableExprNode alls (const TableExprNode& array,
00811                                const TableExprNodeSet& collapseAxes);
00812     friend TableExprNode ntrues (const TableExprNode& array,
00813                                  const TableExprNodeSet& collapseAxes);
00814     friend TableExprNode nfalses (const TableExprNode& array,
00815                                   const TableExprNodeSet& collapseAxes);
00816     friend TableExprNode runningMin (const TableExprNode& array);
00817     friend TableExprNode runningMax (const TableExprNode& array);
00818     friend TableExprNode runningMean (const TableExprNode& array);
00819     friend TableExprNode runningVariance (const TableExprNode& array);
00820     friend TableExprNode runningStddev (const TableExprNode& array);
00821     friend TableExprNode runningAvdev (const TableExprNode& array);
00822     friend TableExprNode runningRms (const TableExprNode& array);
00823     friend TableExprNode runningMedian (const TableExprNode& array);
00824     friend TableExprNode runningAny (const TableExprNode& array);
00825     friend TableExprNode runningAll (const TableExprNode& array);
00826     friend TableExprNode array (const TableExprNode& values,
00827                                 const TableExprNodeSet& shape);
00828     friend TableExprNode marray (const TableExprNode& array,
00829                                  const TableExprNode& mask);
00830     friend TableExprNode arrayData (const TableExprNode& array);
00831     friend TableExprNode arrayMask (const TableExprNode& array);
00832     friend TableExprNode arrayFlatten (const TableExprNode& array);
00833     friend TableExprNode transpose (const TableExprNode& array);
00834     friend TableExprNode transpose (const TableExprNode& array,
00835                                     const TableExprNodeSet& axes);
00836     friend TableExprNode diagonal (const TableExprNode& array);
00837     friend TableExprNode diagonal (const TableExprNode& array,
00838                                    const TableExprNode& firstAxis);
00839     friend TableExprNode diagonal (const TableExprNode& array,
00840                                   const TableExprNode& firstAxis,
00841                                   const TableExprNode& diag);
00842     friend TableExprNode isdefined (const TableExprNode& array);
00843     friend TableExprNode nelements (const TableExprNode& array);
00844     friend TableExprNode ndim (const TableExprNode& array);
00845     friend TableExprNode shape (const TableExprNode& array);
00846     friend TableExprNode iif (const TableExprNode& condition,
00847                               const TableExprNode& arg1,
00848                               const TableExprNode& arg2);
00849     // </group>
00850 
00851 public:
00852     TableExprNode ();
00853 
00854     // Unary operators on numeric TableExprNode's.
00855     // <group>
00856     TableExprNode operator+ () const;
00857     TableExprNode operator- () const;
00858     // </group>
00859     // Unary NOT-operator on boolean TableExprNode's.
00860     TableExprNode operator! () const;
00861     // Unary bitwise negate-operator on integer TableExprNode's.
00862     TableExprNode operator~ () const;
00863 
00864     // Slicing in a node containing an array. It is possible to
00865     // address a single pixel or an n-dimensional subarray.
00866     // In case of a single pixel the result is a scalar node.
00867     // Otherwise the result is an array node with the same dimensionality
00868     // as the source.
00869     // <br>Note that there exist TableExprNodeSet constructors to
00870     // convert an <src>IPosition</src> or <src>Slicer</src> object
00871     // automatically to a <src>TableExprNodeSet</src>.
00872     // An <src>IPosition</src> addresses a single element and results in
00873     // a scalar node, while a <src>Slicer</src> can address multiple
00874     // elements and always results in an array node.
00875     TableExprNode operator() (const TableExprNodeSet& indices);
00876 
00877     // The IN operator to test if a value is contained in an array or set.
00878     // The array can also be a scalar.
00879     // <group>
00880     TableExprNode in (const TableExprNode& array,
00881                       const TaQLStyle& = TaQLStyle(0)) const;
00882     TableExprNode in (const TableExprNodeSet& set,
00883                       const TaQLStyle& = TaQLStyle(0)) const;
00884     // </group>
00885 
00886     // Use a unit for the given TableExprNode.
00887     // Note that if a column has a unit, it is automatically set. In that case
00888     // this can be used to convert units.
00889     TableExprNode useUnit (const Unit& unit) const;
00890 
00891     // Constructors to convert a constant value to a TableExprNode.
00892     // The constructor for char* is also supported to convert a
00893     // character-array to a string, since a two step conversion
00894     // is not done automatically.
00895     // <group>
00896     TableExprNode (const Bool& value);
00897     TableExprNode (const Int64& value);
00898     TableExprNode (const Int& value);
00899     TableExprNode (const uInt& value);
00900     TableExprNode (const Float& value);
00901     TableExprNode (const Double& value);
00902     TableExprNode (const Complex& value);
00903     TableExprNode (const DComplex& value);
00904     TableExprNode (const String& value);
00905     TableExprNode (const std::string& value);
00906     TableExprNode (const char*);
00907     TableExprNode (const Regex& value);
00908     TableExprNode (const StringDistance& value);
00909     TableExprNode (const TaqlRegex& value);
00910     TableExprNode (const MVTime& value);
00911     TableExprNode (const Array<Bool>& value);
00912     TableExprNode (const Array<uChar>& value);
00913     TableExprNode (const Array<Short>& value);
00914     TableExprNode (const Array<uShort>& value);
00915     TableExprNode (const Array<Int>& value);
00916     TableExprNode (const Array<uInt>& value);
00917     TableExprNode (const Array<Float>& value);
00918     TableExprNode (const Array<Double>& value);
00919     TableExprNode (const Array<Complex>& value);
00920     TableExprNode (const Array<DComplex>& value);
00921     TableExprNode (const Array<String>& value);
00922     TableExprNode (const Array<MVTime>& value);
00923     TableExprNode (const MArray<Bool>& value);
00924     TableExprNode (const MArray<uChar>& value);
00925     TableExprNode (const MArray<Short>& value);
00926     TableExprNode (const MArray<uShort>& value);
00927     TableExprNode (const MArray<Int>& value);
00928     TableExprNode (const MArray<uInt>& value);
00929     TableExprNode (const MArray<Float>& value);
00930     TableExprNode (const MArray<Double>& value);
00931     TableExprNode (const MArray<Complex>& value);
00932     TableExprNode (const MArray<DComplex>& value);
00933     TableExprNode (const MArray<String>& value);
00934     TableExprNode (const MArray<MVTime>& value);
00935     // </group>
00936 
00937     // Construct a node from a node representation.
00938     TableExprNode (TableExprNodeRep*);
00939 
00940     // copy constructor (reference semantics).
00941     TableExprNode (const TableExprNode&);
00942 
00943     // Assignment (reference semantics).
00944     TableExprNode& operator= (const TableExprNode&);
00945 
00946     // The destructor deletes all the underlying TableExprNode objects,
00947     ~TableExprNode ();
00948 
00949     // Does the node contain no actual node?
00950     Bool isNull() const
00951       { return node_p == 0; }
00952 
00953     // Do not apply the selection.
00954     void disableApplySelection()
00955       { node_p->disableApplySelection(); }
00956 
00957     // Re-create the column object for a selection of rows.
00958     // Nothing is done if the node does not represent a column object.
00959     void applySelection (const Vector<uInt>& rownrs)
00960       { node_p->applySelection (rownrs); }
00961 
00962     // Get the unit of the expression.
00963     const Unit& unit() const
00964       { return node_p->unit(); }
00965 
00966     // Get the data type of the expression.
00967     // Currently the only possible values are TpBool, TpInt, TpDouble,
00968     // TpDComplex, TpString, and TpOther.
00969     // The latter is returned for a date or regex.
00970     DataType dataType() const;
00971 
00972     // Is the expression a scalar?
00973     Bool isScalar() const
00974       { return (node_p->valueType() == TableExprNodeRep::VTScalar); }
00975 
00976     // Get the number of rows in the table associated with this expression.
00977     // One is returned if the expression is a constant.
00978     // Zero is returned if no table is associated with it.
00979     uInt nrow() const
00980       { return node_p->nrow(); }
00981 
00982     // Get a value for this node in the given row.
00983     // These functions are implemented in the derived classes and
00984     // will usually invoke the get in their children and apply the
00985     // operator on the resulting values.
00986     // <group>
00987     void get (const TableExprId& id, Bool& value) const;
00988     void get (const TableExprId& id, Int64& value) const;
00989     void get (const TableExprId& id, Double& value) const;
00990     void get (const TableExprId& id, DComplex& value) const;
00991     void get (const TableExprId& id, String& value) const;
00992     void get (const TableExprId& id, TaqlRegex& value) const;
00993     void get (const TableExprId& id, MVTime& value) const;
00994     void get (const TableExprId& id, MArray<Bool>& value) const;
00995     void get (const TableExprId& id, MArray<Int64>& value) const;
00996     void get (const TableExprId& id, MArray<Double>& value) const;
00997     void get (const TableExprId& id, MArray<DComplex>& value) const;
00998     void get (const TableExprId& id, MArray<String>& value) const;
00999     void get (const TableExprId& id, MArray<MVTime>& value) const;
01000     void get (const TableExprId& id, Array<Bool>& value) const;
01001     void get (const TableExprId& id, Array<Int64>& value) const;
01002     void get (const TableExprId& id, Array<Double>& value) const;
01003     void get (const TableExprId& id, Array<DComplex>& value) const;
01004     void get (const TableExprId& id, Array<String>& value) const;
01005     void get (const TableExprId& id, Array<MVTime>& value) const;
01006     Bool     getBool     (const TableExprId& id) const;
01007     Int64    getInt      (const TableExprId& id) const;
01008     Double   getDouble   (const TableExprId& id) const;
01009     DComplex getDComplex (const TableExprId& id) const;
01010     String   getString   (const TableExprId& id) const;
01011     Array<Bool>     getArrayBool     (const TableExprId& id) const;
01012     Array<Int64>    getArrayInt      (const TableExprId& id) const;
01013     Array<Double>   getArrayDouble   (const TableExprId& id) const;
01014     Array<DComplex> getArrayDComplex (const TableExprId& id) const;
01015     Array<String>   getArrayString   (const TableExprId& id) const;
01016     Array<MVTime>   getArrayDate     (const TableExprId& id) const;
01017     // Get a value as an array, even it it is a scalar.
01018     // This is useful in case one can give an argument as scalar or array.
01019     // <group>
01020     MArray<Bool>     getBoolAS     (const TableExprId& id) const;
01021     MArray<Int64>    getIntAS      (const TableExprId& id) const;
01022     MArray<Double>   getDoubleAS   (const TableExprId& id) const;
01023     MArray<DComplex> getDComplexAS (const TableExprId& id) const;
01024     MArray<String>   getStringAS   (const TableExprId& id) const;
01025     MArray<MVTime>   getDateAS     (const TableExprId& id) const;
01026     // </group>
01027 
01028     // </group>
01029 
01030     // Get the data type for doing a getColumn on the expression.
01031     // This is the data type of the column if the expression
01032     // consists of a single column only.
01033     // Otherwise it is the expression data type as returned by
01034     // function <src>dataType</src>.
01035     DataType getColumnDataType() const;
01036 
01037     // Get the value of the expression evaluated for the entire column.
01038     // The data of function called should match the data type as
01039     // returned by function <src>getColumnDataType</src>.
01040     // <group>
01041     Array<Bool>     getColumnBool (const Vector<uInt>& rownrs) const;
01042     Array<uChar>    getColumnuChar (const Vector<uInt>& rownrs) const;
01043     Array<Short>    getColumnShort (const Vector<uInt>& rownrs) const;
01044     Array<uShort>   getColumnuShort (const Vector<uInt>& rownrs) const;
01045     Array<Int>      getColumnInt (const Vector<uInt>& rownrs) const;
01046     Array<uInt>     getColumnuInt (const Vector<uInt>& rownrs) const;
01047     Array<Float>    getColumnFloat (const Vector<uInt>& rownrs) const;
01048     Array<Double>   getColumnDouble (const Vector<uInt>& rownrs) const;
01049     Array<Complex>  getColumnComplex (const Vector<uInt>& rownrs) const;
01050     Array<DComplex> getColumnDComplex (const Vector<uInt>& rownrs) const;
01051     Array<String>   getColumnString (const Vector<uInt>& rownrs) const;
01052     // </group>
01053 
01054     // Show the tree.
01055     void show (ostream&) const;
01056 
01057     // Convert the tree to a number of range vectors which at least
01058     // select the same things.
01059     // This function is very useful to convert the expression to
01060     // some intervals covering the select expression. This can
01061     // be used to do a rough fast selection via an index and do the
01062     // the slower final selection on that much smaller subset.
01063     // The function can only convert direct comparisons of columns
01064     // with constants (via ==, !=, >, >=, < or <=) and their combinations
01065     // using && or ||.
01066     void ranges (Block<TableExprRange>&);
01067 
01068     // Check if tables used in expression have the same number of
01069     // rows as the given table.
01070     Bool checkTableSize (const Table& table, Bool canBeConst) const;
01071 
01072     // Get table. This gets the Table object to which a
01073     // TableExprNode belongs. A TableExprNode belongs to the Table to
01074     // which the column(s) used in an expression belong. Note that
01075     // all columns in an expression have to belong to the same table.
01076     const Table& table() const;
01077 
01078     // Create a column node on behalf of the Table class.
01079     // For builtin data types another type of node is created than
01080     // for other data types.
01081     // isArray indicates if the column should be an array column.
01082     static TableExprNode newColumnNode (const Table& tab,
01083                                         const String& name,
01084                                         const Vector<String>& fieldNames);
01085 
01086     // Create a TableExprNodeConst for a table keyword
01087     // (which is handled as a constant).
01088     static TableExprNode newKeyConst (const TableRecord&,
01089                                       const Vector<String>& fieldNames);
01090 
01091     // Handle all field names except the last one. ALl of them must
01092     // be records. The last record is returned.
01093     // fullName is filled with the full keyword name separated by dots.
01094     static TableRecord* findLastKeyRec (const TableRecord& keyset,
01095                                         const Vector<String>& fieldNames,
01096                                         String& fullName);
01097 
01098     // Throw invalid data type exception.
01099     static void throwInvDT (const String& message);
01100 
01101     // Create function node of the given type with the given arguments.
01102     // <group>
01103     static TableExprNode newFunctionNode (TableExprFuncNode::FunctionType,
01104                                           const TableExprNodeSet& set,
01105                                           const Table& table,
01106                                           const TaQLStyle& = TaQLStyle(0));
01107     static TableExprNode newFunctionNode (TableExprFuncNode::FunctionType,
01108                                           const TableExprNode& node);
01109     static TableExprNode newFunctionNode (TableExprFuncNode::FunctionType,
01110                                           const TableExprNode& node1,
01111                                           const TableExprNode& node2);
01112     static TableExprNode newFunctionNode (TableExprFuncNode::FunctionType,
01113                                           const TableExprNode& node1,
01114                                           const TableExprNode& node2,
01115                                           const TableExprNode& node3);
01116     static TableExprNode newFunctionNode (TableExprFuncNode::FunctionType,
01117                                           const TableExprNode& array,
01118                                           const TableExprNodeSet& axes);
01119     static TableExprNode newFunctionNode (TableExprFuncNode::FunctionType,
01120                                           const TableExprNode& array,
01121                                           const TableExprNode& node,
01122                                           const TableExprNodeSet& axes);
01123     // </group>
01124 
01125     // Create a user defined function node.
01126     static TableExprNode newUDFNode (const String& name,
01127                                      const TableExprNodeSet& set,
01128                                      const Table& table,
01129                                      const TaQLStyle& = TaQLStyle(0));
01130 
01131     // Create cone function node of the given type with the given arguments.
01132     // <group>
01133     static TableExprNode newConeNode (TableExprFuncNode::FunctionType,
01134                                       const TableExprNodeSet& set,
01135                                       uInt origin = 0);
01136     static TableExprNode newConeNode (TableExprFuncNode::FunctionType,
01137                                       const TableExprNode& node1,
01138                                       const TableExprNode& node2);
01139     static TableExprNode newConeNode (TableExprFuncNode::FunctionType,
01140                                       const TableExprNode& node1,
01141                                       const TableExprNode& node2,
01142                                       const TableExprNode& node3);
01143     // </group>
01144 
01145     // Create rownumber() function node.
01146     // Origin indicates whether the first row should be zero (for C++ binding)
01147     // or an other value (one for TaQL binding).
01148     static TableExprNode newRownrNode (const Table& table, uInt origin);
01149 
01150     // Create rowid() function node.
01151     // Origin is always 0.
01152     static TableExprNode newRowidNode (const Table& table);
01153 
01154     // Create rand() function node.
01155     static TableExprNode newRandomNode (const Table& table);
01156 
01157     // Create ArrayElement node for the given array with the given index.
01158     // The origin is 0 for C++ and 1 for TaQL.
01159     static TableExprNode newArrayPartNode (const TableExprNode& arrayNode,
01160                                            const TableExprNodeSet& indices,
01161                                            const TaQLStyle& = TaQLStyle(0));
01162  
01163     // returns const pointer to the representation-object of it
01164     const TableExprNodeRep* getNodeRep() const;
01165 
01166     // Adapt the unit of the expression to the given unit (if not empty).
01167     void adaptUnit (const Unit&);
01168 
01169 private:
01170     // returns non-const pointer to the representation-object of it
01171     TableExprNodeRep* getRep();
01172 
01173     // convert Block of TableExprNode to PtrBlock of TableExprNodeRep*.
01174     static PtrBlock<TableExprNodeRep*> convertBlockTEN
01175                                              (Block<TableExprNode>& nodes);
01176 
01177     // Construct a new node for the given operation.
01178     // <group>
01179     TableExprNodeRep* newPlus   (TableExprNodeRep* right) const;
01180     TableExprNodeRep* newMinus  (TableExprNodeRep* right) const;
01181     TableExprNodeRep* newTimes  (TableExprNodeRep* right) const;
01182     TableExprNodeRep* newDivide (TableExprNodeRep* right) const;
01183     TableExprNodeRep* newModulo (TableExprNodeRep* right) const;
01184     TableExprNodeRep* newBitAnd (TableExprNodeRep* right) const;
01185     TableExprNodeRep* newBitOr  (TableExprNodeRep* right) const;
01186     TableExprNodeRep* newBitXor (TableExprNodeRep* right) const;
01187     TableExprNodeRep* newEQ     (TableExprNodeRep* right) const;
01188     TableExprNodeRep* newNE     (TableExprNodeRep* right) const;
01189     TableExprNodeRep* newGE     (TableExprNodeRep* right) const;
01190     TableExprNodeRep* newGT     (TableExprNodeRep* right) const;
01191     TableExprNodeRep* newIN     (TableExprNodeRep* right,
01192                                  const TaQLStyle&) const;
01193     TableExprNodeRep* newOR     (TableExprNodeRep* right) const;
01194     TableExprNodeRep* newAND    (TableExprNodeRep* right) const;
01195     // </group>
01196 
01197     // The actual (counted referenced) representation of a node.
01198     TableExprNodeRep* node_p;
01199 };
01200 
01201 
01202 
01203 inline void TableExprNode::ranges (Block<TableExprRange>& blrange)
01204     { node_p->ranges (blrange); }
01205 
01206 //# Get the table from which the node is derived.
01207 inline const Table& TableExprNode::table() const
01208     { return node_p->table(); }
01209 
01210 //# Get the value of an expression.
01211 inline void TableExprNode::get (const TableExprId& id, Bool& value) const
01212     { value = node_p->getBool (id); }
01213 inline void TableExprNode::get (const TableExprId& id, Int64& value) const
01214     { value = node_p->getInt (id); }
01215 inline void TableExprNode::get (const TableExprId& id, Double& value) const
01216     { value = node_p->getDouble (id); }
01217 inline void TableExprNode::get (const TableExprId& id, DComplex& value) const
01218     { value = node_p->getDComplex (id); }
01219 inline void TableExprNode::get (const TableExprId& id, String& value) const
01220     { value = node_p->getString (id); }
01221 inline void TableExprNode::get (const TableExprId& id, TaqlRegex& value) const
01222     { value = node_p->getRegex (id); }
01223 inline void TableExprNode::get (const TableExprId& id, MVTime& value) const
01224     { value = node_p->getDate (id); }
01225 inline void TableExprNode::get (const TableExprId& id,
01226                                 MArray<Bool>& value) const
01227     { value = node_p->getArrayBool (id); }
01228 inline void TableExprNode::get (const TableExprId& id,
01229                                 MArray<Int64>& value) const
01230     { value = node_p->getArrayInt (id); }
01231 inline void TableExprNode::get (const TableExprId& id,
01232                                 MArray<Double>& value) const
01233     { value = node_p->getArrayDouble (id); }
01234 inline void TableExprNode::get (const TableExprId& id,
01235                                 MArray<DComplex>& value) const
01236     { value = node_p->getArrayDComplex (id); }
01237 inline void TableExprNode::get (const TableExprId& id,
01238                                 MArray<String>& value) const
01239     { value = node_p->getArrayString (id); }
01240 inline void TableExprNode::get (const TableExprId& id,
01241                                 MArray<MVTime>& value) const
01242     { value = node_p->getArrayDate (id); }
01243 inline void TableExprNode::get (const TableExprId& id,
01244                                 Array<Bool>& value) const
01245     { value = node_p->getArrayBool (id).array(); }
01246 inline void TableExprNode::get (const TableExprId& id,
01247                                 Array<Int64>& value) const
01248     { value = node_p->getArrayInt (id).array(); }
01249 inline void TableExprNode::get (const TableExprId& id,
01250                                 Array<Double>& value) const
01251     { value = node_p->getArrayDouble (id).array(); }
01252 inline void TableExprNode::get (const TableExprId& id,
01253                                 Array<DComplex>& value) const
01254     { value = node_p->getArrayDComplex (id).array(); }
01255 inline void TableExprNode::get (const TableExprId& id,
01256                                 Array<String>& value) const
01257     { value = node_p->getArrayString (id).array(); }
01258 inline void TableExprNode::get (const TableExprId& id,
01259                                 Array<MVTime>& value) const
01260     { value = node_p->getArrayDate (id).array(); }
01261 inline Bool TableExprNode::getBool (const TableExprId& id) const
01262     { return node_p->getBool (id); }
01263 inline Int64 TableExprNode::getInt (const TableExprId& id) const
01264     { return node_p->getInt (id); }
01265 inline Double TableExprNode::getDouble (const TableExprId& id) const
01266     { return node_p->getDouble (id); }
01267 inline DComplex TableExprNode::getDComplex (const TableExprId& id) const
01268     { return node_p->getDComplex (id); }
01269 inline String TableExprNode::getString (const TableExprId& id) const
01270     { return node_p->getString (id); }
01271 inline Array<Bool> TableExprNode::getArrayBool (const TableExprId& id) const
01272     { return node_p->getArrayBool (id).array(); }
01273 inline Array<Int64> TableExprNode::getArrayInt (const TableExprId& id) const
01274     { return node_p->getArrayInt (id).array(); }
01275 inline Array<Double> TableExprNode::getArrayDouble (const TableExprId& id) const
01276     { return node_p->getArrayDouble (id).array(); }
01277 inline Array<DComplex> TableExprNode::getArrayDComplex (const TableExprId& id) const
01278     { return node_p->getArrayDComplex (id).array(); }
01279 inline Array<String> TableExprNode::getArrayString (const TableExprId& id) const
01280     { return node_p->getArrayString (id).array(); }
01281 inline Array<MVTime> TableExprNode::getArrayDate (const TableExprId& id) const
01282     { return node_p->getArrayDate (id).array(); }
01283 inline MArray<Bool> TableExprNode::getBoolAS (const TableExprId& id) const
01284     { return node_p->getBoolAS (id); }
01285 inline MArray<Int64> TableExprNode::getIntAS (const TableExprId& id) const
01286     { return node_p->getIntAS (id); }
01287 inline MArray<Double> TableExprNode::getDoubleAS (const TableExprId& id) const
01288     { return node_p->getDoubleAS (id); }
01289 inline MArray<DComplex> TableExprNode::getDComplexAS (const TableExprId& id) const
01290     { return node_p->getDComplexAS (id); }
01291 inline MArray<String> TableExprNode::getStringAS (const TableExprId& id) const
01292     { return node_p->getStringAS (id); }
01293 inline MArray<MVTime> TableExprNode::getDateAS (const TableExprId& id) const
01294     { return node_p->getDateAS (id); }
01295 
01296 inline Array<Bool>      TableExprNode::getColumnBool (const Vector<uInt>& rownrs) const
01297     { return node_p->getColumnBool (rownrs); }
01298 inline Array<uChar>     TableExprNode::getColumnuChar (const Vector<uInt>& rownrs) const
01299     { return node_p->getColumnuChar (rownrs); }
01300 inline Array<Short>     TableExprNode::getColumnShort (const Vector<uInt>& rownrs) const
01301     { return node_p->getColumnShort (rownrs); }
01302 inline Array<uShort>    TableExprNode::getColumnuShort (const Vector<uInt>& rownrs) const
01303     { return node_p->getColumnuShort (rownrs); }
01304 inline Array<Int>       TableExprNode::getColumnInt (const Vector<uInt>& rownrs) const
01305     { return node_p->getColumnInt (rownrs); }
01306 inline Array<uInt>      TableExprNode::getColumnuInt (const Vector<uInt>& rownrs) const
01307     { return node_p->getColumnuInt (rownrs); }
01308 inline Array<Float>     TableExprNode::getColumnFloat (const Vector<uInt>& rownrs) const
01309     { return node_p->getColumnFloat (rownrs); }
01310 inline Array<Double>    TableExprNode::getColumnDouble (const Vector<uInt>& rownrs) const
01311     { return node_p->getColumnDouble (rownrs); }
01312 inline Array<Complex>   TableExprNode::getColumnComplex (const Vector<uInt>& rownrs) const
01313     { return node_p->getColumnComplex (rownrs); }
01314 inline Array<DComplex>  TableExprNode::getColumnDComplex (const Vector<uInt>& rownrs) const
01315     { return node_p->getColumnDComplex (rownrs); }
01316 inline Array<String>    TableExprNode::getColumnString (const Vector<uInt>& rownrs) const
01317     { return node_p->getColumnString (rownrs); }
01318 
01319 
01320 inline TableExprNode operator+ (const TableExprNode& left,
01321                                 const TableExprNode& right)
01322 {
01323     return left.newPlus (right.node_p);
01324 }
01325 inline TableExprNode operator- (const TableExprNode& left,
01326                                 const TableExprNode& right)
01327 {
01328     return left.newMinus (right.node_p);
01329 }
01330 inline TableExprNode operator* (const TableExprNode& left,
01331                                 const TableExprNode& right)
01332 {
01333     return left.newTimes (right.node_p);
01334 }
01335 inline TableExprNode operator/ (const TableExprNode& left,
01336                                 const TableExprNode& right)
01337 {
01338     return left.newDivide (right.node_p);
01339 }
01340 inline TableExprNode operator% (const TableExprNode& left,
01341                                 const TableExprNode& right)
01342 {
01343     return left.newModulo (right.node_p);
01344 }
01345 inline TableExprNode operator& (const TableExprNode& left,
01346                                 const TableExprNode& right)
01347 {
01348     return left.newBitAnd (right.node_p);
01349 }
01350 inline TableExprNode operator| (const TableExprNode& left,
01351                                 const TableExprNode& right)
01352 {
01353     return left.newBitOr (right.node_p);
01354 }
01355 inline TableExprNode operator^ (const TableExprNode& left,
01356                                 const TableExprNode& right)
01357 {
01358     return left.newBitXor (right.node_p);
01359 }
01360 inline TableExprNode operator== (const TableExprNode& left,
01361                                  const TableExprNode& right)
01362 {
01363     return left.newEQ (right.node_p);
01364 }
01365 inline TableExprNode operator!= (const TableExprNode& left,
01366                                  const TableExprNode& right)
01367 {
01368     return left.newNE (right.node_p);
01369 }
01370 inline TableExprNode operator> (const TableExprNode& left,
01371                                 const TableExprNode& right)
01372 {
01373     return left.newGT (right.node_p);
01374 }
01375 inline TableExprNode operator>= (const TableExprNode& left,
01376                                  const TableExprNode& right)
01377 {
01378     return left.newGE (right.node_p);
01379 }
01380 inline TableExprNode operator<= (const TableExprNode& left,
01381                                  const TableExprNode& right)
01382 {
01383     return right.newGE (left.node_p);
01384 }
01385 inline TableExprNode operator< (const TableExprNode& left,
01386                                 const TableExprNode& right)
01387 {
01388     return right.newGT (left.node_p);
01389 }
01390 inline TableExprNode TableExprNode::in (const TableExprNode& right,
01391                                         const TaQLStyle& style) const
01392 {
01393     return newIN (right.node_p, style);
01394 }
01395 inline TableExprNode TableExprNode::operator() (const TableExprNodeSet& indices)
01396 {
01397     // C++ indexing is 0-based.
01398     return newArrayPartNode (*this, indices, TaQLStyle(0));
01399 }
01400 
01401 inline TableExprNode near (const TableExprNode& left,
01402                            const TableExprNode& right)
01403 {
01404     return TableExprNode::newFunctionNode (TableExprFuncNode::near2FUNC,
01405                                            left, right);
01406 }
01407 inline TableExprNode near (const TableExprNode& left,
01408                            const TableExprNode& right,
01409                            const TableExprNode& tolerance)
01410 {
01411     return TableExprNode::newFunctionNode (TableExprFuncNode::near3FUNC,
01412                                            left, right, tolerance);
01413 }
01414 inline TableExprNode nearAbs (const TableExprNode& left,
01415                               const TableExprNode& right)
01416 {
01417     return TableExprNode::newFunctionNode (TableExprFuncNode::nearabs2FUNC,
01418                                            left, right);
01419 }
01420 inline TableExprNode nearAbs (const TableExprNode& left,
01421                               const TableExprNode& right,
01422                               const TableExprNode& tolerance)
01423 {
01424     return TableExprNode::newFunctionNode (TableExprFuncNode::nearabs3FUNC,
01425                                            left, right, tolerance);
01426 }
01427 inline TableExprNode angdist (const TableExprNode& pos1,
01428                               const TableExprNode& pos2)
01429 {
01430     return TableExprNode::newFunctionNode (TableExprFuncNode::angdistFUNC,
01431                                            pos1, pos2);
01432 }
01433 inline TableExprNode angdistx (const TableExprNode& pos1,
01434                                const TableExprNode& pos2)
01435 {
01436     return TableExprNode::newFunctionNode (TableExprFuncNode::angdistxFUNC,
01437                                            pos1, pos2);
01438 }
01439 inline TableExprNode cones (const TableExprNode& sourcePos,
01440                             const TableExprNode& cones)
01441 {
01442     return TableExprNode::newConeNode (TableExprFuncNode::conesFUNC,
01443                                        sourcePos, cones);
01444 }
01445 inline TableExprNode anyCone (const TableExprNode& sourcePos,
01446                               const TableExprNode& cones)
01447 {
01448     return TableExprNode::newConeNode (TableExprFuncNode::anyconeFUNC,
01449                                        sourcePos, cones);
01450 }
01451 inline TableExprNode findCone (const TableExprNode& sourcePos,
01452                                const TableExprNode& cones)
01453 {
01454     return TableExprNode::newConeNode (TableExprFuncNode::findconeFUNC,
01455                                        sourcePos, cones);
01456 }
01457 inline TableExprNode cones (const TableExprNode& sourcePos,
01458                             const TableExprNode& conePos,
01459                             const TableExprNode& radii)
01460 {
01461     return TableExprNode::newConeNode (TableExprFuncNode::cones3FUNC,
01462                                        sourcePos, conePos, radii);
01463 }
01464 inline TableExprNode anyCone (const TableExprNode& sourcePos,
01465                               const TableExprNode& conePos,
01466                               const TableExprNode& radii)
01467 {
01468     return TableExprNode::newConeNode (TableExprFuncNode::anycone3FUNC,
01469                                        sourcePos, conePos, radii);
01470 }
01471 inline TableExprNode findCone (const TableExprNode& sourcePos,
01472                                const TableExprNode& conePos,
01473                                const TableExprNode& radii)
01474 {
01475     return TableExprNode::newConeNode (TableExprFuncNode::findcone3FUNC,
01476                                        sourcePos, conePos, radii);
01477 }
01478 inline TableExprNode cos (const TableExprNode& node)
01479 {
01480     return TableExprNode::newFunctionNode (TableExprFuncNode::cosFUNC, node);
01481 }
01482 inline TableExprNode cosh (const TableExprNode& node)
01483 {
01484     return TableExprNode::newFunctionNode (TableExprFuncNode::coshFUNC, node);
01485 }
01486 inline TableExprNode exp (const TableExprNode& node)
01487 {
01488     return TableExprNode::newFunctionNode (TableExprFuncNode::expFUNC, node);
01489 }
01490 inline TableExprNode log (const TableExprNode& node)
01491 {
01492     return TableExprNode::newFunctionNode (TableExprFuncNode::logFUNC, node);
01493 }
01494 inline TableExprNode log10 (const TableExprNode& node)
01495 {
01496     return TableExprNode::newFunctionNode (TableExprFuncNode::log10FUNC, node);
01497 }
01498 inline TableExprNode pow (const TableExprNode& x, const TableExprNode& y)
01499 {
01500     return TableExprNode::newFunctionNode (TableExprFuncNode::powFUNC, x, y);
01501 }
01502 inline TableExprNode sin (const TableExprNode& node)
01503 {
01504     return TableExprNode::newFunctionNode (TableExprFuncNode::sinFUNC, node);
01505 }
01506 inline TableExprNode sinh (const TableExprNode& node)
01507 {
01508     return TableExprNode::newFunctionNode (TableExprFuncNode::sinhFUNC, node);
01509 }
01510 inline TableExprNode square (const TableExprNode& node)
01511 {
01512     return TableExprNode::newFunctionNode (TableExprFuncNode::squareFUNC,
01513                                            node);
01514 }
01515 inline TableExprNode cube (const TableExprNode& node)
01516 {
01517     return TableExprNode::newFunctionNode (TableExprFuncNode::cubeFUNC,
01518                                            node);
01519 }
01520 inline TableExprNode sqrt (const TableExprNode& node)
01521 {
01522     return TableExprNode::newFunctionNode (TableExprFuncNode::sqrtFUNC, node);
01523 }
01524 inline TableExprNode norm (const TableExprNode& node)
01525 {
01526     return TableExprNode::newFunctionNode (TableExprFuncNode::normFUNC, node);
01527 }
01528 inline TableExprNode acos (const TableExprNode& node)
01529 {
01530     return TableExprNode::newFunctionNode (TableExprFuncNode::acosFUNC, node);
01531 }
01532 inline TableExprNode asin (const TableExprNode& node)
01533 {
01534     return TableExprNode::newFunctionNode (TableExprFuncNode::asinFUNC, node);
01535 }
01536 inline TableExprNode atan (const TableExprNode& node)
01537 {
01538     return TableExprNode::newFunctionNode (TableExprFuncNode::atanFUNC, node);
01539 }
01540 inline TableExprNode atan2 (const TableExprNode& y, const TableExprNode& x)
01541 {
01542     return TableExprNode::newFunctionNode (TableExprFuncNode::atan2FUNC, y, x);
01543 }
01544 inline TableExprNode sign (const TableExprNode& node)
01545 {
01546     return TableExprNode::newFunctionNode (TableExprFuncNode::signFUNC, node);
01547 }
01548 inline TableExprNode round (const TableExprNode& node)
01549 {
01550     return TableExprNode::newFunctionNode (TableExprFuncNode::roundFUNC, node);
01551 }
01552 inline TableExprNode ceil (const TableExprNode& node)
01553 {
01554     return TableExprNode::newFunctionNode (TableExprFuncNode::ceilFUNC, node);
01555 }
01556 inline TableExprNode abs (const TableExprNode& node)
01557 {
01558     return TableExprNode::newFunctionNode (TableExprFuncNode::absFUNC, node);
01559 }
01560 inline TableExprNode floor (const TableExprNode& node)
01561 {
01562     return TableExprNode::newFunctionNode (TableExprFuncNode::floorFUNC, node);
01563 }
01564 inline TableExprNode fmod (const TableExprNode& x, const TableExprNode& y)
01565 {
01566     return TableExprNode::newFunctionNode (TableExprFuncNode::fmodFUNC, x, y);
01567 }
01568 inline TableExprNode tan (const TableExprNode& node)
01569 {
01570     return TableExprNode::newFunctionNode (TableExprFuncNode::tanFUNC, node);
01571 }
01572 inline TableExprNode tanh (const TableExprNode& node)
01573 {
01574     return TableExprNode::newFunctionNode (TableExprFuncNode::tanhFUNC, node);
01575 }
01576 inline TableExprNode min (const TableExprNode& a, const TableExprNode& b)
01577 {
01578     return TableExprNode::newFunctionNode (TableExprFuncNode::minFUNC, a, b);
01579 }
01580 inline TableExprNode max (const TableExprNode& a, const TableExprNode& b)
01581 {
01582     return TableExprNode::newFunctionNode (TableExprFuncNode::maxFUNC, a, b);
01583 }
01584 inline TableExprNode real (const TableExprNode& node)
01585 {
01586     return TableExprNode::newFunctionNode (TableExprFuncNode::realFUNC, node);
01587 }
01588 inline TableExprNode imag (const TableExprNode& node)
01589 {
01590     return TableExprNode::newFunctionNode (TableExprFuncNode::imagFUNC, node);
01591 }
01592 inline TableExprNode integer (const TableExprNode& node)
01593 {
01594     return TableExprNode::newFunctionNode (TableExprFuncNode::intFUNC, node);
01595 }
01596 inline TableExprNode boolean (const TableExprNode& node)
01597 {
01598     return TableExprNode::newFunctionNode (TableExprFuncNode::boolFUNC, node);
01599 }
01600 inline TableExprNode conj (const TableExprNode& node)
01601 {
01602     return TableExprNode::newFunctionNode (TableExprFuncNode::conjFUNC, node);
01603 }
01604 inline TableExprNode amplitude (const TableExprNode& node)
01605 {
01606     return TableExprNode::newFunctionNode (TableExprFuncNode::absFUNC, node);
01607 }
01608 inline TableExprNode arg (const TableExprNode& node)
01609 {
01610     return TableExprNode::newFunctionNode (TableExprFuncNode::argFUNC, node);
01611 }
01612 inline TableExprNode phase (const TableExprNode& node)
01613 {
01614     return TableExprNode::newFunctionNode (TableExprFuncNode::argFUNC, node);
01615 }
01616 inline TableExprNode formComplex (const TableExprNode& real,
01617                                   const TableExprNode& imag)
01618 {
01619     return TableExprNode::newFunctionNode (TableExprFuncNode::complexFUNC,
01620                                            real, imag);
01621 }
01622 inline TableExprNode formComplex (const TableExprNode& node)
01623 {
01624     return TableExprNode::newFunctionNode (TableExprFuncNode::complexFUNC,
01625                                            node);
01626 }
01627 inline TableExprNode strlength (const TableExprNode& node)
01628 {
01629     return TableExprNode::newFunctionNode (TableExprFuncNode::strlengthFUNC,
01630                                            node);
01631 }
01632 inline TableExprNode upcase (const TableExprNode& node)
01633 {
01634     return TableExprNode::newFunctionNode (TableExprFuncNode::upcaseFUNC,
01635                                            node);
01636 }
01637 inline TableExprNode downcase (const TableExprNode& node)
01638 {
01639     return TableExprNode::newFunctionNode (TableExprFuncNode::downcaseFUNC,
01640                                            node);
01641 }
01642 inline TableExprNode capitalize (const TableExprNode& node)
01643 {
01644     return TableExprNode::newFunctionNode (TableExprFuncNode::capitalizeFUNC,
01645                                            node);
01646 }
01647 inline TableExprNode regex (const TableExprNode& node)
01648 {
01649     return TableExprNode::newFunctionNode (TableExprFuncNode::regexFUNC, node);
01650 }
01651 inline TableExprNode pattern (const TableExprNode& node)
01652 {
01653     return TableExprNode::newFunctionNode (TableExprFuncNode::patternFUNC,
01654                                            node);
01655 }
01656 inline TableExprNode sqlpattern (const TableExprNode& node)
01657 {
01658     return TableExprNode::newFunctionNode (TableExprFuncNode::sqlpatternFUNC,
01659                                            node);
01660 }
01661 inline TableExprNode datetime (const TableExprNode& node)
01662 {
01663     return TableExprNode::newFunctionNode (TableExprFuncNode::datetimeFUNC,
01664                                            node);
01665 }
01666 inline TableExprNode mjdtodate (const TableExprNode& node)
01667 {
01668     return TableExprNode::newFunctionNode (TableExprFuncNode::mjdtodateFUNC,
01669                                            node);
01670 }
01671 inline TableExprNode mjd (const TableExprNode& node)
01672 {
01673     return TableExprNode::newFunctionNode (TableExprFuncNode::mjdFUNC, node);
01674 }
01675 inline TableExprNode date (const TableExprNode& node)
01676 {
01677     return TableExprNode::newFunctionNode (TableExprFuncNode::dateFUNC, node);
01678 }
01679 inline TableExprNode year (const TableExprNode& node)
01680 {
01681     return TableExprNode::newFunctionNode (TableExprFuncNode::yearFUNC, node);
01682 }
01683 inline TableExprNode month (const TableExprNode& node)
01684 {
01685     return TableExprNode::newFunctionNode (TableExprFuncNode::monthFUNC, node);
01686 }
01687 inline TableExprNode day (const TableExprNode& node)
01688 {
01689     return TableExprNode::newFunctionNode (TableExprFuncNode::dayFUNC, node);
01690 }
01691 inline TableExprNode cmonth (const TableExprNode& node)
01692 {
01693     return TableExprNode::newFunctionNode (TableExprFuncNode::cmonthFUNC,
01694                                            node);
01695 }
01696 inline TableExprNode weekday (const TableExprNode& node)
01697 {
01698     return TableExprNode::newFunctionNode (TableExprFuncNode::weekdayFUNC,
01699                                            node);
01700 }
01701 inline TableExprNode cdow (const TableExprNode& node)
01702 {
01703     return TableExprNode::newFunctionNode (TableExprFuncNode::cdowFUNC, node);
01704 }
01705 inline TableExprNode ctodt (const TableExprNode& node)
01706 {
01707     return TableExprNode::newFunctionNode (TableExprFuncNode::ctodFUNC, node);
01708 }
01709 inline TableExprNode cdate (const TableExprNode& node)
01710 {
01711     return TableExprNode::newFunctionNode (TableExprFuncNode::cdateFUNC, node);
01712 }
01713 inline TableExprNode ctime (const TableExprNode& node)
01714 {
01715     return TableExprNode::newFunctionNode (TableExprFuncNode::ctimeFUNC, node);
01716 }
01717 inline TableExprNode hms (const TableExprNode& node)
01718 {
01719     return TableExprNode::newFunctionNode (TableExprFuncNode::hmsFUNC, node);
01720 }
01721 inline TableExprNode dms (const TableExprNode& node)
01722 {
01723     return TableExprNode::newFunctionNode (TableExprFuncNode::dmsFUNC, node);
01724 }
01725 inline TableExprNode hdms (const TableExprNode& node)
01726 {
01727     return TableExprNode::newFunctionNode (TableExprFuncNode::hdmsFUNC, node);
01728 }
01729 inline TableExprNode toString (const TableExprNode& node)
01730 {
01731     return TableExprNode::newFunctionNode (TableExprFuncNode::stringFUNC,
01732                                            node);
01733 }
01734 inline TableExprNode toString (const TableExprNode& node,
01735                                const TableExprNode& format)
01736 {
01737     return TableExprNode::newFunctionNode (TableExprFuncNode::stringFUNC,
01738                                            node, format);
01739 }
01740 inline TableExprNode week (const TableExprNode& node)
01741 {
01742     return TableExprNode::newFunctionNode (TableExprFuncNode::weekFUNC, node);
01743 }
01744 inline TableExprNode time (const TableExprNode& node)
01745 {
01746     return TableExprNode::newFunctionNode (TableExprFuncNode::timeFUNC, node);
01747 }
01748 inline TableExprNode trim (const TableExprNode& node)
01749 {
01750     return TableExprNode::newFunctionNode (TableExprFuncNode::trimFUNC, node);
01751 }
01752 inline TableExprNode ltrim (const TableExprNode& node)
01753 {
01754     return TableExprNode::newFunctionNode (TableExprFuncNode::ltrimFUNC, node);
01755 }
01756 inline TableExprNode rtrim (const TableExprNode& node)
01757 {
01758     return TableExprNode::newFunctionNode (TableExprFuncNode::rtrimFUNC, node);
01759 }
01760 inline TableExprNode substr (const TableExprNode& node,
01761                              const TableExprNode& pos)
01762 {
01763     return TableExprNode::newFunctionNode (TableExprFuncNode::substrFUNC,
01764                                            node, pos);
01765 }
01766 inline TableExprNode substr (const TableExprNode& node,
01767                              const TableExprNode& pos,
01768                              const TableExprNode& npos)
01769 {
01770     return TableExprNode::newFunctionNode (TableExprFuncNode::substrFUNC,
01771                                            node, pos, npos);
01772 }
01773 inline TableExprNode replace (const TableExprNode& node,
01774                               const TableExprNode& patt)
01775 {
01776     return TableExprNode::newFunctionNode (TableExprFuncNode::replaceFUNC,
01777                                            node, patt);
01778 }
01779 inline TableExprNode replace (const TableExprNode& node,
01780                               const TableExprNode& patt,
01781                               const TableExprNode& repl)
01782 {
01783     return TableExprNode::newFunctionNode (TableExprFuncNode::replaceFUNC,
01784                                            node, patt, repl);
01785 }
01786 inline TableExprNode isNaN (const TableExprNode& node)
01787 {
01788     return TableExprNode::newFunctionNode (TableExprFuncNode::isnanFUNC, node);
01789 }
01790 inline TableExprNode isInf (const TableExprNode& node)
01791 {
01792     return TableExprNode::newFunctionNode (TableExprFuncNode::isinfFUNC, node);
01793 }
01794 inline TableExprNode isFinite (const TableExprNode& node)
01795 {
01796     return TableExprNode::newFunctionNode (TableExprFuncNode::isfiniteFUNC,
01797                                            node);
01798 }
01799 inline TableExprNode min (const TableExprNode& node)
01800 {
01801     return TableExprNode::newFunctionNode (TableExprFuncNode::arrminFUNC,
01802                                            node);
01803 }
01804 inline TableExprNode max (const TableExprNode& node)
01805 {
01806     return TableExprNode::newFunctionNode (TableExprFuncNode::arrmaxFUNC,
01807                                            node);
01808 }
01809 inline TableExprNode sum (const TableExprNode& node)
01810 {
01811     return TableExprNode::newFunctionNode (TableExprFuncNode::arrsumFUNC,
01812                                            node);
01813 }
01814 inline TableExprNode product (const TableExprNode& node)
01815 {
01816     return TableExprNode::newFunctionNode (TableExprFuncNode::arrproductFUNC,
01817                                            node);
01818 }
01819 inline TableExprNode sumSquare (const TableExprNode& node)
01820 {
01821     return TableExprNode::newFunctionNode (TableExprFuncNode::arrsumsqrFUNC,
01822                                            node);
01823 }
01824 inline TableExprNode mean (const TableExprNode& node)
01825 {
01826     return TableExprNode::newFunctionNode (TableExprFuncNode::arrmeanFUNC,
01827                                            node);
01828 }
01829 inline TableExprNode variance (const TableExprNode& node)
01830 {
01831     return TableExprNode::newFunctionNode (TableExprFuncNode::arrvarianceFUNC,
01832                                            node);
01833 }
01834 inline TableExprNode stddev (const TableExprNode& node)
01835 {
01836     return TableExprNode::newFunctionNode (TableExprFuncNode::arrstddevFUNC,
01837                                            node);
01838 }
01839 inline TableExprNode avdev (const TableExprNode& node)
01840 {
01841     return TableExprNode::newFunctionNode (TableExprFuncNode::arravdevFUNC,
01842                                            node);
01843 }
01844 inline TableExprNode rms (const TableExprNode& node)
01845 {
01846     return TableExprNode::newFunctionNode (TableExprFuncNode::arrrmsFUNC,
01847                                            node);
01848 }
01849 inline TableExprNode median (const TableExprNode& node)
01850 {
01851     return TableExprNode::newFunctionNode (TableExprFuncNode::arrmedianFUNC,
01852                                            node);
01853 }
01854 inline TableExprNode fractile (const TableExprNode& node,
01855                                const TableExprNode& fraction)
01856 {
01857     return TableExprNode::newFunctionNode (TableExprFuncNode::arrfractileFUNC,
01858                                            node, fraction);
01859 }
01860 inline TableExprNode any (const TableExprNode& node)
01861 {
01862     return TableExprNode::newFunctionNode (TableExprFuncNode::anyFUNC, node);
01863 }
01864 inline TableExprNode all (const TableExprNode& node)
01865 {
01866     return TableExprNode::newFunctionNode (TableExprFuncNode::allFUNC, node);
01867 }
01868 inline TableExprNode ntrue (const TableExprNode& node)
01869 {
01870     return TableExprNode::newFunctionNode (TableExprFuncNode::ntrueFUNC, node);
01871 }
01872 inline TableExprNode nfalse (const TableExprNode& node)
01873 {
01874     return TableExprNode::newFunctionNode (TableExprFuncNode::nfalseFUNC, node);
01875 }
01876 inline TableExprNode sums (const TableExprNode& array,
01877                            const TableExprNodeSet& axes)
01878 {
01879     return TableExprNode::newFunctionNode (TableExprFuncNode::arrsumsFUNC,
01880                                            array, axes);
01881 }
01882 inline TableExprNode products (const TableExprNode& array,
01883                                const TableExprNodeSet& axes)
01884 {
01885     return TableExprNode::newFunctionNode (TableExprFuncNode::arrproductsFUNC,
01886                                            array, axes);
01887 }
01888 inline TableExprNode sumSquares (const TableExprNode& array,
01889                                  const TableExprNodeSet& axes)
01890 {
01891     return TableExprNode::newFunctionNode (TableExprFuncNode::arrsumsqrsFUNC,
01892                                            array, axes);
01893 }
01894 inline TableExprNode mins (const TableExprNode& array,
01895                            const TableExprNodeSet& axes)
01896 {
01897     return TableExprNode::newFunctionNode (TableExprFuncNode::arrminsFUNC,
01898                                            array, axes);
01899 }
01900 inline TableExprNode maxs (const TableExprNode& array,
01901                            const TableExprNodeSet& axes)
01902 {
01903     return TableExprNode::newFunctionNode (TableExprFuncNode::arrmaxsFUNC,
01904                                            array, axes);
01905 }
01906 inline TableExprNode means (const TableExprNode& array,
01907                             const TableExprNodeSet& axes)
01908 {
01909     return TableExprNode::newFunctionNode (TableExprFuncNode::arrmeansFUNC,
01910                                            array, axes);
01911 }
01912 inline TableExprNode variances (const TableExprNode& array,
01913                                 const TableExprNodeSet& axes)
01914 {
01915     return TableExprNode::newFunctionNode (TableExprFuncNode::arrvariancesFUNC,
01916                                            array, axes);
01917 }
01918 inline TableExprNode stddevs (const TableExprNode& array,
01919                               const TableExprNodeSet& axes)
01920 {
01921     return TableExprNode::newFunctionNode (TableExprFuncNode::arrstddevsFUNC,
01922                                            array, axes);
01923 }
01924 inline TableExprNode avdevs (const TableExprNode& array,
01925                              const TableExprNodeSet& axes)
01926 {
01927     return TableExprNode::newFunctionNode (TableExprFuncNode::arravdevsFUNC,
01928                                            array, axes);
01929 }
01930 inline TableExprNode rmss (const TableExprNode& array,
01931                            const TableExprNodeSet& axes)
01932 {
01933     return TableExprNode::newFunctionNode (TableExprFuncNode::arrrmssFUNC,
01934                                            array, axes);
01935 }
01936 inline TableExprNode medians (const TableExprNode& array,
01937                               const TableExprNodeSet& axes)
01938 {
01939     return TableExprNode::newFunctionNode (TableExprFuncNode::arrmediansFUNC,
01940                                            array, axes);
01941 }
01942 inline TableExprNode fractiles (const TableExprNode& array,
01943                                 const TableExprNode& fraction,
01944                                 const TableExprNodeSet& axes)
01945 {
01946     return TableExprNode::newFunctionNode (TableExprFuncNode::arrfractilesFUNC,
01947                                            array, fraction, axes);
01948 }
01949 inline TableExprNode anys (const TableExprNode& array,
01950                            const TableExprNodeSet& axes)
01951 {
01952     return TableExprNode::newFunctionNode (TableExprFuncNode::anysFUNC,
01953                                            array, axes);
01954 }
01955 inline TableExprNode alls (const TableExprNode& array,
01956                            const TableExprNodeSet& axes)
01957 {
01958     return TableExprNode::newFunctionNode (TableExprFuncNode::allsFUNC,
01959                                            array, axes);
01960 }
01961 inline TableExprNode ntrues (const TableExprNode& array,
01962                              const TableExprNodeSet& axes)
01963 {
01964     return TableExprNode::newFunctionNode (TableExprFuncNode::ntruesFUNC,
01965                                            array, axes);
01966 }
01967 inline TableExprNode nfalses (const TableExprNode& array,
01968                               const TableExprNodeSet& axes)
01969 {
01970     return TableExprNode::newFunctionNode (TableExprFuncNode::nfalsesFUNC,
01971                                            array, axes);
01972 }
01973 inline TableExprNode runningMin (const TableExprNode& node,
01974                                  const TableExprNodeSet& halfBoxWidth)
01975 {
01976     return TableExprNode::newFunctionNode (TableExprFuncNode::runminFUNC,
01977                                            node, halfBoxWidth);
01978 }
01979 inline TableExprNode runningMax (const TableExprNode& node,
01980                                  const TableExprNodeSet& halfBoxWidth)
01981 {
01982     return TableExprNode::newFunctionNode (TableExprFuncNode::runmaxFUNC,
01983                                            node, halfBoxWidth);
01984 }
01985 inline TableExprNode runningMean (const TableExprNode& node,
01986                                   const TableExprNodeSet& halfBoxWidth)
01987 {
01988     return TableExprNode::newFunctionNode (TableExprFuncNode::runmeanFUNC,
01989                                            node, halfBoxWidth);
01990 }
01991 inline TableExprNode runningVariance (const TableExprNode& node,
01992                                       const TableExprNodeSet& halfBoxWidth)
01993 {
01994     return TableExprNode::newFunctionNode (TableExprFuncNode::runvarianceFUNC,
01995                                            node, halfBoxWidth);
01996 }
01997 inline TableExprNode runningStddev (const TableExprNode& node,
01998                                     const TableExprNodeSet& halfBoxWidth)
01999 {
02000     return TableExprNode::newFunctionNode (TableExprFuncNode::runstddevFUNC,
02001                                            node, halfBoxWidth);
02002 }
02003 inline TableExprNode runningAvdev (const TableExprNode& node,
02004                                    const TableExprNodeSet& halfBoxWidth)
02005 {
02006     return TableExprNode::newFunctionNode (TableExprFuncNode::runavdevFUNC,
02007                                            node, halfBoxWidth);
02008 }
02009 inline TableExprNode runningRms (const TableExprNode& node,
02010                                  const TableExprNodeSet& halfBoxWidth)
02011 {
02012     return TableExprNode::newFunctionNode (TableExprFuncNode::runrmsFUNC,
02013                                            node, halfBoxWidth);
02014 }
02015 inline TableExprNode runningMedian (const TableExprNode& node,
02016                                     const TableExprNodeSet& halfBoxWidth)
02017 {
02018     return TableExprNode::newFunctionNode (TableExprFuncNode::runmedianFUNC,
02019                                            node, halfBoxWidth);
02020 }
02021 inline TableExprNode runningAny (const TableExprNode& node,
02022                                  const TableExprNodeSet& halfBoxWidth)
02023 {
02024     return TableExprNode::newFunctionNode (TableExprFuncNode::runanyFUNC,
02025                                            node, halfBoxWidth);
02026 }
02027 inline TableExprNode runningAll (const TableExprNode& node,
02028                                  const TableExprNodeSet& halfBoxWidth)
02029 {
02030     return TableExprNode::newFunctionNode (TableExprFuncNode::runallFUNC,
02031                                            node, halfBoxWidth);
02032 }
02033 inline TableExprNode boxedMin (const TableExprNode& node,
02034                                const TableExprNodeSet& halfBoxWidth)
02035 {
02036     return TableExprNode::newFunctionNode (TableExprFuncNode::boxminFUNC,
02037                                            node, halfBoxWidth);
02038 }
02039 inline TableExprNode boxedMax (const TableExprNode& node,
02040                                const TableExprNodeSet& halfBoxWidth)
02041 {
02042     return TableExprNode::newFunctionNode (TableExprFuncNode::boxmaxFUNC,
02043                                            node, halfBoxWidth);
02044 }
02045 inline TableExprNode boxedMean (const TableExprNode& node,
02046                                 const TableExprNodeSet& halfBoxWidth)
02047 {
02048     return TableExprNode::newFunctionNode (TableExprFuncNode::boxmeanFUNC,
02049                                            node, halfBoxWidth);
02050 }
02051 inline TableExprNode boxedVariance (const TableExprNode& node,
02052                                     const TableExprNodeSet& halfBoxWidth)
02053 {
02054     return TableExprNode::newFunctionNode (TableExprFuncNode::boxvarianceFUNC,
02055                                            node, halfBoxWidth);
02056 }
02057 inline TableExprNode boxedStddev (const TableExprNode& node,
02058                                   const TableExprNodeSet& halfBoxWidth)
02059 {
02060     return TableExprNode::newFunctionNode (TableExprFuncNode::boxstddevFUNC,
02061                                            node, halfBoxWidth);
02062 }
02063 inline TableExprNode boxedAvdev (const TableExprNode& node,
02064                                  const TableExprNodeSet& halfBoxWidth)
02065 {
02066     return TableExprNode::newFunctionNode (TableExprFuncNode::boxavdevFUNC,
02067                                            node, halfBoxWidth);
02068 }
02069 inline TableExprNode boxedRms (const TableExprNode& node,
02070                                const TableExprNodeSet& halfBoxWidth)
02071 {
02072     return TableExprNode::newFunctionNode (TableExprFuncNode::boxrmsFUNC,
02073                                            node, halfBoxWidth);
02074 }
02075 inline TableExprNode boxedMedian (const TableExprNode& node,
02076                                   const TableExprNodeSet& halfBoxWidth)
02077 {
02078     return TableExprNode::newFunctionNode (TableExprFuncNode::boxmedianFUNC,
02079                                            node, halfBoxWidth);
02080 }
02081 inline TableExprNode boxedAny (const TableExprNode& node,
02082                                const TableExprNodeSet& halfBoxWidth)
02083 {
02084     return TableExprNode::newFunctionNode (TableExprFuncNode::boxanyFUNC,
02085                                            node, halfBoxWidth);
02086 }
02087 inline TableExprNode boxedAll (const TableExprNode& node,
02088                                const TableExprNodeSet& halfBoxWidth)
02089 {
02090     return TableExprNode::newFunctionNode (TableExprFuncNode::boxallFUNC,
02091                                            node, halfBoxWidth);
02092 }
02093 inline TableExprNode array (const TableExprNode& values,
02094                             const TableExprNodeSet& shape)
02095 {
02096     return TableExprNode::newFunctionNode (TableExprFuncNode::arrayFUNC,
02097                                            values, shape);
02098 }
02099 inline TableExprNode marray (const TableExprNode& array,
02100                              const TableExprNode& mask)
02101 {
02102     return TableExprNode::newFunctionNode (TableExprFuncNode::marrayFUNC,
02103                                            array, mask);
02104 }
02105 inline TableExprNode arrayData (const TableExprNode& array)
02106 {
02107     return TableExprNode::newFunctionNode (TableExprFuncNode::arrdataFUNC,
02108                                            array);
02109 }
02110 inline TableExprNode arrayMask (const TableExprNode& array)
02111 {
02112     return TableExprNode::newFunctionNode (TableExprFuncNode::arrmaskFUNC,
02113                                            array);
02114 }
02115 inline TableExprNode arrayFlatten (const TableExprNode& array)
02116 {
02117     return TableExprNode::newFunctionNode (TableExprFuncNode::arrflatFUNC,
02118                                            array);
02119 }
02120 inline TableExprNode transpose (const TableExprNode& array)
02121 {
02122     // Needs an empty axes argument.
02123     return TableExprNode::newFunctionNode (TableExprFuncNode::transposeFUNC,
02124                                            array,
02125                                            TableExprNode(Vector<Int>()));
02126 }
02127 inline TableExprNode transpose (const TableExprNode& array,
02128                                 const TableExprNodeSet& axes)
02129 {
02130     return TableExprNode::newFunctionNode (TableExprFuncNode::transposeFUNC,
02131                                            array, axes);
02132 }
02133 inline TableExprNode diagonal (const TableExprNode& array)
02134 {
02135     return TableExprNode::newFunctionNode (TableExprFuncNode::diagonalFUNC,
02136                                            array,
02137                                            TableExprNode(Vector<Int>()));
02138 }
02139 inline TableExprNode isdefined (const TableExprNode& node)
02140 {
02141     return TableExprNode::newFunctionNode (TableExprFuncNode::isdefFUNC, node);
02142 }
02143 inline TableExprNode nelements (const TableExprNode& node)
02144 {
02145     return TableExprNode::newFunctionNode (TableExprFuncNode::nelemFUNC, node);
02146 }
02147 inline TableExprNode ndim (const TableExprNode& node)
02148 {
02149     return TableExprNode::newFunctionNode (TableExprFuncNode::ndimFUNC, node);
02150 }
02151 inline TableExprNode shape (const TableExprNode& node)
02152 {
02153     return TableExprNode::newFunctionNode (TableExprFuncNode::shapeFUNC, node);
02154 }
02155 inline TableExprNode iif (const TableExprNode& condition,
02156                           const TableExprNode& arg1,
02157                           const TableExprNode& arg2)
02158 {
02159     return TableExprNode::newFunctionNode (TableExprFuncNode::iifFUNC,
02160                                            condition, arg1, arg2);
02161 }
02162 
02163 
02164 inline void TableExprNode::show (ostream& os) const
02165 {
02166     node_p->show (os, 0);
02167 }
02168 inline const TableExprNodeRep* TableExprNode::getNodeRep() const
02169 {
02170     return node_p;
02171 }
02172 inline TableExprNodeRep* TableExprNode::getRep()
02173 {
02174     return node_p;
02175 }
02176 
02177 
02178 
02179 } //# NAMESPACE CASACORE - END
02180 
02181 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1