casacore
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>
33 #include <casacore/casa/Quanta/Quantum.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 template <class T> class QVector;
38 
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
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 
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
casacore::QVector::operator[]
Quantum< T > operator[](uInt index) const
access single element
casacore::QVector::scale
void scale(T d)
casacore::QVector::operator+
QVector< T > operator+(const QVector< T > &d) const
add operators as needed
casacore::QVector::QVector
QVector(const Vector< T > &v, const Unit &u)
casacore::QVector::~QVector
~QVector()
casacore::QVector::QVector
QVector(const Vector< Quantum< T > > &q)
convert a Vector of Quanta to a QVector.
casacore::QVector::operator-
QVector< T > operator-(const QVector< T > &d) const
casacore::QVector::size
size_t size() const
casacore::QVector::max
Quantum< T > max() const
casacore::uInt
unsigned int uInt
Definition: aipstype.h:51
casacore::QVector::operator/
QVector< T > operator/(T d) const
casacore::QVector::nelements
size_t nelements() const
casacore
this file contains all the compiler specific defines
Definition: mainpage.dox:28
casacore::QVector::QVector
QVector(const QVector &other)
Copy constructor (deep copy)
casacore::QVD
QVector< Double > QVD
Definition: QVector.h:37
casacore::QVector::min
Quantum< T > min() const
casacore::QVector< Double >
casacore::Unit
Definition: Unit.h:189
casacore::Vector
Definition: Vector.h:89
casacore::QVector::QVector
QVector()
zero elements
casacore::Quantum
Definition: Quantum.h:271