jarray_of_type< T > Class Template Reference

Typed variat of jarray, performs automatic type conversion on instantiation. More...

#include <jarray.h>

Inheritance diagram for jarray_of_type< T >:
Inheritance graph
[legend]
Collaboration diagram for jarray_of_type< T >:
Collaboration graph
[legend]

Public Member Functions

 jarray_of_type (const jarray &ja)
 Initialize with type conversion.
T & operator[] (const I i)
 Directly access element of ravel.
const T & operator[] (const I i) const
 Direct read-only access to an element of ravel.
 jarray_of_type ()
 Conveniently allocate scalar.
 jarray_of_type (const I l0)
 Conveniently allocate 1-D array.
T & operator() (const I i0)
 conveniently access 1-D array.
const T & operator() (const I i0) const
 Convenient read-only access to 1-D array.
 jarray_of_type (const I l0, const I l1)
 Conveniently allocate 2-D array.
T & operator() (const I i0, const I i1)
 Conveniently access 2-D array.
const T & operator() (const I i0, const I i1) const
 Convenient read-only access to 2-D array.
 jarray_of_type (const I l0, const I l1, const I l2)
 Conveniently allocate 3-D array.
T & operator() (const I i0, const I i1, const I i2)
 Conveniently access 3-D array.
const T & operator() (const I i0, const I i1, const I i2) const
 Convenient read-only access to 3-D array.
 jarray_of_type (const I l0, const I l1, const I l2, const I l3)
 Conveniently allocate 4-D array.
T & operator() (const I i0, const I i1, const I i2, const I i3)
 Conveniently access 4-D array.
const T & operator() (const I i0, const I i1, const I i2, const I i3) const
 Convenient read-only access to 4-D array.
 jarray_of_type (const I l0, const I l1, const I l2, const I l3, const I l4)
 Conveniently allocate 5-D array.
T & operator() (const I i0, const I i1, const I i2, const I i3, const I i4)
 Conveniently access 5-D array.
const T & operator() (const I i0, const I i1, const I i2, const I i3, const I i4) const
 Convenient read-only access to 5-D array.
 jarray_of_type (const I rank, const I *shape)
 Conveniently allocate n-D array.
 jarray_of_type (const std::vector< I > &shape)
 Conveniently allocate n-D array.
T & operator() (const std::vector< I > &subscripts)
 Conveniently access n-D array.
const T & operator() (const std::vector< I > &subscripts) const
 Convenient read-only access to n-D array.
T & operator() (const I *subscripts)
 Conveniently access n-D array.
const T & operator() (const I *subscripts) const
 Convenient read-only access to n-D array.

Detailed Description

template<class T>
class jarray_of_type< T >

Typed variat of jarray, performs automatic type conversion on instantiation.


Constructor & Destructor Documentation

template<class T >
jarray_of_type< T >::jarray_of_type ( const jarray ja  )  [inline]

Initialize with type conversion.

In case no conversion is needed the original array is accessed directly, otherwise a copy is made. To access the array members (subscripting) round backets are used like in Blitz++ and not the square ones, like in Boost. Convenience methods are provided for ranks up to 5, for bigger ranks one has to construct and use for indexing an integer vector.

Parameters:
ja jarray, holding the data.

References jarray::allocate(), jarray::assign(), jarray::get(), jarray::rank(), jarray::shape(), jarray::size(), and jarray::type().

template<class T >
jarray_of_type< T >::jarray_of_type (  )  [inline]

Conveniently allocate scalar.

References jarray::allocate(), and jarray::shape().

template<class T >
jarray_of_type< T >::jarray_of_type ( const I  l0  )  [inline]

Conveniently allocate 1-D array.

Parameters:
l0 new array dimension

References jarray::allocate(), and jarray::shape().

template<class T >
jarray_of_type< T >::jarray_of_type ( const I  l0,
const I  l1 
) [inline]

Conveniently allocate 2-D array.

Parameters:
l0 new array 1-st dimension
l1 new array 2-nd dimension

References jarray::allocate(), and jarray::shape().

template<class T >
jarray_of_type< T >::jarray_of_type ( const I  l0,
const I  l1,
const I  l2 
) [inline]

Conveniently allocate 3-D array.

Parameters:
l0 new array 1-st dimension
l1 new array 2-nd dimension
l2 new array 3-rd dimension

References jarray::allocate(), and jarray::shape().

template<class T >
jarray_of_type< T >::jarray_of_type ( const I  l0,
const I  l1,
const I  l2,
const I  l3 
) [inline]

Conveniently allocate 4-D array.

Parameters:
l0 new array 1-st dimension
l1 new array 2-nd dimension
l2 new array 3-rd dimension
l3 new array 4-th dimension

References jarray::allocate(), and jarray::shape().

template<class T >
jarray_of_type< T >::jarray_of_type ( const I  l0,
const I  l1,
const I  l2,
const I  l3,
const I  l4 
) [inline]

Conveniently allocate 5-D array.

Parameters:
l0 new array 1-st dimension
l1 new array 2-nd dimension
l2 new array 3-rd dimension
l3 new array 4-th dimension
l4 new array 5-th dimension

References jarray::allocate(), and jarray::shape().

template<class T >
jarray_of_type< T >::jarray_of_type ( const I  rank,
const I shape 
) [inline]

Conveniently allocate n-D array.

Parameters:
rank rank of new array.
shape shape of new array.

References jarray::allocate().

template<class T >
jarray_of_type< T >::jarray_of_type ( const std::vector< I > &  shape  )  [inline]

Conveniently allocate n-D array.

Parameters:
shape shape of new array.

References jarray::allocate().


Member Function Documentation

template<class T >
const T& jarray_of_type< T >::operator() ( const I subscripts  )  const [inline]

Convenient read-only access to n-D array.

Be careful, allocating enough subscripts.

Parameters:
subscripts subscripts of the element to access.
Returns:
const reference to the element.

References jarray::data(), jarray::extent(), and jarray::rank().

template<class T >
T& jarray_of_type< T >::operator() ( const I subscripts  )  [inline]

Conveniently access n-D array.

Be careful, allocating enough subscripts.

Parameters:
subscripts subscripts of the element to access.
Returns:
reference to the element.

References jarray::data(), jarray::extent(), and jarray::rank().

template<class T >
const T& jarray_of_type< T >::operator() ( const std::vector< I > &  subscripts  )  const [inline]

Convenient read-only access to n-D array.

Parameters:
subscripts subscripts of the element to access.
Returns:
const reference to the element.

References jarray::data(), jarray::extent(), and jarray::rank().

template<class T >
T& jarray_of_type< T >::operator() ( const std::vector< I > &  subscripts  )  [inline]

Conveniently access n-D array.

Parameters:
subscripts subscripts of the element to access.
Returns:
reference to the element.

References jarray::data(), jarray::extent(), and jarray::rank().

template<class T >
const T& jarray_of_type< T >::operator() ( const I  i0,
const I  i1,
const I  i2,
const I  i3,
const I  i4 
) const [inline]

Convenient read-only access to 5-D array.

Parameters:
i0 zero-based 1-st index of the element to access.
i1 zero-based 2-nd index of the element to access.
i2 zero-based 3-rd index of the element to access.
i3 zero-based 4-th index of the element to access.
i4 zero-based 5-th index of the element to access.
Returns:
const reference to the element.

References jarray::data(), jarray::extent(), and jarray::rank().

template<class T >
T& jarray_of_type< T >::operator() ( const I  i0,
const I  i1,
const I  i2,
const I  i3,
const I  i4 
) [inline]

Conveniently access 5-D array.

Parameters:
i0 zero-based 1-st index of the element to access.
i1 zero-based 2-nd index of the element to access.
i2 zero-based 3-rd index of the element to access.
i3 zero-based 4-th index of the element to access.
i4 zero-based 5-th index of the element to access.
Returns:
reference to the element.

References jarray::data(), jarray::extent(), and jarray::rank().

template<class T >
const T& jarray_of_type< T >::operator() ( const I  i0,
const I  i1,
const I  i2,
const I  i3 
) const [inline]

Convenient read-only access to 4-D array.

Parameters:
i0 zero-based 1-st index of the element to access.
i1 zero-based 2-nd index of the element to access.
i2 zero-based 3-rd index of the element to access.
i3 zero-based 4-th index of the element to access.
Returns:
const reference to the element.

References jarray::data(), jarray::extent(), and jarray::rank().

template<class T >
T& jarray_of_type< T >::operator() ( const I  i0,
const I  i1,
const I  i2,
const I  i3 
) [inline]

Conveniently access 4-D array.

Parameters:
i0 zero-based 1-st index of the element to access.
i1 zero-based 2-nd index of the element to access.
i2 zero-based 3-rd index of the element to access.
i3 zero-based 4-th index of the element to access.
Returns:
reference to the element.

References jarray::data(), jarray::extent(), and jarray::rank().

template<class T >
const T& jarray_of_type< T >::operator() ( const I  i0,
const I  i1,
const I  i2 
) const [inline]

Convenient read-only access to 3-D array.

Parameters:
i0 zero-based 1-st index of the element to access.
i1 zero-based 2-nd index of the element to access.
i2 zero-based 3-rd index of the element to access.
Returns:
const reference to the element.

References jarray::data(), jarray::extent(), and jarray::rank().

template<class T >
T& jarray_of_type< T >::operator() ( const I  i0,
const I  i1,
const I  i2 
) [inline]

Conveniently access 3-D array.

Parameters:
i0 zero-based 1-st index of the element to access.
i1 zero-based 2-nd index of the element to access.
i2 zero-based 3-rd index of the element to access.
Returns:
reference to the element.

References jarray::data(), jarray::extent(), and jarray::rank().

template<class T >
const T& jarray_of_type< T >::operator() ( const I  i0,
const I  i1 
) const [inline]

Convenient read-only access to 2-D array.

Parameters:
i0 zero-based 1-st index of the element to access.
i1 zero-based 2-nd index of the element to access.
Returns:
const reference to the element.

References jarray::data(), jarray::extent(), and jarray::rank().

template<class T >
T& jarray_of_type< T >::operator() ( const I  i0,
const I  i1 
) [inline]

Conveniently access 2-D array.

Parameters:
i0 zero-based 1-st index of the element to access.
i1 zero-based 2-nd index of the element to access.
Returns:
reference to the element.

References jarray::data(), jarray::extent(), and jarray::rank().

template<class T >
const T& jarray_of_type< T >::operator() ( const I  i0  )  const [inline]

Convenient read-only access to 1-D array.

Parameters:
i0 zero-based index of the element to access.
Returns:
const reference to the element.

References jarray::data(), and jarray::rank().

template<class T >
T& jarray_of_type< T >::operator() ( const I  i0  )  [inline]

conveniently access 1-D array.

Parameters:
i0 zero-based index of the element to access.
Returns:
reference to the element.

References jarray::data(), and jarray::rank().

template<class T >
const T& jarray_of_type< T >::operator[] ( const I  i  )  const [inline]

Direct read-only access to an element of ravel.

Parameters:
i index.
Returns:
constant reference to the element.

References jarray::data().

template<class T >
T& jarray_of_type< T >::operator[] ( const I  i  )  [inline]

Directly access element of ravel.

Parameters:
i index.
Returns:
reference to the element.

References jarray::data().


The documentation for this class was generated from the following file:
Generated on Mon Jun 25 21:17:56 2012 for jplus-0.4.1 by  doxygen 1.6.3