LCOV - code coverage report
Current view: top level - synthesis/CalTables - CalTableDesc.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 151 156 96.8 %
Date: 2024-12-11 20:54:31 Functions: 12 12 100.0 %

          Line data    Source code
       1             : //# CalTableDesc.cc: Implementation of CalTableDesc.h
       2             : //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //#
       5             : //# This library is free software; you can redistribute it and/or modify it
       6             : //# under the terms of the GNU Library General Public License as published by
       7             : //# the Free Software Foundation; either version 2 of the License, or (at your
       8             : //# option) any later version.
       9             : //#
      10             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      11             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      13             : //# License for more details.
      14             : //#
      15             : //# You should have received a copy of the GNU Library General Public License
      16             : //# along with this library; if not, write to the Free Software Foundation,
      17             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      18             : //#
      19             : //# Correspondence concerning AIPS++ should be addressed as follows:
      20             : //#        Internet email: casa-feedback@nrao.edu.
      21             : //#        Postal address: AIPS++ Project Office
      22             : //#                        National Radio Astronomy Observatory
      23             : //#                        520 Edgemont Road
      24             : //#                        Charlottesville, VA 22903-2475 USA
      25             : //#
      26             : //# $Id$
      27             : //----------------------------------------------------------------------------
      28             : 
      29             : #include <synthesis/CalTables/CalTableDesc.h>
      30             : #include <msvis/MSVis/MSCalEnums.h>
      31             : #include <casacore/tables/Tables/ScaColDesc.h>
      32             : #include <casacore/tables/Tables/ArrColDesc.h>
      33             : #include <casacore/tables/Tables/SetupNewTab.h>
      34             : #include <casacore/tables/Tables/TableRecord.h>
      35             : #include <casacore/measures/TableMeasures/TableMeasRefDesc.h>
      36             : #include <casacore/measures/TableMeasures/TableMeasValueDesc.h>
      37             : #include <casacore/measures/TableMeasures/TableMeasDesc.h>
      38             : #include <casacore/measures/TableMeasures/TableQuantumDesc.h>
      39             : #include <casacore/measures/Measures/MEpoch.h>
      40             : #include <casacore/measures/Measures/MFrequency.h>
      41             : #include <casacore/measures/Measures/MDirection.h>
      42             : #include <casacore/casa/Containers/Record.h>
      43             : #include <casacore/casa/Arrays/IPosition.h>
      44             : 
      45             : using namespace casacore;
      46             : namespace casa { //# NAMESPACE CASA - BEGIN
      47             : 
      48             : //----------------------------------------------------------------------------
      49             : 
      50           3 : CalTableDesc::CalTableDesc() : itsCalMainDesc(defaultCalMain("")), 
      51           3 :   itsCalHistoryDesc(defaultCalHistory()),
      52           6 :   itsCalDescDesc(defaultCalDesc())
      53             : {
      54             : // Default null constructor for calibration table description (v2.0)
      55             : // Output to private data:
      56             : //    itsCalMainDesc      TableDesc        Table descriptor (cal_main)
      57             : //    itsCalHistoryDesc   TableDesc        Table descriptor (cal_history)
      58             : //    itsCalDescDesc      TableDesc        Table descriptor (cal_desc)
      59             : //
      60           3 : };
      61             : 
      62             : //----------------------------------------------------------------------------
      63             : 
      64           3 : CalTableDesc::CalTableDesc (const String& type) : 
      65           3 :   itsCalMainDesc(defaultCalMain(type)), 
      66           3 :   itsCalHistoryDesc(defaultCalHistory()), itsCalDescDesc(defaultCalDesc())
      67             : {
      68             : // Constructor for calibration table description (v2.0)
      69             : // Inputs:
      70             : //    type                const String&    Cal table type (eg. "P Jones")
      71             : // Output to private data:
      72             : //    itsCalMainDesc      TableDesc        Table descriptor (cal_main)
      73             : //    itsCalHistoryDesc   TableDesc        Table descriptor (cal_history)
      74             : //    itsCalDescDesc      TableDesc        Table descriptor (cal_desc)
      75             : //
      76           3 : };
      77             : 
      78             : //----------------------------------------------------------------------------
      79             : 
      80           6 : TableDesc CalTableDesc::defaultCalHistory()
      81             : {
      82             : // Generate the default table descriptor for the Cal History sub-table
      83             : // Output:
      84             : //    defaultCalHistory     TableDesc     Default Cal History descriptor
      85             : //
      86          12 :   TableDesc td ("Cal History", "2.0", TableDesc::Scratch);
      87           6 :   td.comment() = "Calibration history sub-table";
      88           6 :   td.addColumn (ScalarColumnDesc <String> (MSC::fieldName (MSC::CAL_PARMS),
      89             :                                            ColumnDesc::Direct));
      90           6 :   td.addColumn (ScalarColumnDesc <String> (MSC::fieldName (MSC::CAL_TABLES),
      91             :                                            ColumnDesc::Direct));
      92           6 :   td.addColumn (ScalarColumnDesc <String> (MSC::fieldName (MSC::CAL_SELECT),
      93             :                                            ColumnDesc::Direct));
      94           6 :   td.addColumn (ScalarColumnDesc <String> (MSC::fieldName (MSC::CAL_NOTES),
      95             :                                            ColumnDesc::Direct));
      96           6 :   return td;
      97           0 : };
      98             : 
      99             : //----------------------------------------------------------------------------
     100             : 
     101           6 : TableDesc CalTableDesc::defaultCalDesc()
     102             : {
     103             : // Generate the default table descriptor for the Cal Desc sub-table
     104             : // Output:
     105             : //    defaultCalDesc        TableDesc       Default Cal Desc descriptor
     106             : //
     107          12 :   TableDesc td ("Cal Desc", "1.0", TableDesc::Scratch);
     108           6 :   td.comment() = "Calibration description sub-table";
     109           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::NUM_SPW),
     110             :                                         ColumnDesc::Direct));
     111           6 :   td.addColumn (ArrayColumnDesc <Int> (MSC::fieldName (MSC::NUM_CHAN)));
     112           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::NUM_RECEPTORS),
     113             :                                         ColumnDesc::Direct));
     114           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::N_JONES),
     115             :                                         ColumnDesc::Direct));
     116             :   td.addColumn 
     117           6 :     (ArrayColumnDesc <Int> (MSC::fieldName (MSC::SPECTRAL_WINDOW_ID)));
     118           6 :   td.addColumn (ArrayColumnDesc <Double> (MSC::fieldName (MSC::CHAN_FREQ)));
     119           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::MEAS_FREQ_REF),
     120             :                                         ColumnDesc::Direct));
     121           6 :   td.addColumn (ArrayColumnDesc <Double> (MSC::fieldName (MSC::CHAN_WIDTH)));
     122           6 :   td.addColumn (ArrayColumnDesc <Int> (MSC::fieldName (MSC::CHAN_RANGE)));
     123           6 :   td.addColumn (ArrayColumnDesc <String> 
     124          12 :                 (MSC::fieldName (MSC::POLARIZATION_TYPE)));
     125           6 :   td.addColumn (ScalarColumnDesc <String> (MSC::fieldName (MSC::JONES_TYPE),
     126             :                                            ColumnDesc::Direct));
     127           6 :   td.addColumn (ScalarColumnDesc <String> (MSC::fieldName (MSC::MS_NAME),
     128             :                                            ColumnDesc::Direct));
     129             : 
     130             :   // Add TableMeasures information for Measures/Quanta columns
     131             :   //
     132             :   // CHAN_FREQ
     133           6 :   TableMeasValueDesc chanFreqMeasVal (td, MSC::fieldName(MSC::CHAN_FREQ));
     134           6 :   TableMeasRefDesc chanFreqMeasRef (td, MSC::fieldName (MSC::MEAS_FREQ_REF));
     135           6 :   TableMeasDesc<MFrequency> chanFreqMeasCol (chanFreqMeasVal, chanFreqMeasRef);
     136           6 :   chanFreqMeasCol.write (td);
     137             :   
     138             :   // CHAN_WIDTH
     139          12 :   TableQuantumDesc chanWidthQuantDesc (td, MSC::fieldName (MSC::CHAN_WIDTH),
     140          12 :                                        Unit ("Hz"));
     141           6 :   chanWidthQuantDesc.write (td);
     142             : 
     143          12 :   return td;
     144           6 : };
     145             : 
     146             : //----------------------------------------------------------------------------
     147             : 
     148           6 : TableDesc CalTableDesc::defaultCalMain (const String& type)
     149             : {
     150             : // Generate the default table descriptor for the Cal Main sub-table
     151             : // Input:
     152             : //    type             const String&      Cal table type (eg. "P Jones")
     153             : // Output:
     154             : //    defaultCalMain   TableDesc          Default Cal Main descriptor
     155             : //
     156             :   // Set up table descriptor and add comment field
     157           6 :   TableDesc td (type, "1.0", TableDesc::Scratch);
     158           6 :   td.comment() = type + " calibration table";
     159             : 
     160             :   // Define keywords
     161           6 :   Record keyWordRec;
     162             :   // Cal_desc and cal_history indices
     163           6 :   keyWordRec.define (MSC::fieldName (MSC::CAL_DESC_ID), 0);
     164           6 :   keyWordRec.define (MSC::fieldName (MSC::CAL_HISTORY_ID), 0);
     165             :   // Add to table descriptor
     166           6 :   td.rwKeywordSet().assign (keyWordRec);
     167             : 
     168             :   // Cal Main columns (MS Main indices)
     169           6 :   td.addColumn (ScalarColumnDesc <Double> (MSC::fieldName (MSC::TIME),
     170             :                                            ColumnDesc::Direct));
     171             :   td.addColumn 
     172           6 :     (ScalarColumnDesc <Double> (MSC::fieldName (MSC::TIME_EXTRA_PREC),
     173             :                                 ColumnDesc::Direct));
     174           6 :   td.addColumn (ScalarColumnDesc <Double> (MSC::fieldName (MSC::INTERVAL),
     175             :                                            ColumnDesc::Direct));
     176           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::ANTENNA1),
     177             :                                         ColumnDesc::Direct));
     178           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::FEED1),
     179             :                                         ColumnDesc::Direct));
     180           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::FIELD_ID),
     181             :                                         ColumnDesc::Direct));
     182           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::ARRAY_ID),
     183             :                                         ColumnDesc::Direct));
     184           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::OBSERVATION_ID),
     185             :                                         ColumnDesc::Direct));
     186           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::SCAN_NUMBER),
     187             :                                         ColumnDesc::Direct));
     188           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::PROCESSOR_ID),
     189             :                                         ColumnDesc::Direct));
     190           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::STATE_ID),
     191             :                                         ColumnDesc::Direct));
     192           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::PHASE_ID),
     193             :                                         ColumnDesc::Direct));
     194           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::PULSAR_BIN),
     195             :                                         ColumnDesc::Direct));
     196           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::PULSAR_GATE_ID),
     197             :                                         ColumnDesc::Direct));
     198             : 
     199             :   // Secondary MS indices (from MS sub-tables)
     200           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::FREQ_GROUP),
     201             :                                         ColumnDesc::Direct));
     202           6 :   td.addColumn (ScalarColumnDesc<String> (MSC::fieldName(MSC::FREQ_GROUP_NAME),
     203             :                                           ColumnDesc::Direct));
     204           6 :   td.addColumn (ScalarColumnDesc <String> (MSC::fieldName (MSC::FIELD_NAME),
     205             :                                            ColumnDesc::Direct));
     206           6 :   td.addColumn (ScalarColumnDesc <String> (MSC::fieldName (MSC::FIELD_CODE),
     207             :                                            ColumnDesc::Direct));
     208           6 :   td.addColumn (ScalarColumnDesc <String> (MSC::fieldName (MSC::SOURCE_NAME),
     209             :                                            ColumnDesc::Direct));
     210           6 :   td.addColumn (ScalarColumnDesc <String> (MSC::fieldName (MSC::SOURCE_CODE),
     211             :                                            ColumnDesc::Direct));
     212           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName(MSC::CALIBRATION_GROUP),
     213             :                                         ColumnDesc::Direct));
     214             : 
     215             :   // Gain values
     216           6 :   td.addColumn (ArrayColumnDesc <Complex> (MSC::fieldName (MSC::GAIN)));
     217             : 
     218             :   // Reference frame for antenna-based corrections
     219           6 :   td.addColumn (ArrayColumnDesc <Int> (MSC::fieldName (MSC::REF_ANT)));
     220           6 :   td.addColumn (ArrayColumnDesc <Int> (MSC::fieldName (MSC::REF_FEED)));
     221           6 :   td.addColumn (ArrayColumnDesc <Int> (MSC::fieldName (MSC::REF_RECEPTOR)));
     222           6 :   td.addColumn (ArrayColumnDesc <Double> (MSC::fieldName(MSC::REF_FREQUENCY)));
     223           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::MEAS_FREQ_REF),
     224             :                                         ColumnDesc::Direct));
     225           6 :   td.addColumn (ArrayColumnDesc <Double> (MSC::fieldName(MSC::REF_DIRECTION)));
     226           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::MEAS_DIR_REF),
     227             :                                         ColumnDesc::Direct));
     228             : 
     229             :   // Pointers to Cal_Desc and Cal_History sub-tables
     230           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::CAL_DESC_ID),
     231             :                                         ColumnDesc::Direct));
     232           6 :   td.addColumn (ScalarColumnDesc <Int> (MSC::fieldName (MSC::CAL_HISTORY_ID),
     233             :                                         ColumnDesc::Direct));
     234             : 
     235             :   // Add TableMeasures information for designated Measures/Quanta columns
     236             :   // 
     237             :   // TIME
     238           6 :   TableMeasValueDesc timeMeasVal (td, MSC::fieldName (MSC::TIME));
     239           6 :   TableMeasRefDesc timeMeasRef (MEpoch::DEFAULT);
     240           6 :   TableMeasDesc<MEpoch> timeMeasCol (timeMeasVal, timeMeasRef);
     241           6 :   timeMeasCol.write (td);
     242             : 
     243             :   // TIME fix Unit
     244          12 :   TableQuantumDesc timeQuantDesc (td, MSC::fieldName (MSC::TIME),
     245          12 :                                   Unit ("s"));
     246           6 :   timeQuantDesc.write (td);
     247             : 
     248             :   // TIME_EXTRA_PREC
     249          12 :   TableQuantumDesc timeEPQuantDesc (td, MSC::fieldName (MSC::TIME_EXTRA_PREC),
     250          12 :                                     Unit ("s"));
     251           6 :   timeEPQuantDesc.write (td);
     252             : 
     253             :   // INTERVAL
     254          12 :   TableQuantumDesc intervalQuantDesc (td, MSC::fieldName(MSC::INTERVAL),
     255          12 :                                       Unit ("s"));
     256           6 :   intervalQuantDesc.write (td);
     257             : 
     258             :   // REF_FREQUENCY
     259           6 :   TableMeasValueDesc refFreqMeasVal (td, MSC::fieldName (MSC::REF_FREQUENCY));
     260           6 :   TableMeasRefDesc refFreqMeasRef (td, MSC::fieldName (MSC::MEAS_FREQ_REF));
     261           6 :   TableMeasDesc<MFrequency> refFreqMeasCol (refFreqMeasVal, refFreqMeasRef);
     262           6 :   refFreqMeasCol.write (td);
     263             : 
     264             :   // REF_DIRECTION
     265           6 :   TableMeasValueDesc refDirMeasVal (td, MSC::fieldName (MSC::REF_DIRECTION));
     266           6 :   TableMeasRefDesc refDirMeasRef (td, MSC::fieldName (MSC::MEAS_DIR_REF));
     267           6 :   TableMeasDesc<MDirection> refDirMeasCol (refDirMeasVal, refDirMeasRef);
     268           6 :   refDirMeasCol.write (td);
     269             : 
     270          12 :   return td;
     271           6 : };
     272             : 
     273             : //----------------------------------------------------------------------------
     274             : 
     275           1 : TableDesc CalTableDesc::calMainDesc()
     276             : {
     277             : // Return the main calibration table descriptor
     278             : // Output:
     279             : //    calMainDesc     TableDesc        Table descriptor (cal_main)
     280             : //
     281           1 :   return itsCalMainDesc;
     282             : };
     283             : 
     284             : //----------------------------------------------------------------------------
     285             : 
     286           1 : TableDesc CalTableDesc::calHistoryDesc()
     287             : {
     288             : // Return the calibration history sub-table descriptor
     289             : // Output:
     290             : //    calHistoryDesc  TableDesc        Table descriptor (cal_history)
     291             : //
     292           1 :   return itsCalHistoryDesc;
     293             : };
     294             : 
     295             : //----------------------------------------------------------------------------
     296             : 
     297           1 : TableDesc CalTableDesc::calDescDesc()
     298             : {
     299             : // Return the calibration description sub-table descriptor
     300             : // Output:
     301             : //    calDescDesc     TableDesc        Table descriptor (cal_desc)
     302             : //
     303           1 :   return itsCalDescDesc;
     304             : };
     305             : 
     306             : //----------------------------------------------------------------------------
     307             : 
     308           4 : TableDesc CalTableDesc::defaultFitDesc()
     309             : {
     310             : // Generate the default table descriptor for fit parameters
     311             : // Output:
     312             : //    defaultFitDesc      TableDesc        Table descriptor (fit parameters)
     313             : // 
     314           4 :   TableDesc td;
     315           4 :   td.addColumn (ScalarColumnDesc <Bool> 
     316           8 :                 (MSC::fieldName (MSC::TOTAL_SOLUTION_OK), ColumnDesc::Direct));
     317           4 :   td.addColumn (ScalarColumnDesc <Float> (MSC::fieldName (MSC::TOTAL_FIT),
     318             :                                           ColumnDesc::Direct));
     319           4 :   td.addColumn (ScalarColumnDesc <Float> 
     320           8 :                 (MSC::fieldName (MSC::TOTAL_FIT_WEIGHT), ColumnDesc::Direct));
     321           4 :   td.addColumn (ArrayColumnDesc <Bool> (MSC::fieldName (MSC::SOLUTION_OK)));
     322           4 :   td.addColumn (ArrayColumnDesc <Float> (MSC::fieldName (MSC::FIT)));
     323           4 :   td.addColumn (ArrayColumnDesc <Float> (MSC::fieldName (MSC::FIT_WEIGHT)));
     324           4 :   td.addColumn (ArrayColumnDesc <Bool> (MSC::fieldName (MSC::FLAG)));
     325           4 :   td.addColumn (ArrayColumnDesc <Float> (MSC::fieldName (MSC::SNR)));
     326             :   
     327           4 :   return td;
     328           0 : };
     329             : 
     330             : //----------------------------------------------------------------------------
     331             : 
     332           1 : TableDesc CalTableDesc::defaultPolyDesc()
     333             : {
     334             : // Generate the default table descriptor for general polynomial parameters
     335             : // Output:
     336             : //    defaultPolyDesc      TableDesc        Table descriptor (poly parameters)
     337             : // 
     338           1 :   TableDesc td;
     339             :   
     340             :   // Additional parameters required for general polynomials
     341             :   // POLY_TYPE              - polynomial type (e.g. Chebyshev or spline)
     342             :   // POLY_MODE              - polynomial y-value (e.g. A&P)
     343             :   // SCALE_FACTOR           - overall polynomial scale factor
     344             :   // VALID_DOMAIN           - valid polynomial domain [x_0, x_1]
     345             :   // N_POLY_AMP             - polynomial degree for amplitude
     346             :   // N_POLY_PHASE           - polynomial degree for phase
     347             :   // POLY_COEFF_AMP         - polynomial coefficients for amplitude
     348             :   // POLY_COEFF_PHASE       - polynomial coefficients for phase
     349             :   // PHASE_UNITS            - units for the phase polynomial
     350             :   //
     351           1 :   td.addColumn(ScalarColumnDesc<String>(MSC::fieldName(MSC::POLY_TYPE)));
     352           1 :   td.addColumn(ScalarColumnDesc<String>(MSC::fieldName(MSC::POLY_MODE)));
     353           1 :   td.addColumn(ScalarColumnDesc<Complex>(MSC::fieldName(MSC::SCALE_FACTOR)));
     354           1 :   td.addColumn(ArrayColumnDesc<Double>(MSC::fieldName(MSC::VALID_DOMAIN)));
     355           1 :   td.addColumn(ScalarColumnDesc<Int>(MSC::fieldName(MSC::N_POLY_AMP)));
     356           1 :   td.addColumn(ScalarColumnDesc<Int>(MSC::fieldName(MSC::N_POLY_PHASE)));
     357           1 :   td.addColumn(ArrayColumnDesc<Double>(MSC::fieldName(MSC::POLY_COEFF_AMP)));
     358           1 :   td.addColumn(ArrayColumnDesc<Double>(MSC::fieldName(MSC::POLY_COEFF_PHASE)));
     359           1 :   td.addColumn(ScalarColumnDesc<String>(MSC::fieldName(MSC::PHASE_UNITS)));
     360             :   
     361           1 :   return td;
     362           0 : };
     363             : 
     364             : //----------------------------------------------------------------------------
     365             : 
     366           1 : TableDesc CalTableDesc::defaultSplineDesc()
     367             : {
     368             : // Generate the default table descriptor for spline polynomial parameters
     369             : // Output:
     370             : //    defaultSplineDesc      TableDesc     Table descriptor (spline parameters)
     371             : // 
     372           1 :   TableDesc td;
     373             : 
     374             :   // Additional parameters required for spline polynomials.
     375             :   // N_KNOTS_AMP            - number of spline knots in amplitude
     376             :   // N_KNOTS_PHASE          - number of spline knots in phase
     377             :   // SPLINE_KNOTS_AMP       - spline knot positions for amplitude
     378             :   // SPLINE_KNOTS_PHASE     - spline knot positions for phase
     379             :   //
     380           1 :   td.addColumn(ScalarColumnDesc<Int>(MSC::fieldName(MSC::N_KNOTS_AMP)));
     381           1 :   td.addColumn(ScalarColumnDesc<Int>(MSC::fieldName(MSC::N_KNOTS_PHASE)));
     382           1 :   td.addColumn(ArrayColumnDesc<Double>(MSC::fieldName(MSC::SPLINE_KNOTS_AMP)));
     383           1 :   td.addColumn(ArrayColumnDesc<Double>
     384           2 :                (MSC::fieldName(MSC::SPLINE_KNOTS_PHASE)));
     385             :   
     386           1 :   return td;
     387           0 : };
     388             : 
     389             : //----------------------------------------------------------------------------
     390             : 
     391           2 : TableDesc CalTableDesc::insertDesc (const TableDesc& tableDesc, 
     392             :                                     const TableDesc& insert, 
     393             :                                     const String& insertAfter)
     394             : {
     395             : // Insert one table descriptor into another after a specified
     396             : // column name.
     397             : // Input:
     398             : //    tableDesc       const TableDesc&      Input table descriptor
     399             : //    insert          const TableDesc&      Table descriptor to be inserted
     400             : //    insertAfter     const String&         Column name to insert after
     401             : // Output:
     402             : //    insertDesc      TableDesc             Output table descriptor
     403             : //
     404           2 :   TableDesc tdout;
     405             :   ColumnDesc* colDesc;
     406           2 :   Int ncol = tableDesc.ncolumn();
     407             :   Int jcol;
     408             : 
     409             :   // Loop over the number of columns in the input table descriptor
     410          89 :   for (jcol = 0; jcol < ncol; jcol++) {
     411          87 :     colDesc = new ColumnDesc (tableDesc.columnDesc (jcol));
     412             : 
     413             :     // Add column to output descriptor
     414          87 :     tdout.addColumn (*colDesc);
     415             : 
     416             :     // Insert second descriptor if appropriate
     417          87 :     if (colDesc->name() == insertAfter) {
     418           2 :       tdout.add (insert);
     419             :     };
     420          87 :     delete colDesc;
     421             :   };
     422             : 
     423           2 :   return tdout;
     424           0 : };
     425             : 
     426             : //----------------------------------------------------------------------------
     427             : 
     428             : 
     429             : 
     430             : 
     431             : } //# NAMESPACE CASA - END
     432             : 

Generated by: LCOV version 1.16