casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ExprUDFNode.h
Go to the documentation of this file.
00001 //# ExprUDFNode.h: Class representing a scalar UDF in select expression
00002 //# Copyright (C) 2010
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: ExprUDFNode.h 21146 2011-11-30 14:43:25Z gervandiepen $
00027 
00028 #ifndef TABLES_EXPRUDFNODE_H
00029 #define TABLES_EXPRUDFNODE_H
00030 
00031 //# Includes
00032 #include <tables/Tables/ExprNodeRep.h>
00033 #include <tables/Tables/UDFBase.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037   //# Forward Declarations
00038   class TableExprNodeSet;
00039 
00040   // <summary>
00041   // Class representing a function in table select expression
00042   // </summary>
00043 
00044   // <use visibility=local>
00045 
00046   // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
00047   // </reviewed>
00048   // <prerequisite>
00049   //# Classes you should understand before using this one.
00050   //   <li> <linkto class=TableExprNodeMulti>TableExprNodeMulti</linkto>
00051   // </prerequisite>
00052 
00053   // <synopsis>
00054   // This class represents a function in a table select tree.
00055   // The <src>rownumber</src> function is represented by class
00056   // <linkto class=TableExprNodeRownr>TableExprNodeRownr</linkto>.
00057   // The <src>rowid</src> function is represented by class
00058   // <linkto class=TableExprNodeRowid>TableExprNodeRowid</linkto>.
00059   // The <src>rand</src> function is represented by class
00060   // <linkto class=TableExprNodeRandom>TableExprNodeRandom</linkto>.
00061   // <p>
00062   // When one wants to add a function to the table selection grammar,
00063   // the following has to be done:
00064   // <ul>
00065   //  <li> Add the function to the enum below.
00066   //  <li> Implement the function in the get functions in ExprFuncNode(Array).cc.
00067   //  <li> Implement the function in the checkOperands in ExprFuncNode.cc.
00068   //  <li> Declare and define the function in ExprNode.h (for C++ binding).
00069   //  <li> Add the function to findFunc in TableParse.cc (for TaQL).
00070   // </ul>
00071   // </synopsis> 
00072 
00073 
00074   class TableExprUDFNode: public TableExprNodeMulti
00075   {
00076   public:
00077 
00078     // Constructor
00079     TableExprUDFNode (UDFBase* udf, const Table&,
00080                       const TableExprNodeSet& source);
00081 
00082     // Destructor
00083     virtual ~TableExprUDFNode();
00084 
00085     // Functions to get the desired result of a function
00086     // <group>
00087     virtual Bool      getBool     (const TableExprId& id);
00088     virtual Int64     getInt      (const TableExprId& id);
00089     virtual Double    getDouble   (const TableExprId& id);
00090     virtual DComplex  getDComplex (const TableExprId& id);
00091     virtual String    getString   (const TableExprId& id);
00092     virtual TaqlRegex getRegex    (const TableExprId& id);
00093     virtual MVTime    getDate     (const TableExprId& id);
00094     // </group>
00095 
00096   private:
00097     UDFBase* itsUDF;
00098   };
00099 
00100 
00101 } //# NAMESPACE CASA - END
00102 
00103 #endif