Scopira
20080306
|
#include <narray.h>
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_type & | dimen (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 | |
T | operator() (index_type idx) const |
access, by index | |
T | operator[] (size_t idx) const |
Nice, referece-based element access. | |
T | get (size_t idx) const |
Gets the value of an element. | |
T | operator() (size_t x, size_t y) const |
T | get (size_t x, size_t y) const |
T & | operator() (size_t x, size_t y, size_t z) const |
T | get (size_t x, size_t y, size_t z) const |
bool | is_flat_stride (void) const |
template<int SIM> | |
scopira::basekit::const_nslice< T, SIM > | slicer (index_type base, nindex< SIM > dimen, nindex< SIM > direction) const |
template<int SIM> | |
scopira::basekit::const_nslice< T, SIM > | slicer (index_type base, nindex< SIM > dimen) const |
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.
scopira::basekit::const_nslice< T, DIM >::const_nslice | ( | const nslice< T, DIM > & | rhs | ) |
Implicit convert for nslice to const_nslice
|
inline |
Returns the start of the const_nslice, as an STL-style iterator
Referenced by scopira::basekit::narray< scopira::tool::uuid >::copy(), scopira::basekit::nslice< T, DIM >::copy(), and scopira::basekit::const_nslice< T, DIM >::save().
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).
Referenced by scopira::basekit::nslice< T, DIM >::resize().
|
inline |
Returns the end of the const_nslice, as an STL-style iterator
Referenced by scopira::basekit::const_nslice< T, DIM >::save().
|
inline |
Gets an individual element out of a matrix. This is only valid on two dimentional arrays.
x | the x value of the element to reference |
y | the y value of the element to reference |
|
inline |
Gets an individual element out of a cube. This is only valid on three dimentional arrays.
x | the x value of the element to reference |
y | the y value of the element to reference |
z | the z value of the element to reference |
|
inline |
Returns true if this slice has a "flat" stride. See scopira::basekit::is_flat_stride.
References scopira::basekit::is_flat_stride().
Referenced by scopira::basekit::nslice< T, DIM >::c_array(), and scopira::basekit::const_nslice< T, DIM >::save().
|
inline |
2-dimensional (matrix) array access operator. This is only valid on two dimentional arrays.
x | the x value of the element to reference |
y | the y value of the element to reference |
|
inline |
3-dimensional (cube) array access operator. This is only valid on three dimentional arrays.
x | the x value of the element to reference |
y | the y value of the element to reference |
z | the z value of the element to reference |
|
inline |
Resize the vector to the new length.
This destroys the previous contents.
len | the length of the vector (x dimension) |
References scopira::basekit::const_nslice< T, DIM >::resize().
Referenced by scopira::basekit::nslice< T, DIM >::resize(), and scopira::basekit::const_nslice< T, DIM >::resize().
|
inline |
Resize the matrix to the new dimensions.
This destroys the previous contents.
neww | the new width (x dimension) |
newh | the new width (y dimension) |
References scopira::basekit::const_nslice< T, DIM >::resize().
Referenced by scopira::basekit::const_nslice< T, DIM >::resize().
|
inline |
Resize the cube (3 dimensional array) to the new dimensions.
This destroys the previous contents.
neww | the new width (x dimension) |
newh | the new width (y dimension) |
newd | the new depth (z dimension) |
References scopira::basekit::const_nslice< T, DIM >::resize().
Referenced by scopira::basekit::const_nslice< T, DIM >::resize().
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.
References scopira::basekit::const_nslice< T, DIM >::slicer().
void scopira::basekit::const_nslice< T, DIM >::save | ( | scopira::tool::otflow_i & | out | ) | const |
Implements serilization via trait classes. Wire-compatible with narray!
References scopira::tool::fixed_array< T, N >::begin(), scopira::basekit::const_nslice< T, DIM >::begin(), scopira::tool::byte_swap_all(), scopira::basekit::const_nslice< T, DIM >::c_array(), scopira::basekit::const_nslice< T, DIM >::empty(), scopira::tool::fixed_array< T, N >::end(), scopira::basekit::const_nslice< T, DIM >::end(), scopira::basekit::const_nslice< T, DIM >::is_flat_stride(), scopira::basekit::const_nslice< T, DIM >::size(), scopira::tool::oflow_i::write_array(), scopira::tool::otflow_i::write_int(), and scopira::tool::otflow_i::write_size_t().
Referenced by scopira::basekit::narray< scopira::tool::uuid >::copy().
const_nslice<T,SIM> scopira::basekit::const_nslice< T, DIM >::slicer | ( | index_type | base, |
nindex< SIM > | dimen, | ||
nindex< SIM > | direction | ||
) | const |
slicer cire main slicer
Referenced by scopira::basekit::const_nslice< T, DIM >::all_slice(), scopira::basekit::nslice< T, DIM >::resize(), scopira::basekit::const_nslice< T, DIM >::resize(), scopira::basekit::const_nslice< T, DIM >::row_slice(), scopira::basekit::const_nslice< T, DIM >::slicer(), scopira::basekit::nslice< T, DIM >::tslice(), scopira::basekit::nslice< T, DIM >::xslice(), scopira::basekit::nslice< T, DIM >::xyslice(), scopira::basekit::nslice< T, DIM >::yslice(), and scopira::basekit::nslice< T, DIM >::zslice().