TBXMLDriver.h

Go to the documentation of this file.
00001 //# TBXMLDriver.h: Driver for converting table data into an XML String.
00002 //# Copyright (C) 2005
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: $
00027 #ifndef TBXMLDRIVER_H_
00028 #define TBXMLDRIVER_H_
00029 
00030 /*
00031 #include <casa/BasicSL/String.h>
00032 #include <tables/Tables/Table.h>
00033 
00034 // <summary>
00035 // Driver for converting table data into an XML String.
00036 // </summary>
00037 //
00038 // <synopsis>
00039 // TBXMLDriver, initially used in the CasaJNI code for the Java table browser,
00040 // is an interface to read from a table on disk and return XML which
00041 // holds the requested data.  There is one public method which takes a
00042 // command in string form and returns the XML result.  There is infrastructure
00043 // to access remote tables, but it is not implemented.
00044 // </synopsis>
00045 
00046 /* Examples of commands:
00047  *     
00048  * To load rows from the table:
00049  *      send.table.query # SELECT FROM /casa/table/ <START = 0 number = 1000>
00050  * where # is the length of the string starting from the next character.
00051  * 
00052  * To load rows from given fields in the table:
00053  *      send.table.query # SELECT FIELD1,FIELD2 FROM /casa/table/
00054  *      <START = 0 number = 1000>
00055  * where # is the length of the string starting from the next character.
00056  * 
00057  * For the previous two commands, for array data only the shape is returned
00058  * for arrays with dimension > 2.  To return the full array data, use
00059  * send.table.full instead of send.table.query.
00060  * 
00061  * To view a data array:
00062  *      send.table.array #<ARRAYINFO>
00063  *          <QUERY> SELECT FROM /casa/table/ </QUERY>
00064  *          <ROW> 5 </ROW> <COLUMN> 5 </COLUMN> <TYPE> TpArrayInt </TYPE> 
00065  *      </ARRAYINFO>
00066  * where # is the length of the string starting from the next character.
00067  * 
00068  * To update data in the table:
00069  *      send.table.updat #<QUERY> SELECT FROM /casa/table/ </QUERY>
00070  *      <COMMAND>
00071  *          <UPDATE row = 5 col = 5 val = "newValue" >
00072  *      </COMMAND>
00073  * where # is the length of the string starting from the next character.
00074  * 
00075  * To update data in an array cell:
00076  *      send.table.updat #<QUERY> SELECT FROM /casa/table/ </QUERY>
00077  *      <COMMAND>
00078  *          <ARRAYUPDATE row = 5 col = 5 >
00079  *              <ARRAYCELLUPDATE coordinates = [ 4 2 ] val = "newValue" >
00080  *          </ARRAYUPDATE>
00081  *      </COMMAND>
00082  * where # is the length of the string starting from the next character.
00083  * 
00084  * To insert rows:
00085  *      send.table.updat #<QUERY> SELECT FROM /casa/table/ </QUERY>
00086  *      <COMMAND>
00087  *          <ADDROW>
00088  *          <ADDROW>
00089  *      </COMMAND>
00090  * where # is the length of the string starting from the next character.
00091  * 
00092  * To delete rows:
00093  *      send.table.updat #<QUERY> SELECT FROM /casa/table/ </QUERY>
00094  *      <COMMAND>
00095  *          <DELROW 10 >
00096  *          <DELROW 5 >
00097  *      </COMMAND
00098  *      
00099  */
00100 
00101 /*
00102 class TBXMLDriver {
00103 public:
00104     // Takes a command in pseudo-TaQL format and returns XML in pseduo-VOTable
00105     // format.  For command examples, see TBXMLDriver.h code comments.
00106     static String dowork(const char* buff);
00107 
00108 private:
00109     // Indicates whether debug information should be printed or not.
00110     static const bool showdebug;
00111     
00112     // Buffer size.
00113     static const int BUF_SIZE = 2048;
00114     
00115     // Packet size.
00116     static const int PacketSize = 4096;
00117     
00118     // Creates the XML representation of a VOTable from the given parameters.
00119     static String createVOTab(String tablename, int totalrows,
00120                              Vector<String> colnames, Vector<String> datatype,
00121                              String records, String keyword, Bool insRowOk,
00122                              Bool delRowOk, String columnkeywords);
00123     
00124     // Creates the XML representation of a keyword from the given parameters.
00125     static String createKeyword(TableRecord &trec, int a);
00126     
00127     // Sends the given String.
00128     static int SendData(int fd, const String &hits);
00129     
00130     // Makes the return result from the given String.
00131     static char* mkReturnResult(const String &hits);
00132     
00133     // Sets up communication.
00134     static Bool setupComm(Int &fd);
00135     
00136     // Reads input into the given char*.
00137     static int readn(int fd, char *ptr, int nbytes);
00138     
00139     // Writes output to the given char*.
00140     static int writen(int fd, char *ptr, int nbytes);
00141 };
00142 */
00143 
00144 #endif /* TBXMLDRIVER_H_*/
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1