Scopira 20080306

scopira::basekit::const_nslice< T, DIM > Class Template Reference

#include <narray.h>

List of all members.

Public Types

typedef T data_type
typedef nindex< DIM > index_type
typedef const_niterator< T, DIM > iterator
typedef const_niterator< T, DIM > const_iterator
typedef T value_type
typedef T * pointer
typedef T & reference
typedef const T & const_reference
typedef size_t size_type
typedef ptrdiff_t difference_type

Public Member Functions

 const_nslice (void)
 default ctor, makes a null slice
 const_nslice (const this_type &rhs)
 copy ctor
 const_nslice (const narray< T, DIM > &rhs)
 does an all_slice on the source narray
 const_nslice (const narray< T, DIM > *rhs)
 does an all_slice on the source narray
 const_nslice (const T *_var, size_t _prime, index_type _size, index_type _stride)
 init, ctor
 const_nslice (const nslice< T, DIM > &rhs)
void save (scopira::tool::otflow_i &out) const
const T * c_array (void) const
 gets the slice as a raw C array. only valid if the X stride is 1
const_niterator< T, DIM > begin (void) const
const_niterator< T, DIM > end (void) const
bool is_null (void) const
 is the slice "null", ie not pointing to ANYTHING
void set_null (void)
 sets thte slice to null
bool empty (void) const
 empty?
size_t size (void) const
 gets the size (1D)
size_t width (void) const
 width
size_t height (void) const
 height
size_t depth (void) const
 depth
const index_typedimen (void) const
 gets the size of this array
void resize (size_t len)
void resize (size_t neww, size_t newh)
void resize (size_t neww, size_t newh, size_t newd)
void resize (const index_type &news)
template<int SIM>
const_nslice< T, SIM > slicer (index_type base, nindex< SIM > dimen, nindex< SIM > direction) const
template<int SIM>
const_nslice< T, SIM > slicer (index_type base, nindex< SIM > dimen) const
 default directions
const_nslice< T, 1 > slicer (index_type base, size_t len, size_t direction=0) const
 1D specialized slicer, just to be nice
const_nslice< T, 1 > diagonal_slice (void)
const_nslice< T, DIM > all_slice (void) const
 all slice
size_t size_rows (void) const
 number of rows
const_nslice< T, DIM-1 > row_slice (size_t r) const
 get a particular row
const_nslice< T, 1 > xslice (size_t basex, size_t len) const
 vector to vector
const_nslice< T, 1 > xslice (size_t basex, size_t basey, size_t len) const
 vector slice
const_nslice< T, 1 > yslice (size_t basex, size_t basey, size_t len) const
 vector slice
const_nslice< T, 2 > xyslice (size_t basex, size_t basey, size_t width, size_t height) const
 matrix slice
const_nslice< T, 1 > xslice (index_type base, size_t len) const
 vector slice
const_nslice< T, 1 > yslice (index_type base, size_t len) const
 vector slice
const_nslice< T, 1 > zslice (index_type base, size_t len) const
 vector slice
const_nslice< T, 1 > tslice (index_type base, size_t len) const
 vector slice
const_nslice< T, 2 > xyslice (index_type base, size_t width, size_t height) const
 matrix slice
operator() (index_type idx) const
 access, by index
operator[] (size_t idx) const
 Nice, referece-based element access.
get (size_t idx) const
 Gets the value of an element.
operator() (size_t x, size_t y) const
get (size_t x, size_t y) const
T & operator() (size_t x, size_t y, size_t z) const
get (size_t x, size_t y, size_t z) const
bool is_flat_stride (void) const

Detailed Description

template<class T, int DIM>
class scopira::basekit::const_nslice< T, DIM >

Natural partner for narray. A light ("pointer") like pointer into another narray.

This version does NOT permit you to modify the source matrix in any way, making it const-safe.

Author:
Aleksander Demko

Constructor & Destructor Documentation

template<class T , int DIM>
scopira::basekit::const_nslice< T, DIM >::const_nslice ( const nslice< T, DIM > &  rhs)

Implicit convert for nslice to const_nslice

Author:
Aleksander Demko

Member Function Documentation

template<class T, int DIM>
const_niterator<T, DIM> scopira::basekit::const_nslice< T, DIM >::begin ( void  ) const [inline]
template<class T , int DIM>
scopira::basekit::const_nslice< T, 1 > scopira::basekit::const_nslice< T, DIM >::diagonal_slice ( void  )

This returns a slice vector that goes across the diagonal.

This only works on matrix nslices (for now).

Author:
Aleksander Demko
template<class T, int DIM>
const_niterator<T, DIM> scopira::basekit::const_nslice< T, DIM >::end ( void  ) const [inline]
template<class T, int DIM>
T scopira::basekit::const_nslice< T, DIM >::get ( size_t  x,
size_t  y 
) const [inline]

Gets an individual element out of a matrix. This is only valid on two dimentional arrays.

Parameters:
xthe x value of the element to reference
ythe y value of the element to reference
Returns:
the value of the specified element
Author:
Aleksander Demko
template<class T, int DIM>
T scopira::basekit::const_nslice< T, DIM >::get ( size_t  x,
size_t  y,
size_t  z 
) const [inline]

Gets an individual element out of a cube. This is only valid on three dimentional arrays.

Parameters:
xthe x value of the element to reference
ythe y value of the element to reference
zthe z value of the element to reference
Returns:
the value of the specified element
Author:
Aleksander Demko
template<class T, int DIM>
bool scopira::basekit::const_nslice< T, DIM >::is_flat_stride ( void  ) const [inline]

Returns true if this slice has a "flat" stride. See scopira::basekit::is_flat_stride.

Author:
Aleksander Demko

References scopira::basekit::is_flat_stride().

template<class T, int DIM>
T scopira::basekit::const_nslice< T, DIM >::operator() ( size_t  x,
size_t  y 
) const [inline]

2-dimensional (matrix) array access operator. This is only valid on two dimentional arrays.

Parameters:
xthe x value of the element to reference
ythe y value of the element to reference
Returns:
a reference to the specified value
Author:
Aleksander Demko
template<class T, int DIM>
T& scopira::basekit::const_nslice< T, DIM >::operator() ( size_t  x,
size_t  y,
size_t  z 
) const [inline]

3-dimensional (cube) array access operator. This is only valid on three dimentional arrays.

Parameters:
xthe x value of the element to reference
ythe y value of the element to reference
zthe z value of the element to reference
Returns:
a reference to the specified value
Author:
Aleksander Demko
template<class T , int DIM>
void scopira::basekit::const_nslice< T, DIM >::resize ( const index_type news)

Generic resize function that takes a index_type.

This destroys the previous contents.

Author:
Aleksander Demko
template<class T, int DIM>
void scopira::basekit::const_nslice< T, DIM >::resize ( size_t  len) [inline]

Resize the vector to the new length.

This destroys the previous contents.

Parameters:
lenthe length of the vector (x dimension)
Author:
Aleksander Demko

References scopira::basekit::const_nslice< T, DIM >::resize().

Referenced by scopira::basekit::nslice< T, DIM >::copy(), and scopira::basekit::const_nslice< T, DIM >::resize().

template<class T, int DIM>
void scopira::basekit::const_nslice< T, DIM >::resize ( size_t  neww,
size_t  newh 
) [inline]

Resize the matrix to the new dimensions.

This destroys the previous contents.

Parameters:
newwthe new width (x dimension)
newhthe new width (y dimension)
Author:
Aleksander Demko

References scopira::basekit::const_nslice< T, DIM >::resize().

Referenced by scopira::basekit::const_nslice< T, DIM >::resize().

template<class T, int DIM>
void scopira::basekit::const_nslice< T, DIM >::resize ( size_t  neww,
size_t  newh,
size_t  newd 
) [inline]

Resize the cube (3 dimensional array) to the new dimensions.

This destroys the previous contents.

Parameters:
newwthe new width (x dimension)
newhthe new width (y dimension)
newdthe new depth (z dimension)
Author:
Aleksander Demko

References scopira::basekit::const_nslice< T, DIM >::resize().

Referenced by scopira::basekit::const_nslice< T, DIM >::resize().


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