casa
$Rev:20696$
|
00001 //# ExprNodeRep.h: Abstract base class for a node in 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: ExprNodeRep.h 21156 2011-12-12 07:57:36Z gervandiepen $ 00027 00028 #ifndef TABLES_EXPRNODEREP_H 00029 #define TABLES_EXPRNODEREP_H 00030 00031 //# Includes 00032 #include <casa/aips.h> 00033 #include <tables/Tables/Table.h> 00034 #include <tables/Tables/TableExprId.h> 00035 #include <tables/Tables/ExprRange.h> 00036 #include <casa/BasicSL/Complex.h> 00037 #include <casa/Quanta/MVTime.h> 00038 #include <casa/Quanta/Unit.h> 00039 #include <casa/Utilities/DataType.h> 00040 #include <casa/Utilities/Regex.h> 00041 #include <casa/Utilities/StringDistance.h> 00042 #include <casa/iosfwd.h> 00043 00044 namespace casa { //# NAMESPACE CASA - BEGIN 00045 00046 //# Forward Declarations 00047 class TableExprNode; 00048 class TableExprNodeColumn; 00049 template<class T> class Block; 00050 00051 00052 // <summary> 00053 // Class to handle a Regex or StringDistance. 00054 // </summary> 00055 00056 // <use visibility=local> 00057 00058 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00059 // </reviewed> 00060 00061 // <prerequisite> 00062 //# Classes you should understand before using this one. 00063 // <li> <linkto class=Regex>Regex</linkto> 00064 // <li> <linkto class=StringDistance>StringDistance</linkto> 00065 // </prerequisite> 00066 00067 // <synopsis> 00068 // A StringDistance (Levensthein distance) in TaQL is given in the same way 00069 // as a Regex. This class is needed to have a single object in the parse tree 00070 // objects containing them (in class TableExprNodeConstRegex). 00071 // </synopsis> 00072 00073 class TaqlRegex 00074 { 00075 public: 00076 // Construct from a regex. 00077 explicit TaqlRegex (const Regex& regex) 00078 : itsRegex(regex) 00079 {} 00080 00081 // Construct from a StringDistance. 00082 explicit TaqlRegex (const StringDistance& dist) 00083 : itsDist(dist) 00084 {} 00085 00086 // Does the regex or maximum string distance match? 00087 Bool match (const String& str) const 00088 { return itsRegex.regexp().empty() ? 00089 itsDist.match(str) : str.matches(itsRegex); 00090 } 00091 00092 // Return the regular expression. 00093 const Regex& regex() const 00094 { return itsRegex; } 00095 00096 private: 00097 Regex itsRegex; 00098 StringDistance itsDist; 00099 }; 00100 00101 00102 00103 // <summary> 00104 // Abstract base class for a node in a table column expression tree 00105 // </summary> 00106 00107 // <use visibility=local> 00108 00109 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00110 // </reviewed> 00111 00112 // <prerequisite> 00113 //# Classes you should understand before using this one. 00114 // <li> <linkto class=TableExprNode>TableExprNode</linkto> 00115 // </prerequisite> 00116 00117 // <etymology> 00118 // TableExprNodeRep is the (abstract) REPresentation of a node in a table 00119 // expression tree. 00120 // </etymology> 00121 00122 // <synopsis> 00123 // TableExprNodeRep is the base class for all nodes in a table 00124 // expression tree. It is used by the handle class TableExprNode. 00125 // <p> 00126 // The objects of this class are reference-counted to make it possible 00127 // that the same object is reused. 00128 // </synopsis> 00129 00130 // <motivation> 00131 // TableExprNodeRep and its derivations store a table select expression 00132 // before actually evaluating it. It is also possible that the classes 00133 // are used by the table expression parser defined in TableParse and 00134 // TableGram. 00135 // <br> 00136 // For each operator a special derived class is implemented. 00137 // Another approach could have been to store the operator as 00138 // a flag and switch on that. However, that causes extra overhead 00139 // and the C++ virtual function mechanism is designed for 00140 // these purposes. 00141 // </motivation> 00142 00143 // <todo asof="$DATE:$"> 00144 //# A List of bugs, limitations, extensions or planned refinements. 00145 // <li> add selection by comparing with a set of values 00146 // </todo> 00147 00148 00149 class TableExprNodeRep 00150 { 00151 public: 00152 // Define the data types of a node. 00153 enum NodeDataType { 00154 NTBool, 00155 NTInt, 00156 NTDouble, 00157 NTComplex, 00158 NTString, 00159 NTRegex, 00160 NTDate, 00161 NTReal, //# NTInt or NTDouble 00162 NTDouCom, //# NTDouble or NTComplex 00163 NTNumeric, //# NTInt, NTDouble, or NTComplex 00164 NTAny //# Any data type 00165 }; 00166 00167 // Define the value types. 00168 enum ValueType { 00169 VTScalar, 00170 VTArray, 00171 VTRecord, 00172 VTSetElem, 00173 VTSet, 00174 VTIndex 00175 }; 00176 00177 // Define the operator types. 00178 // LE and LT are handled as GE and GT with swapped operands. 00179 enum OperType {OtPlus, OtMinus, OtTimes, OtDivide, OtModulo, 00180 OtBitAnd, OtBitOr, OtBitXor, OtBitNegate, 00181 OtEQ, OtGE, OtGT, OtNE, OtIN, 00182 OtAND, OtOR, OtNOT, OtMIN, 00183 OtColumn, OtField, OtLiteral, OtFunc, OtSlice, OtUndef, 00184 OtRownr, OtRandom 00185 }; 00186 00187 // Define the value types of the 2 arguments when arrays are involved. 00188 enum ArgType { 00189 NoArr, ArrArr, ArrSca, ScaArr 00190 }; 00191 00192 // Define (sub-)expression type 00193 enum ExprType { 00194 // A constant subexpression which can be evaluated immediately. 00195 Constant, 00196 // A variable (i.e. row dependent) subexpression which 00197 // has to be evaluated for each table row. 00198 Variable 00199 // An expensive constant subexpression which should only be 00200 // evaluated when needed (e.g. a subquery). 00201 // Lazy 00202 }; 00203 00204 // Construct a node. 00205 TableExprNodeRep (NodeDataType, ValueType, OperType, ArgType, ExprType, 00206 Int ndim, const IPosition& shape, 00207 const Table& table); 00208 00209 // This constructor is called from the derived TableExprNodeRep. 00210 TableExprNodeRep (NodeDataType, ValueType, OperType, const Table&); 00211 00212 // Copy constructor. 00213 TableExprNodeRep (const TableExprNodeRep&); 00214 00215 // The destructor deletes all the underlying TableExprNode objects. 00216 virtual ~TableExprNodeRep(); 00217 00218 // Link to this object, i.e. increase its reference count. 00219 TableExprNodeRep* link(); 00220 00221 // Unlink from the given object. 00222 // If its reference count is zero, delete it. 00223 static void unlink (TableExprNodeRep*); 00224 00225 // Get the unit conversion factor. 00226 // Default 1 is returned. 00227 virtual Double getUnitFactor() const; 00228 00229 // Does the node result in a single value (for e.g. GROUPBY)? 00230 // It is the case for a reduction value or constant value. 00231 // By default it is if the value is constant. 00232 virtual Bool isSingleValue() const; 00233 00234 // Is the expression a column aggregate function? 00236 00237 // Get a scalar value for this node in the given row. 00238 // The appropriate functions are implemented in the derived classes and 00239 // will usually invoke the get in their children and apply the 00240 // operator on the resulting values. 00241 // <group> 00242 virtual Bool getBool (const TableExprId& id); 00243 virtual Int64 getInt (const TableExprId& id); 00244 virtual Double getDouble (const TableExprId& id); 00245 virtual DComplex getDComplex (const TableExprId& id); 00246 virtual String getString (const TableExprId& id); 00247 virtual TaqlRegex getRegex (const TableExprId& id); 00248 virtual MVTime getDate (const TableExprId& id); 00249 // </group> 00250 00251 // Get an array value for this node in the given row. 00252 // The appropriate functions are implemented in the derived classes and 00253 // will usually invoke the get in their children and apply the 00254 // operator on the resulting values. 00255 // <group> 00256 virtual Array<Bool> getArrayBool (const TableExprId& id); 00257 virtual Array<Int64> getArrayInt (const TableExprId& id); 00258 virtual Array<Double> getArrayDouble (const TableExprId& id); 00259 virtual Array<DComplex> getArrayDComplex (const TableExprId& id); 00260 virtual Array<String> getArrayString (const TableExprId& id); 00261 virtual Array<MVTime> getArrayDate (const TableExprId& id); 00262 // </group> 00263 00264 // Get a value as an array, even it it is a scalar. 00265 // This is useful if one could given an argument as scalar or array. 00266 // <group> 00267 Array<Bool> getBoolAS (const TableExprId& id); 00268 Array<Int64> getIntAS (const TableExprId& id); 00269 Array<Double> getDoubleAS (const TableExprId& id); 00270 Array<DComplex> getDComplexAS (const TableExprId& id); 00271 Array<String> getStringAS (const TableExprId& id); 00272 Array<MVTime> getDateAS (const TableExprId& id); 00273 // </group> 00274 00275 // Does a value occur in an array or set? 00276 // The default implementation tests if it is in an array. 00277 // <group> 00278 virtual Bool hasBool (const TableExprId& id, Bool value); 00279 virtual Bool hasInt (const TableExprId& id, Int64 value); 00280 virtual Bool hasDouble (const TableExprId& id, Double value); 00281 virtual Bool hasDComplex (const TableExprId& id, const DComplex& value); 00282 virtual Bool hasString (const TableExprId& id, const String& value); 00283 virtual Bool hasDate (const TableExprId& id, const MVTime& value); 00284 virtual Array<Bool> hasArrayBool (const TableExprId& id, 00285 const Array<Bool>& value); 00286 virtual Array<Bool> hasArrayInt (const TableExprId& id, 00287 const Array<Int64>& value); 00288 virtual Array<Bool> hasArrayDouble (const TableExprId& id, 00289 const Array<Double>& value); 00290 virtual Array<Bool> hasArrayDComplex (const TableExprId& id, 00291 const Array<DComplex>& value); 00292 virtual Array<Bool> hasArrayString (const TableExprId& id, 00293 const Array<String>& value); 00294 virtual Array<Bool> hasArrayDate (const TableExprId& id, 00295 const Array<MVTime>& value); 00296 // </group> 00297 00298 // Get the number of rows in the table associated with this expression. 00299 // One is returned if the expression is a constant. 00300 // Zero is returned if no table is associated with it. 00301 uInt nrow() const; 00302 00303 // Get the data type of the column. 00304 // It returns True when it could set the data type (which it can 00305 // if the expression is a scalar column or a constant array column pixel). 00306 // Otherwise it returns False. 00307 virtual Bool getColumnDataType (DataType&) const; 00308 00309 // Get the value of the expression evaluated for the entire column. 00310 // The data of function called should match the data type as 00311 // returned by function <src>getColumnDataType</src>. 00312 // <group> 00313 virtual Array<Bool> getColumnBool (const Vector<uInt>& rownrs); 00314 virtual Array<uChar> getColumnuChar (const Vector<uInt>& rownrs); 00315 virtual Array<Short> getColumnShort (const Vector<uInt>& rownrs); 00316 virtual Array<uShort> getColumnuShort (const Vector<uInt>& rownrs); 00317 virtual Array<Int> getColumnInt (const Vector<uInt>& rownrs); 00318 virtual Array<uInt> getColumnuInt (const Vector<uInt>& rownrs); 00319 virtual Array<Float> getColumnFloat (const Vector<uInt>& rownrs); 00320 virtual Array<Double> getColumnDouble (const Vector<uInt>& rownrs); 00321 virtual Array<Complex> getColumnComplex (const Vector<uInt>& rownrs); 00322 virtual Array<DComplex> getColumnDComplex (const Vector<uInt>& rownrs); 00323 virtual Array<String> getColumnString (const Vector<uInt>& rownrs); 00324 // </group> 00325 00326 // Convert the tree to a number of range vectors which at least 00327 // select the same things. 00328 // This function is very useful to convert the expression to 00329 // some intervals covering the select expression. This can 00330 // be used to do a rough fast selection via an index and do the 00331 // the slower final selection on that much smaller subset. 00332 // The function can only convert direct comparisons of columns 00333 // with constants (via ==, !=, >, >=, < or <=) and their combinations 00334 // using && or ||. 00335 virtual void ranges (Block<TableExprRange>&); 00336 00337 // Get the data type of the derived TableExprNode object. 00338 // This is the data type of the resulting value. E.g. a compare 00339 // of 2 numeric values results in a Bool, thus the data type 00340 // of, say, TableExprNodeEQ<T> is always Bool. 00341 // Function getInternalDT gives the internal data type, thus in 00342 // the example above the data type of T. 00343 NodeDataType dataType() const; 00344 00345 // Get the value type. 00346 ValueType valueType() const; 00347 00348 // Set the value type. 00349 void setValueType (ValueType vtype); 00350 00351 // Get the operator type. 00352 OperType operType() const; 00353 00354 // Get the expression type. 00355 ExprType exprType() const; 00356 00357 // Is the expression a constant? 00358 Bool isConstant() const; 00359 00360 // Get the unit. 00361 const Unit& unit() const; 00362 00363 // Set the unit. 00364 // It also sets the datatype to NTDouble if it is NTInt. 00365 void setUnit (const Unit& unit); 00366 00367 // Get the fixed dimensionality (same for all rows). 00368 Int ndim() const; 00369 00370 // Get the fixed shape (same for all rows). 00371 const IPosition& shape() const; 00372 00373 // Get the shape for the given row. 00374 // It returns the fixed shape if defined, otherwise getShape(id). 00375 const IPosition& shape (const TableExprId& id); 00376 00377 // Is the value in the given row defined? 00378 // The default implementation returns True. 00379 virtual Bool isDefined (const TableExprId& id); 00380 00381 // Show the expression tree. 00382 virtual void show (ostream&, uInt indent) const; 00383 00384 // Get table. This gets the Table object to which a 00385 // TableExprNode belongs. A TableExprNode belongs to the Table to 00386 // which the column(s) used in an expression belong. Note that 00387 // all columns in an expression have to belong to the same table. 00388 // <group> 00389 Table& table(); 00390 const Table& table() const; 00391 // </group> 00392 00393 // Let a set node convert itself to the given unit. 00394 // The default implementation does nothing. 00395 virtual void adaptSetUnits (const Unit&); 00396 00397 // Create a range object from a column and an interval. 00398 static void createRange (Block<TableExprRange>&, 00399 TableExprNodeColumn*, Double start, Double end); 00400 00401 // Create a empty range object. 00402 static void createRange (Block<TableExprRange>&); 00403 00404 // Convert a NodeDataType to a string. 00405 static String typeString (NodeDataType); 00406 00407 // Convert a ValueType to a string. 00408 static String typeString (ValueType); 00409 00410 protected: 00411 uInt count_p; //# Reference count 00412 Table table_p; //# Table from which node is "derived" 00413 NodeDataType dtype_p; //# data type of the operation 00414 ValueType vtype_p; //# value type of the result 00415 OperType optype_p; //# operator type 00416 ArgType argtype_p; //# argument types 00417 ExprType exprtype_p; //# Constant or Variable 00418 Int ndim_p; //# Fixed dimensionality of node values 00419 //# -1 = variable dimensionality 00420 IPosition shape_p; //# Fixed shape of node values 00421 Unit unit_p; //# Unit of the values 00422 00423 // Get the shape for the given row. 00424 virtual const IPosition& getShape (const TableExprId& id); 00425 00426 // Get pointer to REPresentation object. 00427 // This is used by derived classes. 00428 static TableExprNodeRep* getRep (TableExprNode&); 00429 00430 // When one of the children is a constant, convert its data type 00431 // to that of the other operand. This avoids that conversions are 00432 // done for each get. 00433 // The default implementation does nothing. 00434 virtual void convertConstChild(); 00435 00436 // Check if this node uses the same table pointer. 00437 // Fill the Table object if it is still null. 00438 // <group> 00439 void checkTablePtr (const TableExprNodeRep* node); 00440 static void checkTablePtr (Table& table, 00441 const TableExprNodeRep* node); 00442 // </group> 00443 00444 // Set expression type to Variable if node is Variable. 00445 // <group> 00446 void fillExprType (const TableExprNodeRep* node); 00447 static void fillExprType (ExprType&, const TableExprNodeRep* node); 00448 // </group> 00449 00450 // When the node is constant, it is evaluated and replaced by 00451 // the appropriate TableExprNodeConst object. 00452 // If not constant, it calls the virtual ConvertConstChild function 00453 // which can convert a constant child when appropriate. 00454 static TableExprNodeRep* convertNode (TableExprNodeRep* thisNode, 00455 Bool convertConstType); 00456 00457 private: 00458 // A copy of a TableExprNodeRep cannot be made. 00459 TableExprNodeRep& operator= (const TableExprNodeRep&); 00460 }; 00461 00462 00463 00464 00465 // <summary> 00466 // Abstract base class for a node having 0, 1, or 2 child nodes. 00467 // </summary> 00468 00469 // <use visibility=local> 00470 00471 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00472 // </reviewed> 00473 00474 // <prerequisite> 00475 //# Classes you should understand before using this one. 00476 // <li> <linkto class=TableExprNodeRep>TableExprNodeRep</linkto> 00477 // </prerequisite> 00478 00479 // <etymology> 00480 // TableExprNodeBinary is a node in the table expression tree 00481 // representing a binary node (i.e. having 2 operands). 00482 // </etymology> 00483 00484 // <synopsis> 00485 // TableExprNodeBinary is the abstract base class for all nodes in a table 00486 // expression tree using up to 2 operands. 00487 // It is used as the base class for the node classes representing 00488 // operator +, -, etc.. 00489 // </synopsis> 00490 00491 // <motivation> 00492 // This class contains the common functionality for the classes 00493 // representing a binary (or unary) operator. 00494 // </motivation> 00495 00496 //# <todo asof="$DATE:$"> 00497 //# A List of bugs, limitations, extensions or planned refinements. 00498 //# <li> to be filled in 00499 //# </todo> 00500 00501 00502 class TableExprNodeBinary : public TableExprNodeRep 00503 { 00504 public: 00505 // Constructor 00506 TableExprNodeBinary (NodeDataType, ValueType, OperType, const Table&); 00507 TableExprNodeBinary (NodeDataType, const TableExprNodeRep&, OperType); 00508 00509 // Destructor 00510 virtual ~TableExprNodeBinary(); 00511 00512 // Show the expression tree. 00513 virtual void show (ostream&, uInt indent) const; 00514 00515 // Does the node result in a single value (for e.g. GROUPBY)? 00516 virtual Bool isSingleValue() const; 00517 00518 // Check the data types and get the common one. 00519 static NodeDataType getDT (NodeDataType leftDtype, 00520 NodeDataType rightDype, 00521 OperType operType); 00522 00523 // Check the data and value types and get the common one. 00524 static TableExprNodeRep getTypes (const TableExprNodeRep& left, 00525 const TableExprNodeRep& right, 00526 OperType operType); 00527 00528 // Link the children to the node and convert the children 00529 // to constants if needed and possible. Also convert the node to 00530 // constant if possible. 00531 static TableExprNodeRep* fillNode (TableExprNodeBinary* thisNode, 00532 TableExprNodeRep* left, 00533 TableExprNodeRep* right, 00534 Bool convertConstType); 00535 00536 // Handle the units of the children and possibly set the parent's unit. 00537 // The default implementation make the units of the children equal and 00538 // set the parent unit to that unit if the parent is not a Bool value. 00539 virtual void handleUnits(); 00540 00541 // When one of the children is a constant, convert its data type 00542 // to that of the other operand. This avoids that conversions are 00543 // done for each get. 00544 void convertConstChild(); 00545 00546 // Get the child nodes. 00547 // <group> 00548 const TableExprNodeRep* getLeftChild() const 00549 { return lnode_p; } 00550 const TableExprNodeRep* getRightChild() const 00551 { return rnode_p; } 00552 // </group> 00553 00554 protected: 00555 // Make the units equal. 00556 // Replace the right node if needed. 00557 static const Unit& makeEqualUnits (TableExprNodeRep* left, 00558 TableExprNodeRep*& right); 00559 00560 TableExprNodeRep* lnode_p; //# left operand 00561 TableExprNodeRep* rnode_p; //# right operand 00562 }; 00563 00564 00565 00566 00567 // <summary> 00568 // Abstract base class for a node having multiple child nodes. 00569 // </summary> 00570 00571 // <use visibility=local> 00572 00573 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00574 // </reviewed> 00575 00576 // <prerequisite> 00577 //# Classes you should understand before using this one. 00578 // <li> <linkto class=TableExprNodeRep>TableExprNodeRep</linkto> 00579 // </prerequisite> 00580 00581 // <etymology> 00582 // TableExprNodeMulti is a node in the table expression tree 00583 // which can have MULTIple child nodes. 00584 // </etymology> 00585 00586 // <synopsis> 00587 // TableExprNodeMulti is the abstract base class for all nodes in a table 00588 // expression tree using multiple operands. 00589 // It is used as the base class for the node classes representing 00590 // functions, sets, indices, etc.. 00591 // </synopsis> 00592 00593 // <motivation> 00594 // This class contains the common functionality for the classes 00595 // representing a node with multiple operands. 00596 // </motivation> 00597 00598 //# <todo asof="$DATE:$"> 00599 //# A List of bugs, limitations, extensions or planned refinements. 00600 //# <li> to be filled in 00601 //# </todo> 00602 00603 00604 class TableExprNodeMulti : public TableExprNodeRep 00605 { 00606 public: 00607 // Constructor 00608 TableExprNodeMulti (NodeDataType, ValueType, OperType, 00609 const TableExprNodeRep& source); 00610 00611 // Destructor 00612 virtual ~TableExprNodeMulti(); 00613 00614 // Show the expression tree. 00615 virtual void show (ostream&, uInt indent) const; 00616 00617 // Check number of arguments 00618 // low <= number_of_args <= high 00619 // It throws an exception if wrong number of arguments. 00620 static uInt checkNumOfArg (uInt low, uInt high, 00621 const PtrBlock<TableExprNodeRep*>& nodes); 00622 00623 // Get the child nodes. 00624 const PtrBlock<TableExprNodeRep*>& getChildren() const 00625 { return operands_p; } 00626 00627 // Check datatype of nodes and return output type. 00628 // It also sets the expected data type of the operands (from dtIn). 00629 static NodeDataType checkDT (Block<Int>& dtypeOper, 00630 NodeDataType dtIn, NodeDataType dtOut, 00631 const PtrBlock<TableExprNodeRep*>& nodes); 00632 00633 protected: 00634 PtrBlock<TableExprNodeRep*> operands_p; 00635 }; 00636 00637 00638 00639 //# Get the data type of the node. 00640 inline TableExprNodeRep::NodeDataType TableExprNodeRep::dataType() const 00641 { return dtype_p; } 00642 00643 //# Get the value type of the node. 00644 inline TableExprNodeRep::ValueType TableExprNodeRep::valueType() const 00645 { return vtype_p; } 00646 00647 //# Set the value type of the node. 00648 inline void TableExprNodeRep::setValueType (TableExprNodeRep::ValueType vtype) 00649 { vtype_p = vtype; } 00650 00651 //# Get the operator type of the node. 00652 inline TableExprNodeRep::OperType TableExprNodeRep::operType() const 00653 { return optype_p; } 00654 00655 //# Get the expression type of the node. 00656 inline TableExprNodeRep::ExprType TableExprNodeRep::exprType() const 00657 { return exprtype_p; } 00658 00659 //# Is the expression a constant? 00660 inline Bool TableExprNodeRep::isConstant() const 00661 { return (exprtype_p == Constant); } 00662 00663 //# Get the unit of the node. 00664 inline const Unit& TableExprNodeRep::unit() const 00665 { return unit_p; } 00666 00667 //# Get the fixed dimensionality of the node. 00668 inline Int TableExprNodeRep::ndim() const 00669 { return ndim_p; } 00670 00671 //# Get the fixed shape of the node. 00672 inline const IPosition& TableExprNodeRep::shape() const 00673 { return shape_p; } 00674 00675 //# Get the table from which the node is derived. 00676 inline Table& TableExprNodeRep::table() 00677 { return table_p; } 00678 inline const Table& TableExprNodeRep::table() const 00679 { return table_p; } 00680 00681 inline void TableExprNodeRep::checkTablePtr (const TableExprNodeRep* node) 00682 { checkTablePtr (table_p, node); } 00683 inline void TableExprNodeRep::fillExprType (const TableExprNodeRep* node) 00684 { fillExprType (exprtype_p, node); } 00685 00686 //# Link to the node. 00687 inline TableExprNodeRep* TableExprNodeRep::link() 00688 { 00689 count_p++; 00690 return this; 00691 } 00692 00693 00694 } //# NAMESPACE CASA - END 00695 00696 #endif