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
85
86template<class T> class TabVecTemp : public TabVecRep<T>
87{
88 //# Make members of parent class known.
89protected:
90 using TabVecRep<T>::tag_p;
91 using TabVecRep<T>::nrel_p;
92
93public:
94 // Create table vector containing the given Vector (reference semantics).
95 // It will set the origin to zero.
97
98 // Create table vector containing a Vector with given length.
100
101 // Destruct the object.
103
104 // Return a reference to a value.
105 inline const T& operator() (rownr_t index) const;
106
107 // Return a reference to a value.
108 inline T& operator() (rownr_t index);
109
110 // Get a value (virtual function).
111 T value (rownr_t index) const;
112 // Get a value (virtual function).
113 void getVal (rownr_t index, T&) const;
114
115 // Put a value (virtual function).
116 void putVal (rownr_t index, const T&);
117
118 // Set entire vector to a value.
119 void set (const T&);
120
121protected:
123};
124
125
126
127//# Return a reference to a value.
128template<class T>
129inline const T& TabVecTemp<T>::operator() (rownr_t index) const
130 { return (*vecPtr_p)(index); }
131template<class T>
133 { return (*vecPtr_p)(index); }
134
135
136
137} //# NAMESPACE CASACORE - END
138
139#ifndef CASACORE_NO_AUTO_TEMPLATES
140#include <casacore/tables/Tables/TVecTemp.tcc>
141#endif //# CASACORE_NO_AUTO_TEMPLATES
142#endif
Templated base class for table vectors.
Definition TVec.h:106
TabVecTag tag_p
Definition TVec.h:158
~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:129
Vector< T > * vecPtr_p
Definition TVecTemp.h:122
this file contains all the compiler specific defines
Definition mainpage.dox:28
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44