Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
uni20::async::FutureValue< T > Class Template Reference

Write-once async value wrapper that retains a pending write buffer. More...

#include <future_value.hpp>

Public Types

using value_type = T
 

Public Member Functions

Async< T > const & async () const noexcept
 Access the wrapped Async value as read-only.
 
 FutureValue ()
 Construct a new, uninitialized FutureValue.
 
 FutureValue (FutureValue &&) noexcept=default
 Move constructor.
 
 FutureValue (FutureValue const &)=delete
 Non-copyable.
 
template<typename U >
FutureValue & operator= (Async< U > &&v)
 Move-assign from another async source by scheduling an async move.
 
template<typename U >
FutureValue & operator= (Async< U > const &v)
 Assign from another async source by scheduling an async copy.
 
FutureValue & operator= (FutureValue &&) noexcept=default
 Move assignment.
 
template<typename U >
requires std::constructible_from<T, U&&>
FutureValue & operator= (U &&v)
 Assign a value immediately into the retained write buffer.
 
ReadBuffer< T > read () const
 Get a read buffer from the wrapped Async value.
 
Async< T > & value ()
 Mutable access to the wrapped Async value.
 
Async< T > const & value () const
 Const access to the wrapped Async value.
 
WriteBuffer< T > write () noexcept
 Get the retained write buffer.
 

Detailed Description

template<typename T>
class uni20::async::FutureValue< T >

Write-once async value wrapper that retains a pending write buffer.

Template Parameters
TStored value type.

Member Typedef Documentation

◆ value_type

template<typename T >
using uni20::async::FutureValue< T >::value_type = T

Constructor & Destructor Documentation

◆ FutureValue() [1/3]

template<typename T >
uni20::async::FutureValue< T >::FutureValue ( )
inline

Construct a new, uninitialized FutureValue.

◆ FutureValue() [2/3]

template<typename T >
uni20::async::FutureValue< T >::FutureValue ( FutureValue< T > &&  )
defaultnoexcept

Move constructor.

◆ FutureValue() [3/3]

template<typename T >
uni20::async::FutureValue< T >::FutureValue ( FutureValue< T > const &  )
delete

Non-copyable.

Member Function Documentation

◆ async()

template<typename T >
Async< T > const & uni20::async::FutureValue< T >::async ( ) const
inlinenoexcept

Access the wrapped Async value as read-only.

Returns
Const reference to the wrapped Async value.

◆ operator=() [1/4]

template<typename T >
template<typename U >
FutureValue & uni20::async::FutureValue< T >::operator= ( Async< U > &&  v)
inline

Move-assign from another async source by scheduling an async move.

Template Parameters
USource value type.
Parameters
vSource async value.
Returns
Reference to *this.

◆ operator=() [2/4]

template<typename T >
template<typename U >
FutureValue & uni20::async::FutureValue< T >::operator= ( Async< U > const &  v)
inline

Assign from another async source by scheduling an async copy.

Template Parameters
USource value type.
Parameters
vSource async value.
Returns
Reference to *this.

◆ operator=() [3/4]

template<typename T >
FutureValue & uni20::async::FutureValue< T >::operator= ( FutureValue< T > &&  )
defaultnoexcept

Move assignment.

◆ operator=() [4/4]

template<typename T >
template<typename U >
requires std::constructible_from<T, U&&>
FutureValue & uni20::async::FutureValue< T >::operator= ( U &&  v)
inline

Assign a value immediately into the retained write buffer.

Template Parameters
USource type constructible as T.
Parameters
vSource value.
Returns
Reference to *this.

◆ read()

template<typename T >
ReadBuffer< T > uni20::async::FutureValue< T >::read ( ) const
inline

Get a read buffer from the wrapped Async value.

Returns
Read buffer for the wrapped Async value.

◆ value() [1/2]

template<typename T >
Async< T > & uni20::async::FutureValue< T >::value ( )
inline

Mutable access to the wrapped Async value.

Returns
Reference to the underlying Async.

◆ value() [2/2]

template<typename T >
Async< T > const & uni20::async::FutureValue< T >::value ( ) const
inline

Const access to the wrapped Async value.

Returns
Const reference to the underlying Async.

◆ write()

template<typename T >
WriteBuffer< T > uni20::async::FutureValue< T >::write ( )
inlinenoexcept

Get the retained write buffer.

Returns
Write buffer that can be used once before release.

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