All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Radiant::FutureBool Class Reference

This class provides implicit conversion to boolean type. More...

#include <Radiant/FutureBool.hpp>

Public Member Functions

 FutureBool (bool value)
 Constructs a FutureBool object whose value is already known at this point. More...
 
 FutureBool (FutureBoolIPtr future)
 Constructs a FutureBool object from FutureBoolIPtr. More...
 
 FutureBool (FutureBool &&f)
 Move the given FutureBool object. More...
 
 operator bool ()
 Implicit conversion to boolean. More...
 
FutureBooloperator= (FutureBool &&f)
 Move the given FutureBool object. More...
 

Detailed Description

This class provides implicit conversion to boolean type.

The class is used to provide asynchronous return values from functions. By invoking a function that returns a FutureBool-instance, the invoker can choose if he wants to wait for the return value by evaluating the value of the FutureBool. In case the value is never evaluated the function is run asynchronously.

This behaviour and usage pattern is very similar to std::future. See also MultiWidgets::ImageWidget::load

Constructor & Destructor Documentation

Radiant::FutureBool::FutureBool ( bool  value)
inline

Constructs a FutureBool object whose value is already known at this point.

Parameters
valueValue to return when converting this object to boolean
Radiant::FutureBool::FutureBool ( FutureBoolIPtr  future)
inline

Constructs a FutureBool object from FutureBoolIPtr.

Parameters
futureClass-specific implementation of FutureBoolI-interface.
Radiant::FutureBool::FutureBool ( FutureBool &&  f)
inline

Move the given FutureBool object.

Parameters
fFutureBool to move

Member Function Documentation

Radiant::FutureBool::operator bool ( )
inline

Implicit conversion to boolean.

This function will block until the value of the future has been set.

Returns
boolean value
FutureBool& Radiant::FutureBool::operator= ( FutureBool &&  f)
inline

Move the given FutureBool object.

Parameters
fFutureBool to move