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