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