HCC
HCC is a single-source, C/C++ compiler for heterogeneous computing. It's optimized with HSA (http://www.hsafoundation.com/).
Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
Kalmar::index< N > Class Template Reference

Represents a unique position in N-dimensional space. More...

#include <kalmar_index.h>

Inheritance diagram for Kalmar::index< N >:
Inheritance graph
Collaboration diagram for Kalmar::index< N >:
Collaboration graph

Public Types

typedef int value_type
 The element type of index<N>.
 

Public Member Functions

 index ()
 Default constructor. More...
 
 index (const index &other)
 Copy constructor. More...
 
 index (const int components[])
 Constructs an index<N> with the coordinate values provided the array of int component values. More...
 
 index (int components[])
 Constructs an index<N> with the coordinate values provided the array of int component values. More...
 
indexoperator= (const index &other)
 Assigns the component values of "other" to this index<N> object. More...
 
 __attribute__ ((annotate("__cxxamp_opencl_index"))) void __cxxamp_opencl_index()
 
 index (int i0)
 Constructs an index<N> with the coordinate values provided by $i_{0..2}$. More...
 
template<typename... _Tp>
 index (_Tp...__t)
 Constructs an index<N> with the coordinate values provided by $i_{0..2}$. More...
 
int operator[] (unsigned int c) const
 Returns the index component value at position c. More...
 
int & operator[] (unsigned int c)
 Returns the index component value at position c. More...
 
bool operator== (const index &other) const
 Compares two objects of index<N>. More...
 
bool operator!= (const index &other) const
 Compares two objects of index<N>. More...
 
indexoperator+= (const index &rhs)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ rhs; The return value is "*this". More...
 
indexoperator-= (const index &rhs)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ rhs; The return value is "*this". More...
 
indexoperator*= (const index &__r)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ rhs; The return value is "*this". More...
 
indexoperator/= (const index &__r)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ rhs; The return value is "*this". More...
 
indexoperator%= (const index &__r)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ rhs; The return value is "*this". More...
 
indexoperator+= (int value)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value; The return value is "*this". More...
 
indexoperator-= (int value)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value; The return value is "*this". More...
 
indexoperator*= (int value)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value; The return value is "*this". More...
 
indexoperator/= (int value)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value; The return value is "*this". More...
 
indexoperator%= (int value)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value; The return value is "*this". More...
 
indexoperator++ ()
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1;. More...
 
index operator++ (int)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1;. More...
 
indexoperator-- ()
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1;. More...
 
index operator-- (int)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1;. More...
 

Static Public Attributes

static const int rank = N
 A static member of index<N> that contains the rank of this index.
 

Friends

template<int T>
class Concurrency::extent
 
template<int T>
class hc::extent
 
template<int K, typename Q >
struct index_helper
 
template<int K, typename Q1 , typename Q2 >
struct amp_helper
 

Detailed Description

template<int N>
class Kalmar::index< N >

Represents a unique position in N-dimensional space.

Template Parameters
NThe dimensionality space into which this index applies. Special constructors are supplied for the cases where $N \in \{1,2,3\}$, but N can be any integer greater than 0.

Constructor & Destructor Documentation

template<int N>
Kalmar::index< N >::index ( )
inline

Default constructor.

The value at each dimension is initialized to zero. Thus, "index<3> ix;" initializes the variable to the position (0,0,0).

template<int N>
Kalmar::index< N >::index ( const index< N > &  other)
inline

Copy constructor.

Constructs a new index<N> from the supplied argument "other".

Parameters
[in]otherAn object of type index<N> from which to initialize this new index.
template<int N>
Kalmar::index< N >::index ( int  i0)
inlineexplicit

Constructs an index<N> with the coordinate values provided by $i_{0..2}$.

These are specialized constructors that are only valid when the rank of the index $N \in \{1,2,3\}$. Invoking a specialized constructor whose argument $count \ne N$ will result in a compilation error.

Parameters
[in]i0The component values of the index vector.
template<int N>
template<typename... _Tp>
Kalmar::index< N >::index ( _Tp...  __t)
inlineexplicit

Constructs an index<N> with the coordinate values provided by $i_{0..2}$.

These are specialized constructors that are only valid when the rank of the index $N \in \{1,2,3\}$. Invoking a specialized constructor whose argument $count \ne N$ will result in a compilation error.

Parameters
[in]i0The component values of the index vector.
template<int N>
Kalmar::index< N >::index ( const int  components[])
inlineexplicit

Constructs an index<N> with the coordinate values provided the array of int component values.

If the coordinate array length $\ne$ N, the behavior is undefined. If the array value is NULL or not a valid pointer, the behavior is undefined.

Parameters
[in]componentsAn array of N int values.
template<int N>
Kalmar::index< N >::index ( int  components[])
inlineexplicit

Constructs an index<N> with the coordinate values provided the array of int component values.

If the coordinate array length $\ne$ N, the behavior is undefined. If the array value is NULL or not a valid pointer, the behavior is undefined.

Parameters
[in]componentsAn array of N int values.

Member Function Documentation

template<int N>
bool Kalmar::index< N >::operator!= ( const index< N > &  other) const
inline

Compares two objects of index<N>.

The expression $leftIdx \oplus rightIdx$ is true if $leftIdx[i] \oplus rightIdx[i]$ for every i from 0 to N-1.

Parameters
[in]otherThe right-hand index<N> to be compared.
template<int N>
index& Kalmar::index< N >::operator%= ( const index< N > &  __r)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ rhs; The return value is "*this".

Parameters
[in]rhsThe right-hand index<N> of the arithmetic operation.
template<int N>
index& Kalmar::index< N >::operator%= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value; The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
index& Kalmar::index< N >::operator*= ( const index< N > &  __r)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ rhs; The return value is "*this".

Parameters
[in]rhsThe right-hand index<N> of the arithmetic operation.
template<int N>
index& Kalmar::index< N >::operator*= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value; The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
index& Kalmar::index< N >::operator++ ( )
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1;.

For prefix increment and decrement, the return value is "*this". Otherwise a new index<N> is returned.

template<int N>
index Kalmar::index< N >::operator++ ( int  )
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1;.

For prefix increment and decrement, the return value is "*this". Otherwise a new index<N> is returned.

template<int N>
index& Kalmar::index< N >::operator+= ( const index< N > &  rhs)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ rhs; The return value is "*this".

Parameters
[in]rhsThe right-hand index<N> of the arithmetic operation.
template<int N>
index& Kalmar::index< N >::operator+= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value; The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
index& Kalmar::index< N >::operator-- ( )
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1;.

For prefix increment and decrement, the return value is "*this". Otherwise a new index<N> is returned.

template<int N>
index Kalmar::index< N >::operator-- ( int  )
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1;.

For prefix increment and decrement, the return value is "*this". Otherwise a new index<N> is returned.

template<int N>
index& Kalmar::index< N >::operator-= ( const index< N > &  rhs)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ rhs; The return value is "*this".

Parameters
[in]rhsThe right-hand index<N> of the arithmetic operation.
template<int N>
index& Kalmar::index< N >::operator-= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value; The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
index& Kalmar::index< N >::operator/= ( const index< N > &  __r)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ rhs; The return value is "*this".

Parameters
[in]rhsThe right-hand index<N> of the arithmetic operation.
template<int N>
index& Kalmar::index< N >::operator/= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value; The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
index& Kalmar::index< N >::operator= ( const index< N > &  other)
inline

Assigns the component values of "other" to this index<N> object.

Parameters
[in]otherAn object of type index<N> from which to copy into this index.
Returns
Returns *this.
template<int N>
bool Kalmar::index< N >::operator== ( const index< N > &  other) const
inline

Compares two objects of index<N>.

The expression $leftIdx \oplus rightIdx$ is true if $leftIdx[i] \oplus rightIdx[i]$ for every i from 0 to N-1.

Parameters
[in]otherThe right-hand index<N> to be compared.
template<int N>
int Kalmar::index< N >::operator[] ( unsigned int  c) const
inline

Returns the index component value at position c.

Parameters
[in]cThe dimension axis whose coordinate is to be accessed.
Returns
A the component value at position c.
template<int N>
int& Kalmar::index< N >::operator[] ( unsigned int  c)
inline

Returns the index component value at position c.

Parameters
[in]cThe dimension axis whose coordinate is to be accessed.
Returns
A the component value at position c.

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