Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

MultiDimArrayAccess Class Template Reference

Non-const multidimensional array access. More...

#include <MultiDimArrayAccess.h>

Collaboration diagram for MultiDimArrayAccess:

Collaboration graph
[legend]
List of all members.

Public Methods

 MultiDimArrayAccess (TYPE *p=((TYPE *) 0), const size_t *sz=((size_t *) 0), const int *st=((int *) 0), bool reverse=false)
 Constructor for setting all data, with default values. More...

 MultiDimArrayAccess (TYPE *p, const int *si, const int *sf, bool reverse=false)
 Constructor for setting all data, with default values. More...

 MultiDimArrayAccess (TYPE *p, const MultiDimArrayIndexRange< DIM > &r)
 Constructor for specifying pointer and index range object. More...

 MultiDimArrayAccess (const MultiDimArrayAccess &r)
 Copy constructor. More...

 operator bool () const
 Conversion into boolean. More...

 operator TYPE * () const
 Conversion into pointer. More...

void setPointer (TYPE *p)
 Set the data pointer. More...

const MultiDimArrayIndexRange<
DIM > & 
adjustDim (int d, int first, int final)
 Adjust the dimensions. More...

void reverseDim ()
 Reverse the ordering of the dimensions. More...

 MultiDimArrayAccess (TYPE *p=((TYPE *) 0), const size_t *sz=((size_t *) 0), const int *st=((int *) 0), bool reverse=false)
 Constructor for setting all data, with default values. More...

 MultiDimArrayAccess (TYPE *p, const int *si, const int *sf, bool reverse=false)
 Constructor for setting all data, with default values. More...

 MultiDimArrayAccess (TYPE *p, const MultiDimArrayIndexRange< DIM > &r)
 Constructor for specifying pointer and index range object. More...

 MultiDimArrayAccess (const MultiDimArrayAccess &r)
 Copy constructor. More...

 operator bool () const
 Conversion into boolean. More...

 operator TYPE * () const
 Conversion into pointer. More...

void setPointer (TYPE *p)
 Set the data pointer. More...

const MultiDimArrayIndexRange<
DIM > & 
adjustDim (int d, int first, int final)
 Adjust the dimensions. More...

void reverseDim ()
 Reverse the ordering of the dimensions. More...

Functions for accessing items
const MultiDimArrayIndexRange<
DIM > & 
range ()
int beg (size_t i) const
int end (size_t i) const
int size (size_t i) const
TYPE & operator() (int i0) const
 Grant general access to item in a 1D array. More...

TYPE & operator() (int i0, int i1) const
 Grant general access to item in a 2D array. More...

TYPE & operator() (int i0, int i1, int i2) const
 Grant general access to item in a 3D array. More...

TYPE & operator() (int i0, int i1, int i2, int i3) const
 Grant general access to item in a 4D array. More...

Functions for accessing items
const MultiDimArrayIndexRange<
DIM > & 
range ()
int beg (size_t i) const
int end (size_t i) const
int size (size_t i) const
TYPE & operator() (int i0) const
 Grant general access to item in a 1D array. More...

TYPE & operator() (int i0, int i1) const
 Grant general access to item in a 2D array. More...

TYPE & operator() (int i0, int i1, int i2) const
 Grant general access to item in a 3D array. More...

TYPE & operator() (int i0, int i1, int i2, int i3) const
 Grant general access to item in a 4D array. More...


Private Attributes

TYPE * d_ptr
 Pointer to array. More...

MultiDimArrayIndexRange< DIM > d_range
 Index range object. More...

TYPE * d_ptr
 Pointer to array. More...

MultiDimArrayIndexRange< DIM > d_range
 Index range object. More...


Detailed Description

template<class TYPE, int DIM>
class MultiDimArrayAccess< TYPE, DIM >

Non-const multidimensional array access.

This class never allocates or deallocates data. It takes pointers to preallocated data and prodes an interface to that data. Member functions are used to give that interface.

This class provides functions for explicit index checking, but it does NO implicit error checking on either the dimensionality of the array or it size. Such should be done through subclassing.

The member functions should all be inlined for better performance.

Definition at line 284 of file MultiDimArrayAccess.h.


Constructor & Destructor Documentation

template<class TYPE, int DIM>
MultiDimArrayAccess< TYPE, DIM >::MultiDimArrayAccess TYPE *    p = ((TYPE*)0),
const size_t *    sz = ((size_t*)0),
const int *    st = ((int*)0),
bool    reverse = false
[inline]
 

Constructor for setting all data, with default values.

Any pointers that are NULL are not used. The resulting default settings are:

  • Data pointer is NULL
  • Array sizes are 0
  • Array starting indices are 0
  • Dimension indices are not reversed
There is another constructor which accepts the first and final indices instead of the sizes and first indices. NOTE: the place of the initial indices is different than it is for the constructor taking final indices instead of sizes.
Parameters:
p  Pointer to data
sz  Array sizes
st  Array starting indices
reverse  Reverse indices flag

Definition at line 306 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
MultiDimArrayAccess< TYPE, DIM >::MultiDimArrayAccess TYPE *    p,
const int *    si,
const int *    sf,
bool    reverse = false
[inline]
 

Constructor for setting all data, with default values.

Any pointers that are NULL are not used. The resulting default settings are:

  • Data pointer is NULL
  • Array sizes are 0
  • Array starting indices are 0
  • Dimension indices are not reversed
This version takes two int* arguments, for the initial and final indices. It does not support default arguments until after the indices argument. NOTE: the place of the initial indices is different than it is for the constructor taking sizes instead of final indices.

If si is NULL, starting indices are set to 0. If sf is NULL, sizes are set to zero.

Parameters:
p  Pointer to data
si  Array of initial indices
sf  Array of final indices
reverse  Reverse indices flag

Definition at line 334 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
MultiDimArrayAccess< TYPE, DIM >::MultiDimArrayAccess TYPE *    p,
const MultiDimArrayIndexRange< DIM > &    r
[inline]
 

Constructor for specifying pointer and index range object.

There is no default argument in this constructor.

Parameters:
p  Pointer to data
r  Array index object

Definition at line 348 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
MultiDimArrayAccess< TYPE, DIM >::MultiDimArrayAccess const MultiDimArrayAccess< TYPE, DIM > &    r [inline]
 

Copy constructor.

There is no default argument in this constructor.

Parameters:
r  Copyee object

Definition at line 360 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
MultiDimArrayAccess< TYPE, DIM >::MultiDimArrayAccess TYPE *    p = ((TYPE*)0),
const size_t *    sz = ((size_t*)0),
const int *    st = ((int*)0),
bool    reverse = false
[inline]
 

Constructor for setting all data, with default values.

Any pointers that are NULL are not used. The resulting default settings are:

  • Data pointer is NULL
  • Array sizes are 0
  • Array starting indices are 0
  • Dimension indices are not reversed
There is another constructor which accepts the first and final indices instead of the sizes and first indices. NOTE: the place of the initial indices is different than it is for the constructor taking final indices instead of sizes.
Parameters:
p  Pointer to data
sz  Array sizes
st  Array starting indices
reverse  Reverse indices flag

Definition at line 306 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
MultiDimArrayAccess< TYPE, DIM >::MultiDimArrayAccess TYPE *    p,
const int *    si,
const int *    sf,
bool    reverse = false
[inline]
 

Constructor for setting all data, with default values.

Any pointers that are NULL are not used. The resulting default settings are:

  • Data pointer is NULL
  • Array sizes are 0
  • Array starting indices are 0
  • Dimension indices are not reversed
This version takes two int* arguments, for the initial and final indices. It does not support default arguments until after the indices argument. NOTE: the place of the initial indices is different than it is for the constructor taking sizes instead of final indices.

If si is NULL, starting indices are set to 0. If sf is NULL, sizes are set to zero.

Parameters:
p  Pointer to data
si  Array of initial indices
sf  Array of final indices
reverse  Reverse indices flag

Definition at line 334 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
MultiDimArrayAccess< TYPE, DIM >::MultiDimArrayAccess TYPE *    p,
const MultiDimArrayIndexRange< DIM > &    r
[inline]
 

Constructor for specifying pointer and index range object.

There is no default argument in this constructor.

Parameters:
p  Pointer to data
r  Array index object

Definition at line 348 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
MultiDimArrayAccess< TYPE, DIM >::MultiDimArrayAccess const MultiDimArrayAccess< TYPE, DIM > &    r [inline]
 

Copy constructor.

There is no default argument in this constructor.

Parameters:
r  Copyee object

Definition at line 360 of file MultiDimArrayAccess.h.

References d_ptr.


Member Function Documentation

template<class TYPE, int DIM>
const MultiDimArrayIndexRange<DIM>& MultiDimArrayAccess< TYPE, DIM >::adjustDim int    d,
int    first,
int    final
[inline]
 

Adjust the dimensions.

See also:
MultiDimArrayIndexRange::adjustDim.
Parameters:
d  Dimension to adjust
first  Increment to first index
final  Increment to final index

Definition at line 401 of file MultiDimArrayAccess.h.

References MultiDimArrayIndexRange::adjustDim().

template<class TYPE, int DIM>
const MultiDimArrayIndexRange<DIM>& MultiDimArrayAccess< TYPE, DIM >::adjustDim int    d,
int    first,
int    final
[inline]
 

Adjust the dimensions.

See also:
MultiDimArrayIndexRange::adjustDim.
Parameters:
d  Dimension to adjust
first  Increment to first index
final  Increment to final index

Definition at line 401 of file MultiDimArrayAccess.h.

References MultiDimArrayIndexRange::adjustDim().

template<class TYPE, int DIM>
int MultiDimArrayAccess< TYPE, DIM >::beg size_t    i const [inline]
 

Definition at line 424 of file MultiDimArrayAccess.h.

References MultiDimArrayIndexRange::beg().

template<class TYPE, int DIM>
int MultiDimArrayAccess< TYPE, DIM >::beg size_t    i const [inline]
 

Definition at line 424 of file MultiDimArrayAccess.h.

References MultiDimArrayIndexRange::beg().

template<class TYPE, int DIM>
int MultiDimArrayAccess< TYPE, DIM >::end size_t    i const [inline]
 

Definition at line 425 of file MultiDimArrayAccess.h.

References MultiDimArrayIndexRange::end().

template<class TYPE, int DIM>
int MultiDimArrayAccess< TYPE, DIM >::end size_t    i const [inline]
 

Definition at line 425 of file MultiDimArrayAccess.h.

References MultiDimArrayIndexRange::end().

template<class TYPE, int DIM>
MultiDimArrayAccess< TYPE, DIM >::operator bool   const [inline]
 

Conversion into boolean.

Returns:
true iff data pointer is not NULL.

Definition at line 371 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
MultiDimArrayAccess< TYPE, DIM >::operator bool   const [inline]
 

Conversion into boolean.

Returns:
true iff data pointer is not NULL.

Definition at line 371 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
MultiDimArrayAccess< TYPE, DIM >::operator TYPE *   const [inline]
 

Conversion into pointer.

Returns:
the data pointer.

Definition at line 380 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
MultiDimArrayAccess< TYPE, DIM >::operator TYPE *   const [inline]
 

Conversion into pointer.

Returns:
the data pointer.

Definition at line 380 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
TYPE& MultiDimArrayAccess< TYPE, DIM >::operator() int    i0,
int    i1,
int    i2,
int    i3
const [inline]
 

Grant general access to item in a 4D array.

Parameters:
i0  First index
i1  Second index
i2  Third index
i3  Fourth index

Definition at line 454 of file MultiDimArrayAccess.h.

References d_ptr, and MultiDimArrayIndexRange::offset().

template<class TYPE, int DIM>
TYPE& MultiDimArrayAccess< TYPE, DIM >::operator() int    i0,
int    i1,
int    i2
const [inline]
 

Grant general access to item in a 3D array.

Parameters:
i0  First index
i1  Second index
i2  Third index

Definition at line 445 of file MultiDimArrayAccess.h.

References d_ptr, and MultiDimArrayIndexRange::offset().

template<class TYPE, int DIM>
TYPE& MultiDimArrayAccess< TYPE, DIM >::operator() int    i0,
int    i1
const [inline]
 

Grant general access to item in a 2D array.

Parameters:
i0  First index
i1  Second index

Definition at line 437 of file MultiDimArrayAccess.h.

References d_ptr, and MultiDimArrayIndexRange::offset().

template<class TYPE, int DIM>
TYPE& MultiDimArrayAccess< TYPE, DIM >::operator() int    i0 const [inline]
 

Grant general access to item in a 1D array.

Parameters:
i0  Index

Definition at line 430 of file MultiDimArrayAccess.h.

References d_ptr, and MultiDimArrayIndexRange::offset().

template<class TYPE, int DIM>
TYPE& MultiDimArrayAccess< TYPE, DIM >::operator() int    i0,
int    i1,
int    i2,
int    i3
const [inline]
 

Grant general access to item in a 4D array.

Parameters:
i0  First index
i1  Second index
i2  Third index
i3  Fourth index

Definition at line 454 of file MultiDimArrayAccess.h.

References d_ptr, and MultiDimArrayIndexRange::offset().

template<class TYPE, int DIM>
TYPE& MultiDimArrayAccess< TYPE, DIM >::operator() int    i0,
int    i1,
int    i2
const [inline]
 

Grant general access to item in a 3D array.

Parameters:
i0  First index
i1  Second index
i2  Third index

Definition at line 445 of file MultiDimArrayAccess.h.

References d_ptr, and MultiDimArrayIndexRange::offset().

template<class TYPE, int DIM>
TYPE& MultiDimArrayAccess< TYPE, DIM >::operator() int    i0,
int    i1
const [inline]
 

Grant general access to item in a 2D array.

Parameters:
i0  First index
i1  Second index

Definition at line 437 of file MultiDimArrayAccess.h.

References d_ptr, and MultiDimArrayIndexRange::offset().

template<class TYPE, int DIM>
TYPE& MultiDimArrayAccess< TYPE, DIM >::operator() int    i0 const [inline]
 

Grant general access to item in a 1D array.

Parameters:
i0  Index

Definition at line 430 of file MultiDimArrayAccess.h.

References d_ptr, and MultiDimArrayIndexRange::offset().

template<class TYPE, int DIM>
const MultiDimArrayIndexRange<DIM>& MultiDimArrayAccess< TYPE, DIM >::range   [inline]
 

Definition at line 423 of file MultiDimArrayAccess.h.

template<class TYPE, int DIM>
const MultiDimArrayIndexRange<DIM>& MultiDimArrayAccess< TYPE, DIM >::range   [inline]
 

Definition at line 423 of file MultiDimArrayAccess.h.

template<class TYPE, int DIM>
void MultiDimArrayAccess< TYPE, DIM >::reverseDim   [inline]
 

Reverse the ordering of the dimensions.

See also:
MultiDimArrayIndexRange::reverseDim.

Definition at line 415 of file MultiDimArrayAccess.h.

References MultiDimArrayIndexRange::reverseDim().

template<class TYPE, int DIM>
void MultiDimArrayAccess< TYPE, DIM >::reverseDim   [inline]
 

Reverse the ordering of the dimensions.

See also:
MultiDimArrayIndexRange::reverseDim.

Definition at line 415 of file MultiDimArrayAccess.h.

References MultiDimArrayIndexRange::reverseDim().

template<class TYPE, int DIM>
void MultiDimArrayAccess< TYPE, DIM >::setPointer TYPE *    p [inline]
 

Set the data pointer.

Parameters:
p  Pointer value

Definition at line 390 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
void MultiDimArrayAccess< TYPE, DIM >::setPointer TYPE *    p [inline]
 

Set the data pointer.

Parameters:
p  Pointer value

Definition at line 390 of file MultiDimArrayAccess.h.

References d_ptr.

template<class TYPE, int DIM>
int MultiDimArrayAccess< TYPE, DIM >::size size_t    i const [inline]
 

Definition at line 426 of file MultiDimArrayAccess.h.

References MultiDimArrayIndexRange::size().

template<class TYPE, int DIM>
int MultiDimArrayAccess< TYPE, DIM >::size size_t    i const [inline]
 

Definition at line 426 of file MultiDimArrayAccess.h.

References MultiDimArrayIndexRange::size().


Member Data Documentation

template<class TYPE, int DIM>
TYPE* MultiDimArrayAccess::d_ptr [private]
 

Pointer to array.

Definition at line 287 of file MultiDimArrayAccess.h.

template<class TYPE, int DIM>
TYPE* MultiDimArrayAccess::d_ptr [private]
 

Pointer to array.

Definition at line 287 of file MultiDimArrayAccess.h.

Referenced by MultiDimArrayAccess(), operator bool(), operator TYPE *(), operator()(), and setPointer().

template<class TYPE, int DIM>
MultiDimArrayIndexRange<DIM> MultiDimArrayAccess::d_range [private]
 

Index range object.

Definition at line 289 of file MultiDimArrayAccess.h.

template<class TYPE, int DIM>
MultiDimArrayIndexRange<DIM> MultiDimArrayAccess::d_range [private]
 

Index range object.

Definition at line 289 of file MultiDimArrayAccess.h.


The documentation for this class was generated from the following files:
Generated on Wed Apr 17 12:51:47 2002 for samtut by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001