casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QVector.h
Go to the documentation of this file.
1 //# Quantum.h: class to manipulate physical, dimensioned quantities
2 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001
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: Quantum.h 20993 2010-11-08 13:36:32Z gervandiepen $
27 
28 #ifndef CASA_QVECTOR_H
29 #define CASA_QVECTOR_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 template <class T> class QVector;
38 
39 typedef QVector<Double> QVD;
40 
41 // <summary>
42 // Specialization for Quantum<Vector<T> >
43 // </summary>
44 
45 // <use visibility=export>
46 //
47 // <prerequisite>
48 // <li> <linkto class=Quantum>Quantum</linkto>
49 // </prerequisite>
50 //
51 // <etymology>
52 // Vector of quantities.
53 // </etymology>
54 //
55 // <synopsis>
56 // Objects of type Quantum<Vector<Double> > are used often in our code.
57 // We need a way to access individual elements easily
58 // </synopsis>
59 
60 template <class T> class QVector : public Quantum<Vector<T> > {
61 
62  public:
63 
64  // zero elements
65  QVector();
66 
67  QVector(const Vector<T>& v, const Unit& u);
68 
69  // convert a Vector of Quanta to a QVector. Useful
70  // when reading a table column of Quanta. All elements in
71  // q will be converted to units of the first element in q.
72  // An exception will be thrown if not all elements in q conform
73  // to the same unit.
74  QVector(const Vector<Quantum<T> >& q);
75 
76  // Copy constructor (deep copy)
77  QVector(const QVector& other);
78 
79  ~QVector();
80  // access single element
81  Quantum<T> operator[](uInt index) const;
82 
83  size_t size() const;
84 
85  size_t nelements() const;
86 
87  void scale(T d);
88 
89  // add operators as needed
90  QVector<T> operator+(const QVector<T>& d) const;
91  QVector<T> operator-(const QVector<T>& d) const;
92  QVector<T> operator/(T d) const;
93 
94 
95  Quantum<T> min() const;
96 
97  Quantum<T> max() const;
98 
99 };
100 
101 }
102 
103 #ifndef CASACORE_NO_AUTO_TEMPLATES
104 #include <casacore/casa/Quanta/QVector.tcc>
105 #endif
106 
107 #endif
A 1-D Specialization of the Array class.
Quantum< T > operator[](uInt index) const
access single element
const Quantum< Vector< T > > & operator+() const
Unary operations.
Specialization for Quantum&lt;Vector&lt;T&gt; &gt;
Definition: QVector.h:37
Quantum< T > max() const
defines physical units
Definition: Unit.h:189
size_t size() const
QVector< T > operator/(T d) const
QVector< Double > QVD
Definition: QVector.h:37
Quantities (i.e. dimensioned values)
Definition: QuantumHolder.h:44
Quantum< Vector< T > > operator-() const
Quantum< T > min() const
size_t nelements() const
QVector()
zero elements
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