WPILibC++  2019.3.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
wpi::uv::Request Class Reference

Request. More...

#include <Request.h>

Inheritance diagram for wpi::uv::Request:
wpi::uv::RequestImpl< ConnectReq, uv_connect_t > wpi::uv::RequestImpl< GetAddrInfoReq, uv_getaddrinfo_t > wpi::uv::RequestImpl< GetNameInfoReq, uv_getnameinfo_t > wpi::uv::RequestImpl< ShutdownReq, uv_shutdown_t > wpi::uv::RequestImpl< UdpSendReq, uv_udp_send_t > wpi::uv::RequestImpl< WorkReq, uv_work_t > wpi::uv::RequestImpl< WriteReq, uv_write_t > wpi::uv::RequestImpl< T, U >

Public Types

using Type = uv_req_type
 

Public Member Functions

 Request (const Request &)=delete
 
 Request (Request &&)=delete
 
Requestoperator= (const Request &)=delete
 
Requestoperator= (Request &&)=delete
 
Type GetType () const noexcept
 Get the type of the request. More...
 
const char * GetTypeName () const noexcept
 Get the name of the type of the request. More...
 
bool Cancel ()
 Cancel a pending request. More...
 
size_t RawSize () const noexcept
 Return the size of the underlying request type. More...
 
uv_req_tGetRawReq () noexcept
 Get the underlying request data structure. More...
 
const uv_req_tGetRawReq () const noexcept
 Get the underlying request data structure. More...
 
virtual void Keep () noexcept
 Keep this request in memory even if no outside shared_ptr references remain. More...
 
virtual void Release () noexcept
 No longer force holding this request in memory. More...
 
void ReportError (int err)
 Report an error. More...
 

Public Attributes

std::function< void(Error)> error
 Error callback. More...
 

Protected Member Functions

 Request (uv_req_t *uv_req)
 Constructor.
 

Detailed Description

Request.

Requests are not moveable or copyable. This class provides shared_ptr ownership and shared_from_this.

Member Function Documentation

bool wpi::uv::Request::Cancel ( )
inline

Cancel a pending request.

This method fails if the request is executing or has finished executing. It can emit an error signal in case of errors.

Returns
True in case of success, false otherwise.
uv_req_t* wpi::uv::Request::GetRawReq ( )
inlinenoexcept

Get the underlying request data structure.

Returns
The underlying request data structure.
const uv_req_t* wpi::uv::Request::GetRawReq ( ) const
inlinenoexcept

Get the underlying request data structure.

Returns
The underlying request data structure.
Type wpi::uv::Request::GetType ( ) const
inlinenoexcept

Get the type of the request.

A base request offers no functionality to promote it to the actual request type. By means of this function, the type of the underlying request as specified by Type is made available.

Returns
The actual type of the request.
const char* wpi::uv::Request::GetTypeName ( ) const
inlinenoexcept

Get the name of the type of the request.

E.g. "connect" for connect.

virtual void wpi::uv::Request::Keep ( )
inlinevirtualnoexcept

Keep this request in memory even if no outside shared_ptr references remain.

To release call Release().

Derived classes can override this method for different memory management approaches (e.g. pooled storage of requests).

size_t wpi::uv::Request::RawSize ( ) const
inlinenoexcept

Return the size of the underlying request type.

Returns
The size of the underlying request type.
virtual void wpi::uv::Request::Release ( )
inlinevirtualnoexcept

No longer force holding this request in memory.

Does not immediately destroy the object unless no outside shared_ptr references remain.

Derived classes can override this method for different memory management approaches (e.g. pooled storage of requests).

void wpi::uv::Request::ReportError ( int  err)
inline

Report an error.

Parameters
errError code

Member Data Documentation

std::function<void(Error)> wpi::uv::Request::error

Error callback.

By default, this is set up to report errors to the handle that created this request.

Parameters
errerror code

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