ConstVectorView Class Reference

A constant view of a Vector. More...

#include <matpackI.h>

Inheritance diagram for ConstVectorView:

VectorView Vector MakeVector

List of all members.

Public Member Functions

Index nelem () const
 Returns the number of elements.
Numeric sum () const
 The sum of all elements of a Vector.
Numeric operator[] (Index n) const
 Plain const index operator.
ConstVectorView operator[] (const Range &r) const
 Const index operator for subrange.
ConstIterator1D begin () const
 Return const iterator to first element.
ConstIterator1D end () const
 Return const iterator behind last element.
 operator ConstMatrixView () const
 Conversion to const 1 column matrix.

Protected Member Functions

 ConstVectorView ()
 Default constructor.
 ConstVectorView (Numeric *data, const Range &range)
 Explicit constructor.
 ConstVectorView (Numeric *data, const Range &p, const Range &n)
 Recursive constructor.

Protected Attributes

Range mrange
 The range of mdata that is actually used.
Numericmdata
 Pointer to the plain C array that holds the data.

Friends

class VectorView
class ConstIterator2D
class ConstMatrixView
class ConstTensor3View


Detailed Description

A constant view of a Vector.

Together with the derived class VectorView this contains the main implementation of a Vector. The class Vector is just a special case of a VectorView which also allocates storage.

Definition at line 232 of file matpackI.h.


Constructor & Destructor Documentation

ConstVectorView::ConstVectorView (  )  [inline, protected]

Default constructor.

This is necessary, so that we can have a default constructor for the derived class Vector.

Definition at line 997 of file matpackI.h.

ConstVectorView::ConstVectorView ( Numeric data,
const Range range 
) [inline, protected]

Explicit constructor.

This one is used by Vector to initialize its own VectorView part.

Definition at line 1005 of file matpackI.h.

ConstVectorView::ConstVectorView ( Numeric data,
const Range p,
const Range n 
) [inline, protected]

Recursive constructor.

This is used to construct sub ranges from sub ranges. That means that the new range has to be interpreted relative to the original range. The new range may contain -1 for the extent which acts as a joker. However, the used Range constructor converts this to an explicit range, consistent with the original Range.

Parameters:
*data The actual data.
p Previous range.
n New Range.

Definition at line 1023 of file matpackI.h.


Member Function Documentation

Index ConstVectorView::nelem (  )  const [inline]

Returns the number of elements.

The names `size' and `length' are already used by STL functions returning size_t. To avoid confusion we choose the name `nelem'. This is also more consistent with `nrow' and `ncol' for matrices.

The value range of long, which is used to store the index is on a PC from -2147483648 to 2147483647. This means that a 15GB large array of float can be addressed with this index. So the extra bit that size_t has compared to long is not needed.

Definition at line 937 of file matpackI.h.

Numeric ConstVectorView::sum (  )  const [inline]

The sum of all elements of a Vector.

Definition at line 943 of file matpackI.h.

Numeric ConstVectorView::operator[] ( Index  n  )  const [inline]

Plain const index operator.

Reimplemented in VectorView.

Definition at line 956 of file matpackI.h.

ConstVectorView ConstVectorView::operator[] ( const Range r  )  const [inline]

Const index operator for subrange.

We have to also account for the case, that *this is already a subrange of a Vector. This allows correct recursive behavior.

Reimplemented in VectorView.

Definition at line 969 of file matpackI.h.

ConstIterator1D ConstVectorView::begin (  )  const [inline]

Return const iterator to first element.

Reimplemented in VectorView.

Definition at line 975 of file matpackI.h.

ConstIterator1D ConstVectorView::end (  )  const [inline]

Return const iterator behind last element.

Reimplemented in VectorView.

Definition at line 981 of file matpackI.h.

ConstVectorView::operator ConstMatrixView (  )  const [inline]

Conversion to const 1 column matrix.

Definition at line 990 of file matpackI.h.


Friends And Related Function Documentation

friend class VectorView [friend]

Definition at line 251 of file matpackI.h.

friend class ConstIterator2D [friend]

Reimplemented in VectorView.

Definition at line 252 of file matpackI.h.

friend class ConstMatrixView [friend]

Definition at line 253 of file matpackI.h.

friend class ConstTensor3View [friend]

Definition at line 254 of file matpackI.h.


Member Data Documentation

The range of mdata that is actually used.

Definition at line 265 of file matpackI.h.

Pointer to the plain C array that holds the data.

Definition at line 267 of file matpackI.h.


The documentation for this class was generated from the following file:

Generated on Wed Feb 4 08:17:29 2009 for ARTS by  doxygen 1.5.6