lite::array< signature_, traits_type_, rep_ > Class Template Reference
[Array Class]

This class represents a general sinlge/multidimensional array with constant/variable size dimensions. More...

#include <array.hpp>

List of all members.

Public Types

typedef signature_ signature
 The signature of the array.
typedef traits_type_ traits_type
 The type traits.

Public Member Functions

 array ()
 Default constructs the array.
 array (const array &other)
 Initializes the array to a copy of the other array.
template<typename other_rep_ >
 array (const array< signature_, traits_type_, other_rep_ > &other)
 Initializes the array to a copy of the other array. The other array could have a different representation type.
 array (int n0,..., int nN)
 Constructs an array with the given dimension sizes.
 array (const size_type &size)
 Constructs an array with the given dimension sizes.
 array (const value_type &a0,..., const value_type &aT)
 Constructs an array using the supplied values.
template<typename arg_type0_ , ... , typename arg_typeK_ >
 array (const arg_type0_ &arg0,..., const arg_typeK_ &argK, const size_type &sz)
 Constructs a reference array by passing the arg0 to argK to the constructor of the iterator which is maintained internally and using the size sz .
template<typename other_iterator_type_ , typename other_size_type_ , typename transform_type_ >
 array (const other_iterator_type_ &it, const other_size_type_ &sz, const transform_type_ &trans)
 Constructs a reference array by applying the transform trans to the iterator it and size object sz.
arrayoperator= (const array &other)
 Copies the other array to the current array, possibly resizing the current array.
template<typename other_rep_ >
arrayoperator= (const array< signature_, traits_type_, other_rep_ > &other)
 Copies the other array to the current array, possibly resizing the current array. The other array could have a different representation type.
const_iterator begin () const
 Returns a const iterator pointing to the start of the array.
iterator begin ()
 Returns a const iterator pointing to the start of the array.
size_type size () const
 Returns a size object containing the dimension sizes of the array.
const_reference operator() (int i0,..., int iN) const
 Returns a const reference to the element of the array at the specified position.
reference operator() (int i0,..., int iN)
 Returns a reference to the element of the array at the specified position.
const_reference operator[] (int i0) const
 Returns a const reference to the element of the 1D array at the specified index.
reference operator[] (int i0)
 Returns a reference to the element of the 1D array at the specified index.
template<typename transform_type_ >
const transform_traits< array,
transform_type_ >::const_array 
operator[] (const transform_type_ &trans) const
 Applies the transform trans to the current array and returns the resulting array.
template<typename transform_type_ >
const transform_traits< array,
transform_type_ >::array 
operator[] (const transform_type_ &trans)
 Applies the transform trans to the current array and returns the resulting array.
const value_typedata () const
 Returns a const pointer to the beginning of the array storage.
value_typedata ()
 Returns a pointer to the beginning of the array storage.
void resize (int n0,..., int nN)
 Resizes the array dimensions to the specified sizes.
void resize (const size_type &sz)
 Resizes the array dimensions to the specified sizes.
void release ()
 Releases the memory allocated for the array and set the size to 0.

Public Attributes

typedef value_type
 Type of the elements of the array.
typedef iterator
 Array iterator type.
typedef const_iterator
 Array const iterator type.
typedef reference
 Type of the reference to the elements of the array.
typedef const_reference
 Type of the const reference to the elements of the array.
typedef temporary_array
 A compatible array type with the same signature and traits, suitable for defining temporary variables or return types.
typedef fwd_temporary_array
 A compatible array type with the same signature and traits and forward storage, suitable for defining temporary variables or return types.
typedef rev_temporary_array
 A compatible array type with the same signature and traits and reverse storage, suitable for defining temporary variables or return types.
typedef size_type
 A type that is used to represent and store the size of the arrays with the current signature.

Static Public Attributes

static const int dimensions = ...
 The number of dimensions of the array.
static const bool is_reverse = ...
 Indicates whether the array is using reverse storage.

Detailed Description

template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
class lite::array< signature_, traits_type_, rep_ >

This class represents a general sinlge/multidimensional array with constant/variable size dimensions.

The set of specializations of this class provides a unified way of representing and working with sinlge/multidimensional arrays with constant/variable size dimensions.

For a detailed explanation see Array Class .


Constructor & Destructor Documentation

template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
lite::array< signature_, traits_type_, rep_ >::array (  ) 

Default constructs the array.

All non-constant dimension sizes are set to 0. The content of the array (in cases it has a fixed size and therefore not initially empty) will be left uninitialized unless the elements of the array have a user-defined type that has its own default constructor. A reference array will be initialized to a null reference.

template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
lite::array< signature_, traits_type_, rep_ >::array ( const array< signature_, traits_type_, rep_ > &  other  ) 

Initializes the array to a copy of the other array.

Remarks:
In case of a reference array, only the reference is copied.
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
template<typename other_rep_ >
lite::array< signature_, traits_type_, rep_ >::array ( const array< signature_, traits_type_, other_rep_ > &  other  )  [inline]

Initializes the array to a copy of the other array. The other array could have a different representation type.

Remarks:
In case of a reference array, only the reference is copied. The other array could have a different representation type with an iterator type that is convertible to the current reference array's iterator_type.
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
lite::array< signature_, traits_type_, rep_ >::array ( int  n0,
  ...,
int  nN 
) [explicit]

Constructs an array with the given dimension sizes.

All non-constant dimension sizes are set to their corresponding supplied value from a0 to aN. The arguments corresponding to fixed-size dimensions are ignored. The array is then allocated. The content of the array will be left uninitialized unless the elements of the array have a user-defined type that has its own default constructor.

template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
lite::array< signature_, traits_type_, rep_ >::array ( const size_type size  )  [explicit]

Constructs an array with the given dimension sizes.

The array is then allocated. The content of the array will be left uninitialized unless the elements of the array have a user-defined type that has its own default constructor.

template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
lite::array< signature_, traits_type_, rep_ >::array ( const value_type a0,
  ...,
const value_type aT 
)

Constructs an array using the supplied values.

Remarks:
This constructor is only available for vectors (1D arrays) that use the internal representation (Internal Representation) and have a fixed size of at most LITE_ARRAY_MAX_VECTOR_ARGS .
Example
            array<double[2]> a(2.3, 4.5);
            array<double[3]> a(2.3, 4.5, 4.6);
            array<double[9]> a(1, 2, ..., 9); // error: more than LITE_ARRAY_MAX_VECTOR_ARGS number of args.
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
template<typename arg_type0_ , ... , typename arg_typeK_ >
lite::array< signature_, traits_type_, rep_ >::array ( const arg_type0_ &  arg0,
  ...,
const arg_typeK_ &  argK,
const size_type sz 
) [inline]

Constructs a reference array by passing the arg0 to argK to the constructor of the iterator which is maintained internally and using the size sz .

Remarks:
This constructor is only available in reference arrays (see Reference Representation). Also, K should be less than LITE_ARRAY_MAX_ITERATOR_ARGS. In other words, this constructor can take at most LITE_ARRAY_MAX_ITERATOR_ARGS arguments to be passed to the constructor of the iterator. This constructor is used internally by almost all array operations that return a reference array.
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
template<typename other_iterator_type_ , typename other_size_type_ , typename transform_type_ >
lite::array< signature_, traits_type_, rep_ >::array ( const other_iterator_type_ &  it,
const other_size_type_ &  sz,
const transform_type_ &  trans 
) [inline]

Constructs a reference array by applying the transform trans to the iterator it and size object sz.

Remarks:
This constructor is only available in reference arrays (see Reference Representation) and is used internally by operator[] of array classes to construct a reference array to be returned as the result of applying a transform.

Member Function Documentation

template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
value_type* lite::array< signature_, traits_type_, rep_ >::data (  ) 

Returns a pointer to the beginning of the array storage.

Remarks:
This function is available in arrays with internal (see Internal Representation) and hybrid (see Hybrid Representation) representation and is not required for user-defined array representations. It is not available in reference arrays (see Reference Representation).
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
const value_type* lite::array< signature_, traits_type_, rep_ >::data (  )  const

Returns a const pointer to the beginning of the array storage.

Remarks:
This function is available in arrays with internal (see Internal Representation) and hybrid (see Hybrid Representation) representation and is not required for user-defined array representations. It is not available in reference arrays (see Reference Representation).
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
template<typename other_rep_ >
array& lite::array< signature_, traits_type_, rep_ >::operator= ( const array< signature_, traits_type_, other_rep_ > &  other  )  [inline]

Copies the other array to the current array, possibly resizing the current array. The other array could have a different representation type.

Remarks:
Reference arrays will not be resized therefore their size should exactly match the size of the other array.
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
array& lite::array< signature_, traits_type_, rep_ >::operator= ( const array< signature_, traits_type_, rep_ > &  other  ) 

Copies the other array to the current array, possibly resizing the current array.

Remarks:
Reference arrays will not be resized therefore their size should exactly match the size of the other array.
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
template<typename transform_type_ >
const transform_traits<array, transform_type_>::array lite::array< signature_, traits_type_, rep_ >::operator[] ( const transform_type_ &  trans  )  [inline]

Applies the transform trans to the current array and returns the resulting array.

Remarks:
All the standard pre-defined transforms return a reference array as their result however this is not required for user-defined transforms.
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
template<typename transform_type_ >
const transform_traits<array, transform_type_>::const_array lite::array< signature_, traits_type_, rep_ >::operator[] ( const transform_type_ &  trans  )  const [inline]

Applies the transform trans to the current array and returns the resulting array.

Remarks:
All the standard pre-defined transforms return a reference array as their result however this is not required for user-defined transforms.
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
reference lite::array< signature_, traits_type_, rep_ >::operator[] ( int  i0  ) 

Returns a reference to the element of the 1D array at the specified index.

Remarks:
This operator is only available in vectors (1D arrays).
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
const_reference lite::array< signature_, traits_type_, rep_ >::operator[] ( int  i0  )  const

Returns a const reference to the element of the 1D array at the specified index.

Remarks:
This operator is only available in vectors (1D arrays).
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
void lite::array< signature_, traits_type_, rep_ >::release (  ) 

Releases the memory allocated for the array and set the size to 0.

Remarks:
This function is available only in primary arrays. Furthermore, this function does nothing for arrays with internal representations (see Internal Representation). See Hybrid Representation for more details about what this function does for hybrid representations.
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
void lite::array< signature_, traits_type_, rep_ >::resize ( const size_type sz  ) 

Resizes the array dimensions to the specified sizes.

Remarks:
When you resize an array, the old content of the array will be lost and the new array elements might be uninitialized.
This function is available only in primary arrays. It is not available in reference arrays (see Reference Representation). This function does nothing for arrays with internal representations (see Internal Representation). See Hybrid Representation for more details about what this function does for hybrid representations.
template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
void lite::array< signature_, traits_type_, rep_ >::resize ( int  n0,
  ...,
int  nN 
)

Resizes the array dimensions to the specified sizes.

The arguments corresponding to fixed-size dimensions are ignored.

Remarks:
When you resize an array, the old content of the array will be lost and the new array elements might be uninitialized.
This function is available only in primary arrays. It is not available in reference arrays (see Reference Representation). This function does nothing for arrays with internal representations (see Internal Representation). See Hybrid Representation for more details about what this function does for hybrid representations.

Member Data Documentation

template<typename signature_, typename traits_type_ = default_array_traits, typename rep_ = typename traits_type_::template representation_type<signature_>::type>
const bool lite::array< signature_, traits_type_, rep_ >::is_reverse = ... [static]

Indicates whether the array is using reverse storage.

Remarks:
Available only in primary arrays.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Defines

Generated on Fri Nov 6 02:03:21 2009 for Lite by  doxygen 1.6.0