Edit

Share via


extent Class (C++ AMP)

Represents a vector of N integer values that specify the bounds of an N-dimensional space that has an origin of 0. The values in the vector are ordered from most significant to least significant.

Syntax

template <int _Rank>
class extent;

Parameters

_Rank
The rank of the extent object.

Requirements

Header: amp.h

Namespace: Concurrency

Members

Public Constructors

Name Description
extent Constructor Initializes a new instance of the extent class.

Public Methods

Name Description
contains Verifies that the specified extent object has the specified rank.
size Returns the total linear size of the extent (in units of elements).
tile Produces a tiled_extent object with the tile extents given by specified dimensions.

Public Operators

Name Description
operator- Returns a new extent object that's created by subtracting the index elements from the corresponding extent elements.
operator-- Decrements each element of the extent object.
operator%= Calculates the modulus (remainder) of each element in the extent object when that element is divided by a number.
operator*= Multiplies each element of the extent object by a number.
operator/= Divides each element of the extent object by a number.
extent::operator[] Returns the element that's at the specified index.
operator+ Returns a new extent object that's created by adding the corresponding index and extent elements.
operator++ Increments each element of the extent object.
operator+= Adds the specified number to each element of the extent object.
operator= Copies the contents of another extent object into this one.
operator-= Subtracts the specified number from each element of the extent object.

Public Constants

Name Description
rank Constant Gets the rank of the extent object.

Inheritance Hierarchy

extent

contains

Indicates whether the specified index value is contained within the extent object.

Syntax

bool contains(const index<rank>& _Index) const restrict(amp,cpu);

Parameters

_Index
The index value to test.

Return Value

true if the specified index value is contained in the extent object; otherwise, false.

extent

Initializes a new instance of the extent class.

Syntax

extent() restrict(amp,cpu);
extent(const extent<_Rank>& _Other) restrict(amp,cpu);
explicit extent(int _I) restrict(amp,cpu);
extent(int _I0,  int _I1) restrict(amp,cpu);
extent(int _I0,  int _I1, int _I2) restrict(amp,cpu);
explicit extent(const int _Array[_Rank])restrict(amp,cpu);

Parameters

_Array
An array of _Rank integers that is used to create the new extent object.

_I
The length of the extent.

_I0
The length of the most significant dimension.

_I1
The length of the next-to-most-significant dimension.

_I2
The length of the least significant dimension.

_Other
An extent object on which the new extent object is based.

Remarks

The default constructor initializes an extent object that has a rank of three.

If an array is used to construct an extent object, the length of the array must match the rank of the extent object.

operator%=

Calculates the modulus (remainder) of each element in the extent when that element is divided by a number.

Syntax

extent<_Rank>& operator%=(int _Rhs) restrict(cpu, direct3d);

Parameters

_Rhs
The number to find the modulus of.

Return Value

The extent object.

operator*=

Multiplies each element in the extent object by the specified number.

Syntax

extent<_Rank>& operator*=(int _Rhs) restrict(amp,cpu);

Parameters

_Rhs
The number to multiply.

Return Value

The extent object.

operator+

Returns a new extent object created by adding the corresponding index and extent elements.

Syntax

extent<_Rank> operator+(const index<_Rank>& _Rhs) restrict(amp,cpu);

Parameters

_Rhs
The index object that contains the elements to add.

Return Value

The new extent object.

operator++

Increments each element of the extent object.

Syntax

extent<_Rank>& operator++() restrict(amp,cpu);
extent<_Rank> operator++(int)restrict(amp,cpu);

Return Value

For the prefix operator, the extent object (*this). For the suffix operator, a new extent object.

operator+=

Adds the specified number to each element of the extent object.

Syntax

extent<_Rank>& operator+=(const extent<_Rank>& _Rhs) restrict(amp,cpu);
extent<_Rank>& operator+=(const index<_Rank>& _Rhs) restrict(amp,cpu);
extent<_Rank>& operator+=(int _Rhs) restrict(amp,cpu);

Parameters

_Rhs
The number, index, or extent to add.

Return Value

The resulting extent object.

operator-

Creates a new extent object by subtracting each element in the specified index object from the corresponding element in this extent object.

Syntax

extent<_Rank> operator-(const index<_Rank>& _Rhs) restrict(amp,cpu);

Parameters

_Rhs
The index object that contains the elements to subtract.

Return Value

The new extent object.

operator--

Decrements each element in the extent object.

Syntax

extent<_Rank>& operator--() restrict(amp,cpu);
extent<_Rank> operator--(int)restrict(amp,cpu);

Return Value

For the prefix operator, the extent object (*this). For the suffix operator, a new extent object.

operator/=

Divides each element in the extent object by the specified number.

Syntax

extent<_Rank>& operator/=(int _Rhs) restrict(amp,cpu);

Parameters

_Rhs
The number to divide by.

Return Value

The extent object.

operator-=

Subtracts the specified number from each element of the extent object.

Syntax

extent<_Rank>& operator-=(const extent<_Rank>& _Rhs) restrict(amp,cpu);
extent<_Rank>& operator-=(const index<_Rank>& _Rhs) restrict(amp,cpu);
extent<_Rank>& operator-=(int _Rhs) restrict(amp,cpu);

Parameters

_Rhs
The number to subtract.

Return Value

The resulting extent object.

operator=

Copies the contents of another extent object into this one.

Syntax

extent<_Rank>& operator=(const extent<_Rank>& _Other) restrict(amp,cpu);

Parameters

_Other
The extent object to copy from.

Return Value

A reference to this extent object.

extent::operator []

Returns the element that's at the specified index.

Syntax

int operator[](unsigned int _Index) const restrict(amp,cpu);
int& operator[](unsigned int _Index) restrict(amp,cpu);

Parameters

_Index
An integer from 0 through the rank minus 1.

Return Value

The element that's at the specified index.

rank

Stores the rank of the extent object.

Syntax

static const int rank = _Rank;

size

Returns the total linear size of the extent object (in units of elements).

Syntax

unsigned int size() const restrict(amp,cpu);

tile

Produces a tiled_extent object with the specified tile dimensions.

template <int _Dim0>
tiled_extent<_Dim0> tile() const ;

template <int _Dim0, int _Dim1>
tiled_extent<_Dim0, _Dim1> tile() const ;

template <int _Dim0, int _Dim1, int _Dim2>
tiled_extent<_Dim0, _Dim1, _Dim2> tile() const ;

Parameters

_Dim0
The most significant component of the tiled extent. _Dim1
The next-to-most-significant component of the tiled extent. _Dim2
The least significant component of the tiled extent.

See also

Concurrency Namespace (C++ AMP)