LAMA
|
LAMAArrayView is a proxy which gives a view to a sub range of a LAMAArray. More...
#include <LAMAArrayView.hpp>
Public Types | |
typedef T | ValueType |
ValueType is the type stored in this container. | |
Public Member Functions | |
LAMAArrayView (LAMAArray< T > &array) | |
Constructs a view into the whole passed LAMAArray. | |
LAMAArrayView (LAMAArray< T > &array, const IndexType offset, const IndexType size) | |
Constructs a view of the passed size into the passed LAMAArray starting at the passed offset. | |
LAMAArrayView (const LAMAArrayView< T > &other) | |
Takes a copy of the passed LAMAArrayView. | |
virtual | ~LAMAArrayView () |
destroys this LAMAArrayView, the referenced LAMAArray is not touched. | |
IndexType | size () const |
Returns the size of this LAMAArrayView. | |
virtual void | writeAt (std::ostream &stream) const |
Writes some Information about this to the passed stream. | |
bool | operator== (const LAMAArrayConstView< T > &other) const |
Checks if the LAMAArray referenced by other is the same than the LAMAArray reference by this. | |
bool | operator!= (const LAMAArrayConstView< T > &other) const |
Checks if the LAMAArray referenced by other is not the same than the LAMAArray reference by this. | |
bool | operator== (const LAMAArrayView< T > &other) const |
Checks if the LAMAArray referenced by other is the same than the LAMAArray reference by this. | |
bool | operator!= (const LAMAArrayView< T > &other) const |
Checks if the LAMAArray referenced by other is not the same than the LAMAArray reference by this. | |
Private Member Functions | |
LAMAArrayView () | |
LAMAArrayView & | operator= (const LAMAArrayView< T > &other) |
const ValueType * | get (const size_t index) const |
ValueType * | get (const size_t index) |
int | acquireReadAccess (ContextPtr context) const |
void | releaseReadAccess (const size_t index) const |
int | acquireWriteAccess (ContextPtr context, bool keepFlag) |
int | acquireWriteAccess () |
void | releaseWriteAccess (const size_t index) |
void | clear (const size_t index) |
void | resize (const size_t index, const IndexType newSize) |
void | reserve (const size_t index, const IndexType capacity, bool copyFlag) |
IndexType | capacity (const size_t index) const |
Private Attributes | |
LAMAArray< T > & | mArray |
const IndexType | mOffset |
IndexType | mSize |
Friends | |
class | ReadAccess< T > |
class | WriteAccess< T > |
class | LAMAArrayConstView< T > |
LAMAArrayView is a proxy which gives a view to a sub range of a LAMAArray.
typedef T lama::LAMAArrayView< T >::ValueType |
ValueType is the type stored in this container.
lama::LAMAArrayView< T >::LAMAArrayView | ( | LAMAArray< T > & | array | ) |
Constructs a view into the whole passed LAMAArray.
[in,out] | array | the array to get a view into. |
References lama::_LAMAArray::constFlag, and LAMA_THROWEXCEPTION.
lama::LAMAArrayView< T >::LAMAArrayView | ( | LAMAArray< T > & | array, |
const IndexType | offset, | ||
const IndexType | size | ||
) |
Constructs a view of the passed size into the passed LAMAArray starting at the passed offset.
[in,out] | array | the array to get a view into. |
[in] | offset | the index where the view into array should start. |
[in] | size | the lenght of the subrange of array. |
References lama::_LAMAArray::constFlag, LAMA_THROWEXCEPTION, lama::LAMAArrayView< T >::mArray, lama::LAMAArrayView< T >::mOffset, and lama::LAMAArrayView< T >::mSize.
lama::LAMAArrayView< T >::LAMAArrayView | ( | const LAMAArrayView< T > & | other | ) |
Takes a copy of the passed LAMAArrayView.
[in] | other | the LAMAArrayView to take a copy from. |
lama::LAMAArrayView< T >::~LAMAArrayView | ( | ) | [virtual] |
destroys this LAMAArrayView, the referenced LAMAArray is not touched.
lama::LAMAArrayView< T >::LAMAArrayView | ( | ) | [private] |
int lama::LAMAArrayView< T >::acquireReadAccess | ( | ContextPtr | context | ) | const [private] |
int lama::LAMAArrayView< T >::acquireWriteAccess | ( | ContextPtr | context, |
bool | keepFlag | ||
) | [private] |
Referenced by lama::WriteAccess< T >::WriteAccess().
int lama::LAMAArrayView< T >::acquireWriteAccess | ( | ) | [private] |
IndexType lama::LAMAArrayView< T >::capacity | ( | const size_t | index | ) | const [private] |
void lama::LAMAArrayView< T >::clear | ( | const size_t | index | ) | [private] |
References LAMA_THROWEXCEPTION.
Referenced by lama::WriteAccess< T >::WriteAccess().
const T * lama::LAMAArrayView< T >::get | ( | const size_t | index | ) | const [private] |
Referenced by lama::WriteAccess< T >::WriteAccess().
T * lama::LAMAArrayView< T >::get | ( | const size_t | index | ) | [private] |
bool lama::LAMAArrayView< T >::operator!= | ( | const LAMAArrayConstView< T > & | other | ) | const |
Checks if the LAMAArray referenced by other is not the same than the LAMAArray reference by this.
Checks if the LAMAArray referenced by other is not the same than the LAMAArray reference by this. CAVEAT: It is only checked if the LAMAArrays are not the same. Size and offset of the views are not checked for inequality.
[in] | other | the LAMAArrayConstView to compare this with. |
bool lama::LAMAArrayView< T >::operator!= | ( | const LAMAArrayView< T > & | other | ) | const |
Checks if the LAMAArray referenced by other is not the same than the LAMAArray reference by this.
Checks if the LAMAArray referenced by other is not the same than the LAMAArray reference by this. CAVEAT: It is only checked if the LAMAArrays are not the same. Size and offset of the views are not checked for inequality.
[in] | other | the LAMAArrayView to compare this with. |
LAMAArrayView& lama::LAMAArrayView< T >::operator= | ( | const LAMAArrayView< T > & | other | ) | [private] |
bool lama::LAMAArrayView< T >::operator== | ( | const LAMAArrayConstView< T > & | other | ) | const |
Checks if the LAMAArray referenced by other is the same than the LAMAArray reference by this.
Checks if the the LAMAArray referenced by other is the same than the LAMAArray reference by this. CAVEAT: It is only checked if the LAMAArrays are the same. Size and offset of the views are not checked for equality.
[in] | other | the LAMAArrayConstView to compare this with. |
bool lama::LAMAArrayView< T >::operator== | ( | const LAMAArrayView< T > & | other | ) | const |
Checks if the LAMAArray referenced by other is the same than the LAMAArray reference by this.
Checks if the LAMAArray referenced by other is the same than the LAMAArray reference by this. CAVEAT: It is only checked if the LAMAArrays are the same. Size and offset of the views are not checked for equality.
[in] | other | the LAMAArrayView to compare this with. |
References lama::LAMAArrayView< T >::mArray.
void lama::LAMAArrayView< T >::releaseReadAccess | ( | const size_t | index | ) | const [private] |
void lama::LAMAArrayView< T >::releaseWriteAccess | ( | const size_t | index | ) | [private] |
void lama::LAMAArrayView< T >::reserve | ( | const size_t | index, |
const IndexType | capacity, | ||
bool | copyFlag | ||
) | [private] |
References LAMA_THROWEXCEPTION.
void lama::LAMAArrayView< T >::resize | ( | const size_t | index, |
const IndexType | newSize | ||
) | [private] |
References LAMA_THROWEXCEPTION.
Referenced by lama::WriteAccess< T >::WriteAccess().
IndexType lama::LAMAArrayView< T >::size | ( | ) | const [inline] |
Returns the size of this LAMAArrayView.
Referenced by lama::JDSStorage< T >::jacobiIterate(), lama::DIAStorage< T >::jacobiIterate(), lama::COOStorage< T >::jacobiIterate(), lama::ELLStorage< T >::jacobiIterate(), lama::CSRStorage< T >::jacobiIterate(), lama::JDSStorage< T >::jacobiIterateHalo(), lama::ELLStorage< T >::jacobiIterateHalo(), lama::CSRStorage< T >::jacobiIterateHalo(), lama::CSRStorage< T >::matrixTimesVector(), lama::CSRStorage< T >::matrixTimesVectorAsync(), lama::CSRStorage< T >::matrixTimesVectorN(), and lama::DenseVector< T >::vectorPlusVector().
void lama::LAMAArrayView< T >::writeAt | ( | std::ostream & | stream | ) | const [virtual] |
Writes some Information about this to the passed stream.
If a deriving class does not overrides writeAt, typeid(this).name() is written to stream.
[out] | stream | the stream to write to. |
Reimplemented from Printable.
friend class LAMAArrayConstView< T > [friend] |
friend class ReadAccess< T > [friend] |
friend class WriteAccess< T > [friend] |
LAMAArray<T>& lama::LAMAArrayView< T >::mArray [private] |
const IndexType lama::LAMAArrayView< T >::mOffset [private] |
Referenced by lama::LAMAArrayView< T >::LAMAArrayView().
IndexType lama::LAMAArrayView< T >::mSize [private] |
Referenced by lama::LAMAArrayView< T >::LAMAArrayView().