C/C++ API Reference
Loading...
Searching...
No Matches
pw::async2::FutureState Class Reference

Overview

Standard pw_async2 future states. Used by FutureCore and may be used by custom future implementations.

Public Types

enum  Pending { kPending }
 Tag for constructing an active future, for which Pend may be called.
 
enum  ReadyForCompletion { kReadyForCompletion }
 

Public Member Functions

constexpr FutureState ()
 
constexpr FutureState (Pending)
 Represents an active future, for which Pend may be called.
 
constexpr FutureState (ReadyForCompletion)
 
constexpr FutureState (const FutureState &)=delete
 
constexpr FutureStateoperator= (const FutureState &)=delete
 
constexpr FutureState (FutureState &&other)
 
constexpr FutureStateoperator= (FutureState &&other)
 
constexpr bool is_pendable () const
 
constexpr bool is_complete () const
 
constexpr bool is_ready () const
 
constexpr bool is_initialized () const
 
void MarkReady ()
 
void MarkComplete ()
 

Friends

constexpr bool operator== (const FutureState &lhs, const FutureState &rhs)
 
constexpr bool operator!= (const FutureState &lhs, const FutureState &rhs)
 

Member Enumeration Documentation

◆ ReadyForCompletion

Tag for constructing a future that is guaranteed to return Ready from the next Pend call.

Constructor & Destructor Documentation

◆ FutureState() [1/3]

constexpr pw::async2::FutureState::FutureState ( )
inlineconstexpr

Represents an empty future. The future does not yet represent an asynchronous operation and Pend may not be called.

◆ FutureState() [2/3]

constexpr pw::async2::FutureState::FutureState ( ReadyForCompletion  )
inlineconstexpr

Represents a future that is guaranteed to return Ready from the next Pend call. Use of the ReadyForCompletion" state is optional---future implementations may skip fromPendingtoComplete` if desired.

◆ FutureState() [3/3]

constexpr pw::async2::FutureState::FutureState ( FutureState &&  other)
inlineconstexpr

Move constructs a FutureState, leaving the other in its default constructed / empty state.

Member Function Documentation

◆ is_complete()

constexpr bool pw::async2::FutureState::is_complete ( ) const
inlineconstexpr
Returns
Whether the future has completed: the future's Pend() returned Ready.

◆ is_initialized()

constexpr bool pw::async2::FutureState::is_initialized ( ) const
inlineconstexpr
Returns
true if the future was NOT default constructed. The future either represents an active or completed asynchronous operation.

◆ is_pendable()

constexpr bool pw::async2::FutureState::is_pendable ( ) const
inlineconstexpr
Returns
Whether the future's Pend() function can be called.

◆ is_ready()

constexpr bool pw::async2::FutureState::is_ready ( ) const
inlineconstexpr
Returns
true if the next Pend() call is guaranteed to return Ready. Not all future implementations use the ready state; Pend() may return Ready even though is_ready is false.

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