Pigweed
 
Loading...
Searching...
No Matches
pw::async2::Poll< T > Class Template Reference

#include <poll.h>

Public Types

using OutputType = T
 

Public Member Functions

 Poll ()=delete
 Basic constructors.
 
constexpr Poll (const Poll &)=default
 
constexpr Polloperator= (const Poll &)=default
 
constexpr Poll (Poll &&)=default
 
constexpr Polloperator= (Poll &&)=default
 
template<typename U , internal_poll::EnableIfImplicitlyConvertible< T, const U & > = 0>
constexpr Poll (const Poll< U > &other)
 
template<typename U , internal_poll::EnableIfExplicitlyConvertible< T, const U & > = 0>
constexpr Poll (const Poll< U > &other)
 
template<typename U , internal_poll::EnableIfImplicitlyConvertible< T, U && > = 0>
constexpr Poll (Poll< U > &&other)
 
template<typename U , internal_poll::EnableIfExplicitlyConvertible< T, U && > = 0>
constexpr Poll (Poll< U > &&other)
 
template<typename U = T, internal_poll::EnableIfImplicitlyInitializable< T, U > = 0>
constexpr Poll (U &&u)
 
template<typename U = T, internal_poll::EnableIfExplicitlyInitializable< T, U > = 0>
constexpr Poll (U &&u)
 
template<typename... Args>
constexpr Poll (std::in_place_t, Args &&... args)
 
constexpr Poll (T &&value)
 
constexpr Polloperator= (T &&value)
 
constexpr Poll (PendingType) noexcept
 
constexpr Polloperator= (PendingType) noexcept
 
constexpr bool IsReady () const noexcept
 Returns whether or not this value is Ready.
 
constexpr bool IsPending () const noexcept
 Returns whether or not this value is Pending.
 
constexpr Poll Readiness () const noexcept
 
constexpr T & value () &noexcept
 
constexpr const T & value () const &noexcept
 
constexpr T && value () &&noexcept
 
constexpr const T && value () const &&noexcept
 
constexpr const T * operator-> () const noexcept
 
constexpr T * operator-> () noexcept
 
constexpr const T & operator* () const &noexcept
 
constexpr T & operator* () &noexcept
 
constexpr const T && operator* () const &&noexcept
 
constexpr T && operator* () &&noexcept
 
constexpr void IgnorePoll () const
 

Detailed Description

template<typename T = ReadyType>
class pw::async2::Poll< T >

A value that may or may not be ready yet.

Poll<T> most commonly appears as the return type of an function that checks the current status of an asynchronous operation. If the operation has completed, it returns with Ready(value). Otherwise, it returns Pending to indicate that the operations has not yet completed, and the caller should try again in the future.

Poll<T> itself is "plain old data" and does not change on its own. To check the current status of an operation, the caller must invoke the Poll<T> returning function again and examine the newly returned Poll<T>.

Constructor & Destructor Documentation

◆ Poll()

template<typename T = ReadyType>
template<typename U , internal_poll::EnableIfImplicitlyConvertible< T, const U & > = 0>
constexpr pw::async2::Poll< T >::Poll ( const Poll< U > &  other)
inlineconstexpr

Constructs a new Poll<T> from a Poll<U> where T is constructible from U.

To avoid ambiguity, this constructor is disabled if T is also constructible from Poll<U>.

This constructor is explicit if and only if the corresponding construction of T from U is explicit.

Member Function Documentation

◆ IgnorePoll()

template<typename T = ReadyType>
constexpr void pw::async2::Poll< T >::IgnorePoll ( ) const
inlineconstexpr

Ignores the Poll value.

This method does nothing except prevent no_discard or unused variable warnings from firing.

◆ operator*()

template<typename T = ReadyType>
constexpr const T & pw::async2::Poll< T >::operator* ( ) const &
inlineconstexprnoexcept

Returns the inner value.

This must only be called if IsReady() returned true.

◆ operator->()

template<typename T = ReadyType>
constexpr const T * pw::async2::Poll< T >::operator-> ( ) const
inlineconstexprnoexcept

Accesses the inner value.

This must only be called if IsReady() returned true.

◆ Readiness()

template<typename T = ReadyType>
constexpr Poll pw::async2::Poll< T >::Readiness ( ) const
inlineconstexprnoexcept

Returns a Poll<> without the inner value whose readiness matches that of this.

◆ value()

template<typename T = ReadyType>
constexpr T & pw::async2::Poll< T >::value ( ) &
inlineconstexprnoexcept

Returns the inner value.

This must only be called if IsReady() returned true.


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