casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TableRowProxy.h
Go to the documentation of this file.
00001 //# TableRowProxy.h: Proxy for table row access
00002 //# Copyright (C) 1994,1995,1996,1999,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: TableRowProxy.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
00027 
00028 #ifndef TABLES_TABLEROWPROXY_H
00029 #define TABLES_TABLEROWPROXY_H
00030 
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <tables/Tables/TableRow.h>
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038 //# Forward Declarations
00039 class TableProxy;
00040 class Record;
00041 
00042 
00043 // <summary>
00044 // Proxy for table row access.
00045 // </summary>
00046 
00047 // <use visibility=export>
00048 
00049 // <reviewed reviewer="Paul Shannon" date="1995/09/15" tests="tgtable.g" demos="">
00050 // </reviewed>
00051 
00052 // <prerequisite>
00053 //# Classes you should understand before using this one.
00054 //   <li> class TableRow
00055 // </prerequisite>
00056 
00057 // <etymology>
00058 // TableRowProxy holds a TableRow object for the table
00059 // glish client.
00060 // </etymology>
00061 
00062 // <synopsis> 
00063 // TableRowProxy gives access to row-based table accessor functions.
00064 // It is primarily meant to be used in classes that wrap access to it
00065 // from scripting languages (like Glish and Python).
00066 // However, it can also be used directly from other C++ code.
00067 //
00068 // A TableRowProxy object is usually created by class
00069 // <linkto class=TableProxy>TableProxy</linkto>.
00070 // </synopsis>
00071 
00072 class TableRowProxy
00073 {
00074 public:
00075   // Default constructor is only needed for the Block container.
00076   TableRowProxy();
00077 
00078   // Construct for the given columns in the table.
00079   TableRowProxy (const TableProxy& table,
00080                  const Vector<String>& columnNames, Bool exclude);
00081 
00082   // Copy constructor (copy semantics).
00083   TableRowProxy (const TableRowProxy&);
00084 
00085   ~TableRowProxy();
00086 
00087   // Assignment (copy semantics).
00088   TableRowProxy& operator= (const TableRowProxy&);
00089 
00090   // Test if the underlying TableRow object is invalid.
00091   Bool isNull() const;
00092 
00093   // Test if values can be written.
00094   Bool isWritable() const;
00095 
00096   // Get values for the given row.
00097   Record get (uInt rownr) const;
00098 
00099   // Put values for the given row.
00100   // The given record has to conform the fields in the table row.
00101   void put (uInt rownr, const Record& values, Bool matchingFields);
00102 
00103 private:
00104   Bool       isWritable_p;
00105   ROTableRow rorow_p;
00106   TableRow   rwrow_p;
00107 };
00108 
00109 
00110 inline Bool TableRowProxy::isWritable() const
00111 {
00112   return isWritable_p;
00113 }
00114 
00115 
00116 } //# NAMESPACE CASA - END
00117 
00118 
00119 #endif