casacore
Loading...
Searching...
No Matches
TVecTemp.h
Go to the documentation of this file.
1// # TVecTemp.h: Templated table vectors held in memory as a temporary
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: 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#ifndef TABLES_TVECTEMP_H
27#define TABLES_TVECTEMP_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/ArrayFwd.h>
32#include <casacore/tables/Tables/TVec.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36// <summary>
37// Templated table vectors held in memory as a temporary
38// </summary>
39
40// <use visibility=local>
41
42// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
43// </reviewed>
44
45// <prerequisite>
46// # Classes you should understand before using this one.
47// <li> TabVecRep
48// </prerequisite>
49
50// <etymology>
51// TabVecTemp is the class dealing with a table vector when used as
52// a temporary in math operations.
53// </etymology>
54
55// <synopsis>
56// TabVecTemp objects enable the use of Vector objects as table vectors.
57// They are used for 2 purposes:
58// <ol>
59// <li> To convert a Vector to a TableVector. This is used to
60// allow the use of Vectors in TableVector expressions.
61// The TabVecTemp object uses the Vector copy constructor,
62// which is very cheap due to its reference semantics.
63// <li> To hold the result of an operation (like addition) on
64// two TableVector objects.
65// </ol>
66// </synopsis>
67
68// <motivation>
69// TabVecTemp is derived from TabVecRep and as such a letter for
70// the envelope class TableVector.
71// </motivation>
72
73// <templating arg=T>
74// <li> Default constructor
75// <li> Copy constructor
76// <li> Assignment operator
77// </templating>
78
79// <todo asof="$DATE:$">
80// # A List of bugs, limitations, extensions or planned refinements.
81// <li> In the future temporary results may need to use a file,
82// because table vectors can potentially be very, very long.
83// </todo>
84
85template <class T>
86class TabVecTemp : public TabVecRep<T> {
87 // # Make members of parent class known.
88 protected:
89 using TabVecRep<T>::tag_p;
90 using TabVecRep<T>::nrel_p;
91
92 public:
93 // Create table vector containing the given Vector (reference semantics).
94 // It will set the origin to zero.
96
97 // Create table vector containing a Vector with given length.
99
100 // Destruct the object.
102
103 // Return a reference to a value.
104 inline const T& operator()(rownr_t index) const;
105
106 // Return a reference to a value.
107 inline T& operator()(rownr_t index);
108
109 // Get a value (virtual function).
110 T value(rownr_t index) const;
111 // Get a value (virtual function).
112 void getVal(rownr_t index, T&) const;
113
114 // Put a value (virtual function).
115 void putVal(rownr_t index, const T&);
116
117 // Set entire vector to a value.
118 void set(const T&);
119
120 protected:
122};
123
124// # Return a reference to a value.
125template <class T>
126inline const T& TabVecTemp<T>::operator()(rownr_t index) const {
127 return (*vecPtr_p)(index);
128}
129template <class T>
131 return (*vecPtr_p)(index);
132}
133
134} // namespace casacore
135
136#ifndef CASACORE_NO_AUTO_TEMPLATES
137#include <casacore/tables/Tables/TVecTemp.tcc>
138#endif // # CASACORE_NO_AUTO_TEMPLATES
139#endif
TabVecTag tag_p
Definition TVec.h:152
TabVecRep()
Create empty table vector.
~TabVecTemp()
Destruct the object.
void getVal(rownr_t index, T &) const
Get a value (virtual function).
void putVal(rownr_t index, const T &)
Put a value (virtual function).
void set(const T &)
Set entire vector to a value.
T value(rownr_t index) const
Get a value (virtual function).
TabVecTemp(const Vector< T > &)
Create table vector containing the given Vector (reference semantics).
TabVecTemp(rownr_t leng)
Create table vector containing a Vector with given length.
const T & operator()(rownr_t index) const
Return a reference to a value.
Definition TVecTemp.h:126
Vector< T > * vecPtr_p
Definition TVecTemp.h:121
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44