STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
Concurrency::index< _Rank > Class Template Reference

Define an N-dimensional index point; which may also be viewed as a vector based at the origin in N-space. More...

#include <amp.h>

Public Types

typedef int value_type
 

Public Member Functions

 _CPP_AMP_VERIFY_RANK (_Rank, index)
 
 index () __GPU
 Default constructor, initializes all elements with 0. More...
 
 index (const index< _Rank > &_Other) __GPU
 Copy Constructor. More...
 
 index (int _I) __GPU
 Constructor for index<1> More...
 
 index (int _I0, int _I1) __GPU
 Constructor for index<2> More...
 
 index (int _I0, int _I1, int _I2) __GPU
 Constructor for index<3> More...
 
 index (const int _Array[_Rank]) __GPU
 Constructs an index<N> with the coordinate values provided the array of int component values. If the coordinate array length is not N, the behavior is undefined. More...
 
index< _Rank > & operator= (const index< _Rank > &_Other) __GPU
 copy-assignment operators More...
 
int operator[] (unsigned _Index) const __GPU
 Index operator. More...
 
intoperator[] (unsigned _Index) __GPU
 Index operator. More...
 
index< _Rank > & operator+= (const index< _Rank > &_Rhs) __GPU
 Element-wise addition of this index with another index. More...
 
index< _Rank > & operator-= (const index< _Rank > &_Rhs) __GPU
 Element-wise subtraction of this index with another index. More...
 
index< _Rank > & operator+= (int _Rhs) __GPU
 Adds an integer value to each element of this index. More...
 
index< _Rank > & operator-= (int _Rhs) __GPU
 Subtracts an integer value from each element of this index. More...
 
index< _Rank > & operator*= (int _Rhs) __GPU
 Multiplies each element of this index with an integer value. More...
 
index< _Rank > & operator/= (int _Rhs) __GPU
 Divides each element of this index by an integer value. More...
 
index< _Rank > & operator%= (int _Rhs) __GPU
 Modulus an integer value into each element of this index. More...
 
index< _Rank > & operator++ () __GPU
 Pre-increments each element of this index. More...
 
index< _Rank > operator++ (int) __GPU
 Post-increments each element of this index. More...
 
index< _Rank > & operator-- () __GPU
 Pre-decrements each element of this index. More...
 
index operator-- (int) __GPU
 Post-decrements each element of this index. More...
 

Static Public Attributes

static const int rank = _Rank
 

Private Member Functions

 index (details::_eInitializeState) __GPU
 Constructor. More...
 

Private Attributes

int _M_base [_Rank]
 

Friends

template<typename _Value_type , int _Rank>
class array
 
template<int _Rank, int _Element_size>
class details::_Array_view_shape
 
template<int _Rank, int _Element_size>
class details::_Array_view_base
 
template<class _Tuple_type >
_Tuple_type details::_Create_uninitialized_tuple () __GPU
 

Detailed Description

template<int _Rank>
class Concurrency::index< _Rank >

Define an N-dimensional index point; which may also be viewed as a vector based at the origin in N-space.

The index<N> type represents an N-dimensional vector of int which specifies a unique position in an N-dimensional space. The values in the coordinate vector are ordered from most-significant to least-significant. Thus, in 2-dimensional space, the index vector (5,3) represents the position at row 5, column 3.

The position is relative to the origin in the N-dimensional space, and can contain negative component values.

Parameters
_RankThe dimensionality space into which this index applies, can be any integer greater than 0.

Member Typedef Documentation

template<int _Rank>
typedef int Concurrency::index< _Rank >::value_type

Constructor & Destructor Documentation

template<int _Rank>
Concurrency::index< _Rank >::index ( )
inline

Default constructor, initializes all elements with 0.

74  {
75  details::_compound_assign_op_loop_helper<index<_Rank>, details::opAssign>::func(*this, 0);
76  }
Definition: xxamp.h:233
template<int _Rank>
Concurrency::index< _Rank >::index ( const index< _Rank > &  _Other)
inline

Copy Constructor.

Parameters
_OtherThe object to copy from
85  {
86  details::_compound_assign_op_loop_helper<index<_Rank>, details::opAssign>::func(*this, _Other);
87  }
Definition: xxamp.h:233
template<int _Rank>
Concurrency::index< _Rank >::index ( int  _I)
inlineexplicit

Constructor for index<1>

Parameters
_IThe value for initialization
96  {
97  static_assert(_Rank == 1, "This constructor can only be used to construct an index<1> object.");
98  details::_compound_assign_op_loop_helper<index<_Rank>, details::opAssign>::func(*this, _I);
99  }
Definition: xxamp.h:233
template<int _Rank>
Concurrency::index< _Rank >::index ( int  _I0,
int  _I1 
)
inline

Constructor for index<2>

Parameters
_I0The index value for dimension 0
_I1The index value for dimension 1
111  {
112  static_assert(_Rank == 2, "This constructor can only be used to construct an index<2> object.");
113  _M_base[0] = _I0;
114  _M_base[1] = _I1;
115  }
int _M_base[_Rank]
Definition: amp.h:359
template<int _Rank>
Concurrency::index< _Rank >::index ( int  _I0,
int  _I1,
int  _I2 
)
inline

Constructor for index<3>

Parameters
_I0The index value for dimension 0
_I1The index value for dimension 1
_I2The index value for dimension 2
130  {
131  static_assert(_Rank == 3, "This constructor can only be used to construct an index<3> object.");
132  _M_base[0] = _I0;
133  _M_base[1] = _I1;
134  _M_base[2] = _I2;
135  }
int _M_base[_Rank]
Definition: amp.h:359
template<int _Rank>
Concurrency::index< _Rank >::index ( const int  _Array[_Rank])
inlineexplicit

Constructs an index<N> with the coordinate values provided the array of int component values. If the coordinate array length is not N, the behavior is undefined.

Parameters
_ArrayA single-dimensional array with _Rank elements.
146  {
147  details::_compound_assign_op_loop_helper<index<_Rank>, details::opAssign>::func(*this, _Array);
148  }
Definition: xxamp.h:233
template<int _Rank>
Concurrency::index< _Rank >::index ( details::_eInitializeState  )
inlineprivate

Constructor.

Indicates that no initialization is necessary.

355 {}

Member Function Documentation

template<int _Rank>
Concurrency::index< _Rank >::_CPP_AMP_VERIFY_RANK ( _Rank  ,
index< _Rank >   
)
template<int _Rank>
index<_Rank>& Concurrency::index< _Rank >::operator%= ( int  _Rhs)
inline

Modulus an integer value into each element of this index.

Parameters
_RhsThe integer value to modulus.
Returns
A reference to this index.
289  {
290  details::_compound_assign_op_loop_helper<index<_Rank>, details::opModEq>::func(*this, _Rhs);
291  return *this;
292  }
Definition: xxamp.h:238
template<int _Rank>
index<_Rank>& Concurrency::index< _Rank >::operator*= ( int  _Rhs)
inline

Multiplies each element of this index with an integer value.

Parameters
_RhsThe integer value to multiply.
Returns
A reference to this index.
259  {
260  details::_compound_assign_op_loop_helper<index<_Rank>, details::opMulEq>::func(*this, _Rhs);
261  return *this;
262  }
Definition: xxamp.h:236
template<int _Rank>
index<_Rank>& Concurrency::index< _Rank >::operator++ ( )
inline

Pre-increments each element of this index.

Returns
A reference to this index.
301  {
302  details::_compound_assign_op_loop_helper<index<_Rank>, details::opAddEq>::func(*this, 1);
303  return *this;
304  }
Definition: xxamp.h:234
template<int _Rank>
index<_Rank> Concurrency::index< _Rank >::operator++ ( int  )
inline

Post-increments each element of this index.

Returns
The value of the unincremented index.
313  {
314  index<_Rank> old_Index(*this);
315  details::_compound_assign_op_loop_helper<index<_Rank>, details::opAddEq>::func(*this, 1);
316  return old_Index;
317  }
Definition: xxamp.h:234
template<int _Rank>
index<_Rank>& Concurrency::index< _Rank >::operator+= ( const index< _Rank > &  _Rhs)
inline

Element-wise addition of this index with another index.

Parameters
_RhsThe index to add
Returns
A reference to this index.
199  {
200  details::_compound_assign_op_loop_helper<index<_Rank>, details::opAddEq>::func(*this, _Rhs);
201  return *this;
202  }
Definition: xxamp.h:234
template<int _Rank>
index<_Rank>& Concurrency::index< _Rank >::operator+= ( int  _Rhs)
inline

Adds an integer value to each element of this index.

Parameters
_RhsThe integer value to add
Returns
A reference to this index.
229  {
230  details::_compound_assign_op_loop_helper<index<_Rank>, details::opAddEq>::func(*this, _Rhs);
231  return *this;
232  }
Definition: xxamp.h:234
template<int _Rank>
index<_Rank>& Concurrency::index< _Rank >::operator-- ( )
inline

Pre-decrements each element of this index.

Returns
A reference to this index.
326  {
327  details::_compound_assign_op_loop_helper<index<_Rank>, details::opSubEq>::func(*this, 1);
328  return *this;
329  }
Definition: xxamp.h:235
template<int _Rank>
index Concurrency::index< _Rank >::operator-- ( int  )
inline

Post-decrements each element of this index.

Returns
The value of the undecremented index.
338  {
339  index<_Rank> old_Index(*this);
340  details::_compound_assign_op_loop_helper<index<_Rank>, details::opSubEq>::func(*this, 1);
341  return old_Index;
342  }
Definition: xxamp.h:235
template<int _Rank>
index<_Rank>& Concurrency::index< _Rank >::operator-= ( const index< _Rank > &  _Rhs)
inline

Element-wise subtraction of this index with another index.

Parameters
_RhsThe index to subtract
Returns
A reference to this index.
214  {
215  details::_compound_assign_op_loop_helper<index<_Rank>, details::opSubEq>::func(*this, _Rhs);
216  return *this;
217  }
Definition: xxamp.h:235
template<int _Rank>
index<_Rank>& Concurrency::index< _Rank >::operator-= ( int  _Rhs)
inline

Subtracts an integer value from each element of this index.

Parameters
_RhsThe integer value to subtract.
Returns
A reference to this index.
244  {
245  details::_compound_assign_op_loop_helper<index<_Rank>, details::opSubEq>::func(*this, _Rhs);
246  return *this;
247  }
Definition: xxamp.h:235
template<int _Rank>
index<_Rank>& Concurrency::index< _Rank >::operator/= ( int  _Rhs)
inline

Divides each element of this index by an integer value.

Parameters
_RhsThe integer value to divide by.
Returns
A reference to this index.
274  {
275  details::_compound_assign_op_loop_helper<index<_Rank>, details::opDivEq>::func(*this, _Rhs);
276  return *this;
277  }
Definition: xxamp.h:237
template<int _Rank>
index<_Rank>& Concurrency::index< _Rank >::operator= ( const index< _Rank > &  _Other)
inline

copy-assignment operators

154  {
155  details::_compound_assign_op_loop_helper<index<_Rank>, details::opAssign>::func(*this, _Other);
156  return *this;
157  }
Definition: xxamp.h:233
template<int _Rank>
int Concurrency::index< _Rank >::operator[] ( unsigned  _Index) const
inline

Index operator.

Parameters
_IndexAn integral value between 0 and _Rank-1.
Returns
The corresponding value stored at _Index.
169  {
170  return _M_base[_Index];
171  }
_In_ size_t _In_ int _Index
Definition: time.h:102
int _M_base[_Rank]
Definition: amp.h:359
template<int _Rank>
int& Concurrency::index< _Rank >::operator[] ( unsigned  _Index)
inline

Index operator.

Parameters
_IndexAn integral value between 0 and _Rank-1.
Returns
A reference to the corresponding value stored at _Index.
183  {
184  return _M_base[_Index];
185  }
_In_ size_t _In_ int _Index
Definition: time.h:102
int _M_base[_Rank]
Definition: amp.h:359

Friends And Related Function Documentation

template<int _Rank>
template<typename _Value_type , int _Rank>
friend class array
friend
template<int _Rank>
template<int _Rank, int _Element_size>
friend class details::_Array_view_base
friend
template<int _Rank>
template<int _Rank, int _Element_size>
friend class details::_Array_view_shape
friend
template<int _Rank>
template<class _Tuple_type >
_Tuple_type details::_Create_uninitialized_tuple ( )
friend

Member Data Documentation

template<int _Rank>
int Concurrency::index< _Rank >::_M_base[_Rank]
private
template<int _Rank>
const int Concurrency::index< _Rank >::rank = _Rank
static

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