casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TaQLResult.h
Go to the documentation of this file.
00001 //# TaQLResult.h: Class to hold the result of a TaQL command
00002 //# Copyright (C) 2004
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: TaQLResult.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
00027 
00028 #ifndef TABLES_TAQLRESULT_H
00029 #define TABLES_TAQLRESULT_H
00030 
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <tables/Tables/Table.h>
00035 #include <tables/Tables/ExprNode.h>
00036 
00037 namespace casa {
00038 
00039 // <summary>
00040 // Class to hold the result of a TaQL command.
00041 // </summary>
00042 
00043 // <use visibility=local>
00044 
00045 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
00046 // </reviewed>
00047 
00048 // <prerequisite>
00049 //# Classes you should understand before using this one.
00050 // </prerequisite>
00051 
00052 // <synopsis> 
00053 // The result of a TaQL command can be a Table or a TableExprNode.
00054 // This class holds the actual result.
00055 // </synopsis> 
00056 
00057 // <motivation>
00058 // It is possible to give a TaQL command resulting in a TableExprNode
00059 // to make it possible to make expressions of columns.
00060 // </motivation>
00061 
00062 //# <todo asof="$DATE:$">
00063 //# A List of bugs, limitations, extensions or planned refinements.
00064 //# </todo>
00065 
00066 
00067 class TaQLResult
00068 {
00069 public:
00070   // Construct from a Table.
00071   TaQLResult (const Table& = Table());
00072 
00073   // Construct from a TableExprNode.
00074   explicit TaQLResult (const TableExprNode&);
00075 
00076   // Is the result a Table?
00077   Bool isTable() const
00078     { return itsNode.isNull(); }
00079 
00080   // Return the result as a Table.
00081   // It throws an exception if it is not a Table.
00082   Table table() const;
00083 
00084   // Make it possible to convert automatically to a Table
00085   //# (for backwards compatibility).
00086   operator Table() const
00087     { return table(); }
00088 
00089   // Return the result as a TableExprNode.
00090   // It throws an exception if it is not a TableExprNode.
00091   TableExprNode node() const;
00092 
00093 private:
00094   Table itsTable;
00095   TableExprNode itsNode;
00096 };
00097 
00098 }
00099 #endif