Tkrzw
Public Member Functions | List of all members
tkrzw::StatusFuture Class Referencefinal

Wrapper of std::future containing a status object and extra data. More...

#include <tkrzw_dbm_async.h>

Public Member Functions

 StatusFuture (std::future< Status > &&future)
 Constructor for a status object. More...
 
 StatusFuture (std::future< std::pair< Status, std::string >> &&future)
 Constructor for a status object and a string. More...
 
 StatusFuture (std::future< std::pair< Status, std::pair< std::string, std::string >>> &&future)
 Constructor for a status object and a string pair. More...
 
 StatusFuture (std::future< std::pair< Status, std::vector< std::string >>> &&future)
 Constructor for a status object and a string vector. More...
 
 StatusFuture (std::future< std::pair< Status, std::map< std::string, std::string >>> &&future)
 Constructor for a status object and a string map. More...
 
 StatusFuture (std::future< std::pair< Status, int64_t >> &&future)
 Constructor for a status object and an integer. More...
 
 StatusFuture (StatusFuture &&rhs)
 Move constructor. More...
 
 ~StatusFuture ()
 Destructor. More...
 
 StatusFuture (const StatusFuture &rhs)=delete
 Copy and assignment are disabled. More...
 
StatusFutureoperator= (const StatusFuture &rhs)=delete
 
bool Wait (double timeout=-1)
 Waits for the operation to be done. More...
 
Status Get ()
 Waits for the operation to be done and gets the result status. More...
 
std::pair< Status, std::string > GetString ()
 Waits for the operation to be done and gets the status and the extra string. More...
 
std::pair< Status, std::pair< std::string, std::string > > GetStringPair ()
 Waits for the operation to be done and gets the status and the extra string pair. More...
 
std::pair< Status, std::vector< std::string > > GetStringVector ()
 Waits for the operation to be done and gets the status and the extra string vector. More...
 
std::pair< Status, std::map< std::string, std::string > > GetStringMap ()
 Waits for the operation to be done and gets the status and the extra string map. More...
 
std::pair< Status, int64_t > GetInteger ()
 Waits for the operation to be done and gets the status and the extra integer. More...
 
const std::type_info & GetExtraType ()
 Gets the type information of the extra data. More...
 

Detailed Description

Wrapper of std::future containing a status object and extra data.

Constructor & Destructor Documentation

◆ StatusFuture() [1/8]

tkrzw::StatusFuture::StatusFuture ( std::future< Status > &&  future)
explicit

Constructor for a status object.

Parameters
futurea future object. The ownership is taken.

◆ StatusFuture() [2/8]

tkrzw::StatusFuture::StatusFuture ( std::future< std::pair< Status, std::string >> &&  future)
explicit

Constructor for a status object and a string.

Parameters
futurea future object. The ownership is taken.

◆ StatusFuture() [3/8]

tkrzw::StatusFuture::StatusFuture ( std::future< std::pair< Status, std::pair< std::string, std::string >>> &&  future)
explicit

Constructor for a status object and a string pair.

Parameters
futurea future object. The ownership is taken.

◆ StatusFuture() [4/8]

tkrzw::StatusFuture::StatusFuture ( std::future< std::pair< Status, std::vector< std::string >>> &&  future)
explicit

Constructor for a status object and a string vector.

Parameters
futurea future object. The ownership is taken.

◆ StatusFuture() [5/8]

tkrzw::StatusFuture::StatusFuture ( std::future< std::pair< Status, std::map< std::string, std::string >>> &&  future)
explicit

Constructor for a status object and a string map.

Parameters
futurea future object. The ownership is taken.

◆ StatusFuture() [6/8]

tkrzw::StatusFuture::StatusFuture ( std::future< std::pair< Status, int64_t >> &&  future)
explicit

Constructor for a status object and an integer.

Parameters
futurea future object. The ownership is taken.

◆ StatusFuture() [7/8]

tkrzw::StatusFuture::StatusFuture ( StatusFuture &&  rhs)

Move constructor.

Parameters
rhsThe right-hand-side object.

◆ ~StatusFuture()

tkrzw::StatusFuture::~StatusFuture ( )

Destructor.

◆ StatusFuture() [8/8]

tkrzw::StatusFuture::StatusFuture ( const StatusFuture rhs)
explicitdelete

Copy and assignment are disabled.

Member Function Documentation

◆ Wait()

bool tkrzw::StatusFuture::Wait ( double  timeout = -1)

Waits for the operation to be done.

Parameters
timeoutThe waiting time in seconds. If it is negative, no timeout is set.
Returns
True if the operation has done. False if timeout occurs.

◆ Get()

Status tkrzw::StatusFuture::Get ( )

Waits for the operation to be done and gets the result status.

Returns
The result status.

Either one of the Get method family can be called only once.

◆ GetString()

std::pair<Status, std::string> tkrzw::StatusFuture::GetString ( )

Waits for the operation to be done and gets the status and the extra string.

Returns
The result status and the extra string.

Either one of the Get method family can be called only once.

◆ GetStringPair()

std::pair<Status, std::pair<std::string, std::string> > tkrzw::StatusFuture::GetStringPair ( )

Waits for the operation to be done and gets the status and the extra string pair.

Returns
The result status and the extra string pair.

Either one of the Get method family can be called only once.

◆ GetStringVector()

std::pair<Status, std::vector<std::string> > tkrzw::StatusFuture::GetStringVector ( )

Waits for the operation to be done and gets the status and the extra string vector.

Returns
The result status and the extra string vector.

Either one of the Get method family can be called only once.

◆ GetStringMap()

std::pair<Status, std::map<std::string, std::string> > tkrzw::StatusFuture::GetStringMap ( )

Waits for the operation to be done and gets the status and the extra string map.

Returns
The result status and the extra string map.

Either one of the Get method family can be called only once.

◆ GetInteger()

std::pair<Status, int64_t> tkrzw::StatusFuture::GetInteger ( )

Waits for the operation to be done and gets the status and the extra integer.

Returns
The result status and the extra integer.

Either one of the Get method family can be called only once.

◆ GetExtraType()

const std::type_info& tkrzw::StatusFuture::GetExtraType ( )

Gets the type information of the extra data.

Returns
The type information of the extra data.