casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ConcatScalarColumn.h
Go to the documentation of this file.
00001 //# ConcatScalarColumn.h: A typed scalar column in a concatenated table
00002 //# Copyright (C) 2008
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: ConcatScalarColumn.h 20997 2010-11-17 07:05:29Z gervandiepen $
00027 
00028 #ifndef TABLES_CONCATSCALARCOLUMN_H
00029 #define TABLES_CONCATSCALARCOLUMN_H
00030 
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <tables/Tables/ConcatColumn.h>
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038   // <summary>
00039   // A typed column in a concatenated table
00040   // </summary>
00041 
00042   // <use visibility=local>
00043 
00044   // <reviewed reviewer="UNKNOWN" date="" tests="">
00045   // </reviewed>
00046 
00047   // <prerequisite>
00048   //# Classes you should understand before using this one.
00049   //   <li> ConcatTable
00050   //   <li> BaseColumn
00051   // </prerequisite>
00052 
00053   // <etymology>
00054   // ConcatTable represents a column in a ConcatTable. A ConcatTable is a table
00055   // referencing another table, usually as the result of a select, etc..
00056   // </etymology>
00057 
00058   // <synopsis> 
00059   // ConcatColumn handles the access of a column in a ConcatTable.
00060   // It calls the corresponding function in the referenced column
00061   // while converting the given row number to the row number in the
00062   // referenced table.
00063   // </synopsis> 
00064 
00065   // <motivation>
00066   // This class is untyped, i.e. not templated.
00067   // Every call is sent to the underlying referenced BaseColumn which
00068   // is typed by the virtual function mechanism.
00069   // A ConcatColumn can never be used directly. A user always has to
00070   // construct a typed ArrayColumn or ScalarColumn object to access a column.
00071   // This means everyting is fully type safe.
00072   // </motivation>
00073 
00074   // <todo asof="$DATE:$">
00075   //# A List of bugs, limitations, extensions or planned refinements.
00076   //   <li> Act upon removal of rows or the underlying column
00077   // </todo>
00078 
00079   template<typename T>
00080   class ConcatScalarColumn : public ConcatColumn
00081   {
00082   public:
00083     // Construct the ConcatColumn. It will point to the given column
00084     // description, ConcatTable and referenced column.
00085     // The ConcatTable will be used to convert the rownr to the rownr
00086     // in the referenced column.
00087     ConcatScalarColumn (const BaseColumnDesc*, ConcatTable*);
00088 
00089     ~ConcatScalarColumn();
00090 
00091     // Get the vector of all scalar values in a column.
00092     virtual void getScalarColumn (void* dataPtr) const;
00093 
00094     // Get the vector of some scalar values in a column.
00095     virtual void getScalarColumnCells (const RefRows& rownrs,
00096                                        void* dataPtr) const;
00097 
00098     // Put the vector of all scalar values in the column.
00099     virtual void putScalarColumn (const void* dataPtr);
00100 
00101     // Get the vector of some scalar values in a column.
00102     virtual void putScalarColumnCells (const RefRows& rownrs,
00103                                        const void* dataPtr);
00104 
00105     // Handle the creation and deletion of sort keys.
00106     // <group>
00107     virtual void makeSortKey (Sort& sortobj,
00108                               CountedPtr<BaseCompare>& cmpObj,
00109                               Int order,
00110                               const void*& dataSave);
00111     virtual void makeRefSortKey (Sort& sortobj,
00112                                  CountedPtr<BaseCompare>& cmpObj,
00113                                  Int order,
00114                                  const Vector<uInt>& rownrs,
00115                                  const void*& dataSave);
00116     virtual void fillSortKey (const Vector<T>* vecPtr,
00117                               Sort& sortobj,
00118                               CountedPtr<BaseCompare>& cmpObj,
00119                               Int order);
00120     virtual void freeSortKey (const void*& dataSave);
00121     // </group>
00122 
00123   };
00124 
00125 } //# NAMESPACE CASA - END
00126 
00127 #ifndef CASACORE_NO_AUTO_TEMPLATES
00128 #include <tables/Tables/ConcatScalarColumn.tcc>
00129 #endif //# CASACORE_NO_AUTO_TEMPLATES
00130 #endif