ARTS  1.0.222
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ConstVectorView Class Reference

A constant view of a Vector. More...

#include <matpackI.h>

Inheritance diagram for ConstVectorView:
VectorView Vector MakeVector

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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

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() [1/3]

ConstVectorView::ConstVectorView ( )
inlineprotected

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() [2/3]

ConstVectorView::ConstVectorView ( Numeric data,
const Range range 
)
inlineprotected

Explicit constructor.

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

Definition at line 1005 of file matpackI.h.

◆ ConstVectorView() [3/3]

ConstVectorView::ConstVectorView ( Numeric data,
const Range p,
const Range n 
)
inlineprotected

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
*dataThe actual data.
pPrevious range.
nNew Range.

Definition at line 1023 of file matpackI.h.

Member Function Documentation

◆ begin()

ConstIterator1D ConstVectorView::begin ( ) const
inline

Return const iterator to first element.

Definition at line 975 of file matpackI.h.

◆ end()

ConstIterator1D ConstVectorView::end ( ) const
inline

Return const iterator behind last element.

Definition at line 981 of file matpackI.h.

◆ nelem()

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.

◆ operator ConstMatrixView()

ConstVectorView::operator ConstMatrixView ( ) const
inline

Conversion to const 1 column matrix.

Definition at line 990 of file matpackI.h.

◆ operator[]() [1/2]

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.

Definition at line 969 of file matpackI.h.

◆ operator[]() [2/2]

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

Plain const index operator.

Definition at line 956 of file matpackI.h.

◆ sum()

Numeric ConstVectorView::sum ( ) const
inline

The sum of all elements of a Vector.

Definition at line 943 of file matpackI.h.

Friends And Related Function Documentation

◆ ConstIterator2D

friend class ConstIterator2D
friend

Definition at line 252 of file matpackI.h.

◆ ConstMatrixView

friend class ConstMatrixView
friend

Definition at line 253 of file matpackI.h.

◆ ConstTensor3View

friend class ConstTensor3View
friend

Definition at line 254 of file matpackI.h.

◆ VectorView

friend class VectorView
friend

Definition at line 251 of file matpackI.h.

Member Data Documentation

◆ mdata

Numeric* ConstVectorView::mdata
protected

Pointer to the plain C array that holds the data.

Definition at line 267 of file matpackI.h.

◆ mrange

Range ConstVectorView::mrange
protected

The range of mdata that is actually used.

Definition at line 265 of file matpackI.h.


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