|
STK++ 1.0
|
Templated one dimensional Array. More...
#include <STK_Array1D.h>

Public Member Functions | |
| Array1D (Range const &I=Range()) | |
| Default constructor : beg_ =1 and end_ =0. | |
| Array1D (Range const &I, TYPE const &v) | |
| Misc constructor with beg and end, initialization with a constant. | |
| Array1D (const Array1D &T, bool ref=false) | |
| Copy constructor. | |
| Array1D (Array1D const &T, Range const &I) | |
| constructor by reference, ref_=1. | |
| Array1D (TYPE *q, Range const &I, Integer const &index=0) | |
| Wrapper constructor : the container is a reference. | |
| Array1D (_IArrayBaseType const &T, Range const &I, Integer const &index) | |
| constructor by reference, ref_=1. | |
| virtual | ~Array1D () |
| Virtual destructor: allocated memory is liberated by IArrayBase base class. | |
| TYPE & | elt (Integer const &pos) |
| access to one element. | |
| TYPE const & | elt (Integer const &pos) const |
| access to one element const. | |
| Array1D | elt (Range const &J) const |
| access to many elements. | |
| Array1D< TYPE > & | operator= (const Array1D< TYPE > &T) |
| operator = : overwrite the Array1D with t. | |
| Array1D & | operator= (TYPE const &v) |
| operator= : set the container to a constant value. | |
| template<class LEAF > | |
| Array1D & | operator= (const ITContainer1D< TYPE, LEAF > &T) |
| operator = : overwrite the ArrayHo with the ITContainer1D T. | |
Private Types | |
| typedef IArrayBase< TYPE * > | _IArrayBaseType |
| Type for the Base reference Class. | |
| typedef RecursiveArray1D< TYPE, Array1D< TYPE > > | _IArray1DType |
| Type for the IArray1DBase Class. | |
Templated one dimensional Array.
An Array1D is a templated non-oriented container implementing the interface base class RecursiveArray1D. It contains objects of the type TYPE. It is a final class for the curious recursive paradigm.
Definition at line 54 of file STK_Array1D.h.
typedef IArrayBase<TYPE*> STK::Array1D< TYPE >::_IArrayBaseType [private] |
Type for the Base reference Class.
Reimplemented from STK::RecursiveArray1D< TYPE, Array1D< TYPE > >.
Definition at line 57 of file STK_Array1D.h.
typedef RecursiveArray1D<TYPE, Array1D<TYPE> > STK::Array1D< TYPE >::_IArray1DType [private] |
Type for the IArray1DBase Class.
Reimplemented from STK::RecursiveArray1D< TYPE, Array1D< TYPE > >.
Definition at line 59 of file STK_Array1D.h.
| STK::Array1D< TYPE >::Array1D | ( | Range const & | I = Range() | ) | [inline] |
Default constructor : beg_ =1 and end_ =0.
| I | range of the container |
Definition at line 65 of file STK_Array1D.h.
Referenced by STK::Array1D< Real >::elt(), and STK::Array1D< Variable< String > >::elt().
: _IArray1DType(I) { ;}
| STK::Array1D< TYPE >::Array1D | ( | Range const & | I, |
| TYPE const & | v | ||
| ) | [inline] |
Misc constructor with beg and end, initialization with a constant.
| I | range of the container |
| v | initial value of the container |
Definition at line 73 of file STK_Array1D.h.
: _IArray1DType(I, v) { }
| STK::Array1D< TYPE >::Array1D | ( | const Array1D< TYPE > & | T, |
| bool | ref = false |
||
| ) | [inline] |
Copy constructor.
| T | the container to copy |
| ref | true if T is wrapped |
Definition at line 81 of file STK_Array1D.h.
: _IArray1DType(T, ref) { }
| STK::Array1D< TYPE >::Array1D | ( | Array1D< TYPE > const & | T, |
| Range const & | I | ||
| ) | [inline] |
constructor by reference, ref_=1.
| T | the container to wrap |
| I | range of the data to wrap |
Definition at line 89 of file STK_Array1D.h.
: _IArray1DType(T, I) { ;}
| STK::Array1D< TYPE >::Array1D | ( | TYPE * | q, |
| Range const & | I, | ||
| Integer const & | index = 0 |
||
| ) | [inline] |
Wrapper constructor : the container is a reference.
| q | pointer on data |
| I | range of the data |
| index | index (row or column) of the data |
Definition at line 98 of file STK_Array1D.h.
: _IArray1DType(q, I, index) { ;}
| STK::Array1D< TYPE >::Array1D | ( | _IArrayBaseType const & | T, |
| Range const & | I, | ||
| Integer const & | index | ||
| ) | [inline] |
constructor by reference, ref_=1.
| T | the container to wrap |
| I | the range of the data to wrap |
| index | the index of the columnto wrap |
Definition at line 107 of file STK_Array1D.h.
: _IArray1DType(T, I, index) { ;}
| virtual STK::Array1D< TYPE >::~Array1D | ( | ) | [inline, virtual] |
Virtual destructor: allocated memory is liberated by IArrayBase base class.
Definition at line 112 of file STK_Array1D.h.
{ ;}
| TYPE& STK::Array1D< TYPE >::elt | ( | Integer const & | pos | ) | [inline] |
access to one element.
| pos | index of the element |
Reimplemented from STK::ITContainer1D< TYPE, Array1D< TYPE > >.
Definition at line 117 of file STK_Array1D.h.
Referenced by STK::Array1D< Real >::operator*=(), STK::Array1D< Real >::operator+=(), STK::Array1D< Real >::operator-=(), and STK::Array1D< Real >::operator/=().
{ return this->data(pos);}
| TYPE const& STK::Array1D< TYPE >::elt | ( | Integer const & | pos | ) | const [inline] |
access to one element const.
| pos | index of the const element |
Reimplemented from STK::ITContainer1D< TYPE, Array1D< TYPE > >.
Definition at line 123 of file STK_Array1D.h.
{ return this->data(pos);}
| Array1D STK::Array1D< TYPE >::elt | ( | Range const & | J | ) | const [inline] |
access to many elements.
| J | the range of the elements |
Reimplemented from STK::ITContainer1D< TYPE, Array1D< TYPE > >.
Definition at line 129 of file STK_Array1D.h.
| Array1D<TYPE>& STK::Array1D< TYPE >::operator= | ( | const Array1D< TYPE > & | T | ) | [inline] |
operator = : overwrite the Array1D with t.
We resize the object if this and T does not have the same size but if they have the same size, we don't modify the range of the object.
| T | the container to copy |
Definition at line 150 of file STK_Array1D.h.
{
// check size
if (this->size()!=T.size()) this->resize(T.range());
// copy without ovelapping.
const Integer first = this->first(), last = this->last();
if (first < T.first())
{ for (Integer i=first, j=T.first(); i<=last; i++, j++)
this->setData(i, T.data(j));
}
else
{ for (Integer i=last, j=T.last(); i>=first; i--, j--)
this->setData(i, T.data(j));
}
return *this;
}
| Array1D& STK::Array1D< TYPE >::operator= | ( | TYPE const & | v | ) | [inline] |
| Array1D& STK::Array1D< TYPE >::operator= | ( | const ITContainer1D< TYPE, LEAF > & | T | ) | [inline] |
operator = : overwrite the ArrayHo with the ITContainer1D T.
We resize this if this and T don't have the same size but if they have the same size, we don't modify the range of the object.
| T | the container to copy |
Definition at line 186 of file STK_Array1D.h.
{ // We have to resize if this and T does not have the same size
// but if they have the same size, we don't scale the index
if (this->size()!=T.size()) this->resize(T.range());
// copy without ovelapping
const Integer first = this->first(), last = this->last();
if (first < T.first())
{
for (Integer j=first, i=T.first(); j<=last; j++, i++)
this->setData(j, T[i]);
}
else
{
for (Integer j=last, i=T.last(); j>=first; j--, i--)
this->setData(j, T[i]);
}
return *this;
}