casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TiledDataStManAccessor.h
Go to the documentation of this file.
00001 //# TiledDataStManAccessor.h: Gives access to some TiledDataStMan functions
00002 //# Copyright (C) 1994,1995,1996,1997,1999
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: TiledDataStManAccessor.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
00027 
00028 #ifndef TABLES_TILEDDATASTMANACCESSOR_H
00029 #define TABLES_TILEDDATASTMANACCESSOR_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 #include <tables/Tables/TiledStManAccessor.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 //# Forward Declarations
00038 class TiledDataStMan;
00039 class Table;
00040 class String;
00041 class IPosition;
00042 class Record;
00043 
00044 
00045 // <summary>
00046 // Give access to some TiledDataStMan functions
00047 // </summary>
00048 
00049 // <use visibility=export>
00050 
00051 // <reviewed reviewer="Gareth Hunt" date="94Nov17" tests="">
00052 // </reviewed>
00053 
00054 // <prerequisite>
00055 //# Classes you should understand before using this one.
00056 // <li> <linkto class=ROTiledStManAccessor>ROTiledStManAccessor</linkto>
00057 // <li> <linkto class=TiledDataStMan>TiledDataStMan</linkto>
00058 // </prerequisite>
00059 
00060 // <synopsis>
00061 // The Table system has one or more storage managers underneath.
00062 // These storage managers are invisible and there is no way to
00063 // get access to them.
00064 // However, the <linkto class=TiledDataStMan>TiledDataStMan</linkto>
00065 // storage manager is quite specific. It has a few functions which
00066 // need to be called by the user, in particular the functions
00067 // defining and extending a hypercube.
00068 // <p>
00069 // The class TiledDataStManAccessor gives the user the means to
00070 // access a TiledDataStMan object and to call the functions mentioned above.
00071 // It can only be constructed for a table opened for read/write (because
00072 // the functions in it need write access).
00073 // </synopsis> 
00074 
00075 // <motivation>
00076 // In principle a pointer to TiledDataStMan could be used.
00077 // However, that would give access to all public functions.
00078 // Furthermore it could not distinguish between read/write and readonly
00079 // tables. 
00080 // </motivation>
00081 
00082 // <example>
00083 // <srcblock>
00084 // // Open a table for write.
00085 // Table table ("someName", Table::Update);
00086 // // Get access to the tiled data storage manager with name UVdata.
00087 // TiledDataStManAccessor accessor (Table, "UVdata");
00088 // // Add a hypercube to it (requires addition of rows).
00089 // // Define the values of the ID and coordinate columns.
00090 // // (The coordinate vectors have to be filled in one way or another).
00091 // Vector<double> timeVector(70);
00092 // Vector<double> baselineVector(60);
00093 // Vector<double> freqVector(50);
00094 // Vector<double> polVector(4);
00095 // Record values;
00096 // values.define ("ID", 4);                 // ID=4
00097 // values.define ("time", timeVector);
00098 // values.define ("baseline", baselineVector);
00099 // values.define ("freq", freqVector);
00100 // values.define ("pol", polVector);
00101 // table.addRow (4200);
00102 // accessor.addHypercube (IPosition(4,4,50,60,70),    // cube shape
00103 //                        IPosition(4,4,5,6,7),       // tile shape
00104 //                        values);                    // id/coord values
00105 // </srcblock>
00106 // </example>
00107 
00108 // <todo asof="$DATE:$">
00109 //# A List of bugs, limitations, extensions or planned refinements.
00110 //  <li> A base class RO_Tiled(Data)StManAccessor may once be needed
00111 //       for access to a tiled data storage manager in a readonly table
00112 // </todo>
00113 
00114 
00115 
00116 class TiledDataStManAccessor : public ROTiledStManAccessor
00117 {
00118 public:
00119 
00120     // Construct the object for the data manager in the table.
00121     // An exception is thrown if the data manager type does not
00122     // match the type of this TiledDataStManAccessor object.
00123     // Also an exception is thrown if the table is not open for read/write.
00124     TiledDataStManAccessor (const Table& table, const String& dataManagerName);
00125     TiledDataStManAccessor ();
00126 
00127     ~TiledDataStManAccessor();
00128 
00129     // Copy constructor (reference semantics).
00130     TiledDataStManAccessor (const TiledDataStManAccessor& that);
00131 
00132     // Assignment (reference semantics).
00133     TiledDataStManAccessor& operator= (const TiledDataStManAccessor& that);
00134 
00135     // Add a hypercube.
00136     // The possible coordinate- and id-values have to be given in the
00137     // record (where the field names should be equal to the
00138     // coordinate and id column names).
00139     void addHypercube (const IPosition& cubeShape,
00140                        const IPosition& tileShape,
00141                        const Record& values);
00142 
00143     // Extend the hypercube with the given number of elements in
00144     // the last dimension.
00145     // The record should contain the id values (to get the correct
00146     // hypercube) and coordinate values for the elements added.
00147     void extendHypercube (uInt incrInLastDim, const Record& values);
00148 
00149 
00150 private:
00151     //# Declare the data members.
00152     TiledDataStMan* tiledDataManPtr_p;
00153 };
00154 
00155 
00156 
00157 
00158 } //# NAMESPACE CASA - END
00159 
00160 #endif