Gamma  0.9.5
Generic Synthesis Library
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Slice< T > Class Template Reference

Uniformly strided section of an array. More...

#include <Access.h>

List of all members.

Public Member Functions

 Slice (T *src, int32_t count_, int32_t stride_=1, int32_t offset_=0)
Slice operator() (int32_t cnt, int32_t str=1, int32_t off=0) const
 Returns new sub-slice.
T & operator[] (int32_t i) const
 Returns ith count element.
template<class U >
const Slicecopy (const Slice< U > &v) const
 Copy elements from another slice.
template<class Fil >
const Slicefilter (const Fil &v) const
 Apply filter in-place.
template<class R , class X , class A1 >
const Slicefilter (R(*const func)(X, A1), const A1 &a1)
 Apply C-style unary function in-place, x = func(x, a1)
template<class R , class X , class A1 , class A2 >
const Slicefilter (R(*const func)(X, A1, A2), const A1 &a1, const A2 &a2)
 Apply C-style binary function in-place, x = func(x, a1, a2)
const Slicereverse ()
 Reverse slice.
Slice reversed () const
 Returns reversed slice.
const Sliceset (const T &v=T()) const
 Set all elements to argument.
template<class U >
const Sliceswap (const Slice< U > &v) const
 Swaps elements.
mean () const
 Returns mean of elements.
sum () const
 Returns sum of elements in slice.

Detailed Description

template<class T>
class gam::Slice< T >

Uniformly strided section of an array.

For operations between different slices, the minimum count between the two slices will be used for iteration. All operations requiring elements to be copied perform a shallow copy (i.e. use '=' operator) and therefore are safe to use with objects.


Constructor & Destructor Documentation

Slice ( T *  src,
int32_t  count_,
int32_t  stride_ = 1,
int32_t  offset_ = 0 
)
Parameters:
[in]srcpointer to array elements
[in]count_how many elements to iterate over
[in]stride_stride increment through array
[in]offset_absolute offset into array, -1 is last, -2 penultimate, etc.

Member Function Documentation

const Slice& copy ( const Slice< U > &  v) const

Copy elements from another slice.

Source elements are statically cast to the type of the destination slice.


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