HCC
HCC is a single-source, C/C++ compiler for heterogeneous computing. It's optimized with HSA (http://www.hsafoundation.com/).
Public Member Functions | Friends | List of all members
Concurrency::completion_future Class Reference

This class is the return type of all C++ AMP asynchronous APIs and has an interface analogous to std::shared_future<void>. More...

#include <amp.h>

Collaboration diagram for Concurrency::completion_future:
Collaboration graph

Public Member Functions

 completion_future ()
 Default constructor. More...
 
 completion_future (const completion_future &other)
 Copy constructor. More...
 
 completion_future (completion_future &&other)
 Move constructor. More...
 
completion_futureoperator= (const completion_future &other)
 Copy assignment. More...
 
completion_futureoperator= (completion_future &&other)
 Move assignment. More...
 
void get () const
 This method is functionally identical to std::shared_future<void>::get. More...
 
bool valid () const
 This method is functionally identical to std::shared_future<void>::valid. More...
 
 operator std::shared_future< void > () const
 Conversion operator to std::shared_future<void>. More...
 
template<typename functor >
void then (const functor &func)
 This method enables specification of a completion callback func which is executed upon completion of the asynchronous operation associated with this completion_future object. More...
 
void wait () const
 These methods are functionally identical to the corresponding std::shared_future<void> methods. More...
 
template<class _Rep , class _Period >
std::future_status wait_for (const std::chrono::duration< _Rep, _Period > &_Rel_time) const
 These methods are functionally identical to the corresponding std::shared_future<void> methods. More...
 
template<class _Clock , class _Duration >
std::future_status wait_until (const std::chrono::time_point< _Clock, _Duration > &_Abs_time) const
 These methods are functionally identical to the corresponding std::shared_future<void> methods. More...
 

Friends

template<typename T , int N>
class array_view
 
template<typename T , int N>
completion_future copy_async (const array_view< const T, N > &src, const array_view< T, N > &dest)
 The contents of "src" are copied into "dest". More...
 
template<typename T , int N>
completion_future copy_async (const array< T, N > &src, array< T, N > &dest)
 The contents of "src" are copied into "dest". More...
 
template<typename T , int N>
completion_future copy_async (const array< T, N > &src, const array_view< T, N > &dest)
 The contents of "src" are copied into "dest". More...
 
template<typename T , int N>
completion_future copy_async (const array_view< T, N > &src, const array_view< T, N > &dest)
 
template<typename T , int N>
completion_future copy_async (const array_view< const T, N > &src, array< T, N > &dest)
 The contents of "src" are copied into "dest". More...
 
template<typename InputIter , typename T , int N>
completion_future copy_async (InputIter srcBegin, InputIter srcEnd, array< T, N > &dest)
 The contents of a source container from the iterator range [srcBegin,srcEnd) are copied into "dest". More...
 
template<typename InputIter , typename T , int N>
completion_future copy_async (InputIter srcBegin, InputIter srcEnd, const array_view< T, N > &dest)
 The contents of a source container from the iterator range [srcBegin,srcEnd) are copied into "dest". More...
 
template<typename InputIter , typename T , int N>
completion_future copy_async (InputIter srcBegin, array< T, N > &dest)
 
template<typename InputIter , typename T , int N>
completion_future copy_async (InputIter srcBegin, const array_view< T, N > &dest)
 
template<typename OutputIter , typename T , int N>
completion_future copy_async (const array< T, N > &src, OutputIter destBegin)
 The contents of a source array are copied into "dest" starting with iterator destBegin. More...
 
template<typename OutputIter , typename T , int N>
completion_future copy_async (const array_view< T, N > &src, OutputIter destBegin)
 The contents of a source array are copied into "dest" starting with iterator destBegin. More...
 

Detailed Description

This class is the return type of all C++ AMP asynchronous APIs and has an interface analogous to std::shared_future<void>.

Similar to std::shared_future, this type provides member methods such as wait and get to wait for C++ AMP asynchronous operations to finish, and the type additionally provides a member method then(), to specify a completion callback functor to be executed upon completion of a C++ AMP asynchronous operation.

Constructor & Destructor Documentation

Concurrency::completion_future::completion_future ( )
inline

Default constructor.

Constructs an empty uninitialized completion_future object which does not refer to any asynchronous operation. Default constructed completion_future objects have valid() == false

Concurrency::completion_future::completion_future ( const completion_future other)
inline

Copy constructor.

Constructs a new completion_future object that referes to the same asynchronous operation as the other completion_future object.

Parameters
[in]otherAn object of type completion_future from which to initialize this.
Concurrency::completion_future::completion_future ( completion_future &&  other)
inline

Move constructor.

Move constructs a new completion_future object that referes to the same asynchronous operation as originally refered by the other completion_future object. After this constructor returns, other.valid() == false

Parameters
[in]otherAn object of type completion_future which the new completion_future

Member Function Documentation

void Concurrency::completion_future::get ( ) const
inline

This method is functionally identical to std::shared_future<void>::get.

This method waits for the associated asynchronous operation to finish and returns only upon the completion of the asynchronous operation. If an exception was encountered during the execution of the asynchronous operation, this method throws that stored exception.

Concurrency::completion_future::operator std::shared_future< void > ( ) const
inline

Conversion operator to std::shared_future<void>.

This method returns a shared_future<void> object corresponding to this completion_future object and refers to the same asynchronous operation.

completion_future& Concurrency::completion_future::operator= ( const completion_future other)
inline

Copy assignment.

Copy assigns the contents of other to this. This method causes this to stop referring its current asynchronous operation and start referring the same asynchronous operation as other.

Parameters
[in]otherAn object of type completion_future which is copy assigned to this.
completion_future& Concurrency::completion_future::operator= ( completion_future &&  other)
inline

Move assignment.

Move assigns the contents of other to this. This method causes this to stop referring its current asynchronous operation and start referring the same asynchronous operation as other. After this method returns, other.valid() == false

Parameters
[in]otherAn object of type completion_future which is move assigned to this.
template<typename functor >
void Concurrency::completion_future::then ( const functor &  func)
inline

This method enables specification of a completion callback func which is executed upon completion of the asynchronous operation associated with this completion_future object.

The completion callback func should have an operator() that is valid when invoked with non arguments, i.e., "func()".

References Concurrency::copy_async().

bool Concurrency::completion_future::valid ( ) const
inline

This method is functionally identical to std::shared_future<void>::valid.

This returns true if this completion_future is associated with an asynchronous operation.

void Concurrency::completion_future::wait ( ) const
inline

These methods are functionally identical to the corresponding std::shared_future<void> methods.

The wait method waits for the associated asynchronous operation to finish and returns only upon completion of the associated asynchronous operation or if an exception was encountered when executing the asynchronous operation.

The other variants are functionally identical to the std::shared_future<void> member methods with same names.

template<class _Rep , class _Period >
std::future_status Concurrency::completion_future::wait_for ( const std::chrono::duration< _Rep, _Period > &  _Rel_time) const
inline

These methods are functionally identical to the corresponding std::shared_future<void> methods.

The wait method waits for the associated asynchronous operation to finish and returns only upon completion of the associated asynchronous operation or if an exception was encountered when executing the asynchronous operation.

The other variants are functionally identical to the std::shared_future<void> member methods with same names.

template<class _Clock , class _Duration >
std::future_status Concurrency::completion_future::wait_until ( const std::chrono::time_point< _Clock, _Duration > &  _Abs_time) const
inline

These methods are functionally identical to the corresponding std::shared_future<void> methods.

The wait method waits for the associated asynchronous operation to finish and returns only upon completion of the associated asynchronous operation or if an exception was encountered when executing the asynchronous operation.

The other variants are functionally identical to the std::shared_future<void> member methods with same names.

Friends And Related Function Documentation

template<typename T , int N>
completion_future copy_async ( const array_view< const T, N > &  src,
const array_view< T, N > &  dest 
)
friend

The contents of "src" are copied into "dest".

If the extents of "src" and "dest" don't match, a runtime exception is thrown.

Parameters
[in]srcAn object of type array_view<T,N> (or array_view<const T, N>) to be copied from.
[out]destAn object of type array_view<T,N> to be copied to.
template<typename T , int N>
completion_future copy_async ( const array< T, N > &  src,
array< T, N > &  dest 
)
friend

The contents of "src" are copied into "dest".

The source and destination may reside on different accelerators. If the extents of "src" and "dest" don't match, a runtime exception is thrown.

Parameters
[in]srcAn object of type array<T,N> to be copied from.
[out]destAn object of type array<T,N> to be copied to.
template<typename T , int N>
completion_future copy_async ( const array< T, N > &  src,
const array_view< T, N > &  dest 
)
friend

The contents of "src" are copied into "dest".

If the extents of "src" and "dest" don't match, a runtime exception is thrown.

Parameters
[in]srcAn object of type array<T,N> to be copied from.
[out]destAn object of type array_view<T,N> to be copied to.
template<typename T , int N>
completion_future copy_async ( const array_view< const T, N > &  src,
array< T, N > &  dest 
)
friend

The contents of "src" are copied into "dest".

If the extents of "src" and "dest" don't match, a runtime exception is thrown.

Parameters
[in]srcAn object of type array_view<T,N> (or array_view<const T, N>) to be copied from.
[out]destAn object of type array<T,N> to be copied to.
template<typename InputIter , typename T , int N>
completion_future copy_async ( InputIter  srcBegin,
InputIter  srcEnd,
array< T, N > &  dest 
)
friend

The contents of a source container from the iterator range [srcBegin,srcEnd) are copied into "dest".

If the number of elements in the iterator range is not equal to "dest.extent.size()", an exception is thrown.

In the overloads which don't take an end-iterator it is assumed that the source iterator is able to provide at least dest.extent.size() elements, but no checking is performed (nor possible).

Parameters
[in]srcBeginAn iterator to the first element of a source container.
[in]srcEndAn interator to the end of a source container.
[out]destAn object of type array<T,N> to be copied to.
template<typename InputIter , typename T , int N>
completion_future copy_async ( InputIter  srcBegin,
InputIter  srcEnd,
const array_view< T, N > &  dest 
)
friend

The contents of a source container from the iterator range [srcBegin,srcEnd) are copied into "dest".

If the number of elements in the iterator range is not equal to "dest.extent.size()", an exception is thrown.

In the overloads which don't take an end-iterator it is assumed that the source iterator is able to provide at least dest.extent.size() elements, but no checking is performed (nor possible).

Parameters
[in]srcBeginAn iterator to the first element of a source container.
[in]srcEndAn interator to the end of a source container.
[out]destAn object of type array_view<T,N> to be copied to.
template<typename OutputIter , typename T , int N>
completion_future copy_async ( const array< T, N > &  src,
OutputIter  destBegin 
)
friend

The contents of a source array are copied into "dest" starting with iterator destBegin.

If the number of elements in the range starting destBegin in the destination container is smaller than "src.extent.size()", the behavior is undefined.

Parameters
[in]srcAn object of type array<T,N> to be copied from.
[out]destBeginAn output iterator addressing the position of the first element in the destination container.
template<typename OutputIter , typename T , int N>
completion_future copy_async ( const array_view< T, N > &  src,
OutputIter  destBegin 
)
friend

The contents of a source array are copied into "dest" starting with iterator destBegin.

If the number of elements in the range starting destBegin in the destination container is smaller than "src.extent.size()", the behavior is undefined.

Parameters
[in]srcAn object of type array_view<T,N> to be copied from.
[out]destBeginAn output iterator addressing the position of the first element in the destination container.

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