casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TVecScaCol.h
Go to the documentation of this file.
1 //# TVecScaCol.h: Templated table scalar column vectors
2 //# Copyright (C) 1994,1995,1999
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: aips2-request@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 #ifndef TABLES_TVECSCACOL_H
29 #define TABLES_TVECSCACOL_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 //# Forward Declarations
38 class TableColumn;
39 template<class T> class ScalarColumn;
40 class String;
41 
42 
43 // <summary>
44 // Templated table scalar column vectors
45 // </summary>
46 
47 // <use visibility=local>
48 
49 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
50 // </reviewed>
51 
52 // <prerequisite>
53 //# Classes you should understand before using this one.
54 // <li> TabVecRep
55 // </prerequisite>
56 
57 // <etymology>
58 // TabVecScaCol is the class dealing with a table vector representing
59 // a column of scalars in a table.
60 // </etymology>
61 
62 // <synopsis>
63 // TabVecScaCol objects are a view on a column of scalars in a table.
64 // The semantics of these table vectors are the same as the normal
65 // vectors. So for example, changing an element in the table vector
66 // means changing the corresponding field in the underlying table.
67 // </synopsis>
68 
69 // <motivation>
70 // TabVecScaCol is derived from TabVecRep and as such it is a letter for
71 // the envelope class TableVector.
72 // </motivation>
73 
74 // <templating arg=T>
75 // <li> Default constructor
76 // <li> Copy constructor
77 // <li> Assignment operator
78 // </templating>
79 
80 // <todo asof="$DATE:$">
81 //# A List of bugs, limitations, extensions or planned refinements.
82 // </todo>
83 
84 
85 template<class T>
86 class TabVecScaCol : public TabVecRep<T>
87 {
88  //# Make members of parent class known.
89 protected:
90  using TabVecRep<T>::tag_p;
92 
93 public:
94  // Create a table vector from the given table column.
95  // This constructor is for TableVector and allows elements to be changed.
96  TabVecScaCol (const TableColumn& column);
97 
98  // Destruct the object.
99  ~TabVecScaCol ();
100 
101  // Nr of elements (ie. #rows in table).
102  rownr_t nelem() const;
103 
104  // Get a value.
105  T value (rownr_t index) const;
106 
107  // Get a value.
108  void getVal (rownr_t index, T&) const;
109 
110  // Put a value.
111  void putVal (rownr_t index, const T&);
112 
113  // Set entire vector to a value.
114  void set (const T&);
115 
116 protected:
118 };
119 
120 
121 
122 } //# NAMESPACE CASACORE - END
123 
124 #ifndef CASACORE_NO_AUTO_TEMPLATES
125 #include <casacore/tables/Tables/TVecScaCol.tcc>
126 #endif //# CASACORE_NO_AUTO_TEMPLATES
127 #endif
ScalarColumn< T > * colPtr_p
Definition: TVecScaCol.h:117
Templated base class for table vectors.
Definition: TVec.h:107
void putVal(rownr_t index, const T &)
Put a value.
TabVecScaCol(const TableColumn &column)
Create a table vector from the given table column.
~TabVecScaCol()
Destruct the object.
Read/write access to a table column.
Definition: TableColumn.h:98
Templated table scalar column vectors.
Definition: TVecScaCol.h:86
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46
T value(rownr_t index) const
Get a value.
rownr_t nelem() const
Nr of elements (ie.
Access to a scalar table column with arbitrary data type.
Definition: CopyRecord.h:47
void getVal(rownr_t index, T &) const
Get a value.
void set(const T &)
Set entire vector to a value.