casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TVecScaCol.h
Go to the documentation of this file.
00001 //# TVecScaCol.h: Templated table scalar column vectors
00002 //# Copyright (C) 1994,1995,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: TVecScaCol.h 21298 2012-12-07 14:53:03Z gervandiepen $
00027 
00028 #ifndef TABLES_TVECSCACOL_H
00029 #define TABLES_TVECSCACOL_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 #include <tables/Tables/TVec.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 //# Forward Declarations
00038 class TableColumn;
00039 template<class T> class ScalarColumn;
00040 class String;
00041 
00042 
00043 // <summary>
00044 // Templated table scalar column vectors
00045 // </summary>
00046 
00047 // <use visibility=local>
00048 
00049 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
00050 // </reviewed>
00051 
00052 // <prerequisite>
00053 //# Classes you should understand before using this one.
00054 //   <li> TabVecRep
00055 // </prerequisite>
00056 
00057 // <etymology>
00058 // TabVecScaCol is the class dealing with a table vector representing
00059 // a column of scalars in a table.
00060 // </etymology>
00061 
00062 // <synopsis> 
00063 // TabVecScaCol objects are a view on a column of scalars in a table.
00064 // The semantics of these table vectors are the same as the normal
00065 // vectors. So for example, changing an element in the table vector
00066 // means changing the corresponding field in the underlying table.
00067 // </synopsis> 
00068 
00069 // <motivation>
00070 // TabVecScaCol is derived from TabVecRep and as such it is a letter for
00071 // the envelope class TableVector.
00072 // </motivation>
00073 
00074 // <templating arg=T>
00075 //  <li> Default constructor
00076 //  <li> Copy constructor
00077 //  <li> Assignment operator
00078 // </templating>
00079 
00080 // <todo asof="$DATE:$">
00081 //# A List of bugs, limitations, extensions or planned refinements.
00082 // </todo>
00083 
00084 
00085 template<class T>
00086 class TabVecScaCol : public TabVecRep<T>
00087 {
00088   //# Make members of parent class known.
00089 protected:
00090   using TabVecRep<T>::tag_p;
00091   using TabVecRep<T>::nrel_p;
00092 
00093 public:
00094     // Create a table vector from the given table column.
00095     // This constructor is for TableVector and allows elements to be changed.
00096     TabVecScaCol (const TableColumn& column);
00097 
00098     // Destruct the object.
00099     ~TabVecScaCol ();
00100 
00101     // Nr of elements (ie. #rows in table).
00102     uInt nelem() const;
00103 
00104     // Get a value.
00105     T value (uInt index) const;
00106 
00107     // Get a value.
00108     void getVal (uInt index, T&) const;
00109 
00110     // Put a value.
00111     void putVal (uInt index, const T&);
00112 
00113     // Set entire vector to a value.
00114     void set (const T&);
00115 
00116 protected:
00117     ScalarColumn<T>*  colPtr_p;
00118 };
00119 
00120 
00121 
00122 } //# NAMESPACE CASA - END
00123 
00124 #ifndef CASACORE_NO_AUTO_TEMPLATES
00125 #include <tables/Tables/TVecScaCol.tcc>
00126 #endif //# CASACORE_NO_AUTO_TEMPLATES
00127 #endif