LAMA
lama::LAMAArrayView< T > Class Template Reference

LAMAArrayView is a proxy which gives a view to a sub range of a LAMAArray. More...

#include <LAMAArrayView.hpp>

Inheritance diagram for lama::LAMAArrayView< T >:

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 ()
LAMAArrayViewoperator= (const LAMAArrayView< T > &other)
const ValueTypeget (const size_t index) const
ValueTypeget (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 >

Detailed Description

template<typename T>
class lama::LAMAArrayView< T >

LAMAArrayView is a proxy which gives a view to a sub range of a LAMAArray.


Member Typedef Documentation

template<typename T>
typedef T lama::LAMAArrayView< T >::ValueType

ValueType is the type stored in this container.


Constructor & Destructor Documentation

template<typename T>
lama::LAMAArrayView< T >::LAMAArrayView ( LAMAArray< T > &  array)

Constructs a view into the whole passed LAMAArray.

Parameters:
[in,out]arraythe array to get a view into.

References lama::_LAMAArray::constFlag, and LAMA_THROWEXCEPTION.

template<typename T>
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.

Parameters:
[in,out]arraythe array to get a view into.
[in]offsetthe index where the view into array should start.
[in]sizethe 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.

template<typename T>
lama::LAMAArrayView< T >::LAMAArrayView ( const LAMAArrayView< T > &  other)

Takes a copy of the passed LAMAArrayView.

Parameters:
[in]otherthe LAMAArrayView to take a copy from.
template<typename T >
lama::LAMAArrayView< T >::~LAMAArrayView ( ) [virtual]

destroys this LAMAArrayView, the referenced LAMAArray is not touched.

template<typename T>
lama::LAMAArrayView< T >::LAMAArrayView ( ) [private]

Member Function Documentation

template<typename T >
int lama::LAMAArrayView< T >::acquireReadAccess ( ContextPtr  context) const [private]
template<typename T >
int lama::LAMAArrayView< T >::acquireWriteAccess ( ContextPtr  context,
bool  keepFlag 
) [private]
template<typename T >
int lama::LAMAArrayView< T >::acquireWriteAccess ( ) [private]
template<typename T >
IndexType lama::LAMAArrayView< T >::capacity ( const size_t  index) const [private]
template<typename T >
void lama::LAMAArrayView< T >::clear ( const size_t  index) [private]
template<typename T >
const T * lama::LAMAArrayView< T >::get ( const size_t  index) const [private]
template<typename T >
T * lama::LAMAArrayView< T >::get ( const size_t  index) [private]
template<typename T>
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.

Parameters:
[in]otherthe LAMAArrayConstView to compare this with.
Returns:
if this and other are referencing different LAMAArrays.
template<typename T>
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.

Parameters:
[in]otherthe LAMAArrayView to compare this with.
Returns:
if this and other are referencing different LAMAArrays.
template<typename T>
LAMAArrayView& lama::LAMAArrayView< T >::operator= ( const LAMAArrayView< T > &  other) [private]
template<typename T>
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.

Parameters:
[in]otherthe LAMAArrayConstView to compare this with.
Returns:
if this and other are referencing the same LAMAArray.
template<typename T>
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.

Parameters:
[in]otherthe LAMAArrayView to compare this with.
Returns:
if this and other are referencing the same LAMAArray.

References lama::LAMAArrayView< T >::mArray.

template<typename T >
void lama::LAMAArrayView< T >::releaseReadAccess ( const size_t  index) const [private]
template<typename T >
void lama::LAMAArrayView< T >::releaseWriteAccess ( const size_t  index) [private]
template<typename T >
void lama::LAMAArrayView< T >::reserve ( const size_t  index,
const IndexType  capacity,
bool  copyFlag 
) [private]

References LAMA_THROWEXCEPTION.

template<typename T >
void lama::LAMAArrayView< T >::resize ( const size_t  index,
const IndexType  newSize 
) [private]
template<typename T >
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.

Parameters:
[out]streamthe stream to write to.

Reimplemented from Printable.


Friends And Related Function Documentation

template<typename T>
friend class LAMAArrayConstView< T > [friend]
template<typename T>
friend class ReadAccess< T > [friend]
template<typename T>
friend class WriteAccess< T > [friend]

Field Documentation

template<typename T>
const IndexType lama::LAMAArrayView< T >::mOffset [private]
template<typename T>
IndexType lama::LAMAArrayView< T >::mSize [private]

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