uvw 2.12.1
|
#include <handle.hpp>
Public Member Functions | |
HandleCategory | category () const noexcept |
Gets the category of the handle. | |
HandleType | type () const noexcept |
Gets the type of the handle. | |
bool | active () const noexcept |
Checks if the handle is active. | |
bool | closing () const noexcept |
Checks if a handle is closing or closed. | |
void | close () noexcept |
Request handle to be closed. | |
void | reference () noexcept |
Reference the given handle. | |
void | unreference () noexcept |
Unreference the given handle. | |
bool | referenced () const noexcept |
Checks if the given handle referenced. | |
std::size_t | size () const noexcept |
Returns the size of the underlying handle type. | |
int | sendBufferSize () |
Gets the size of the send buffer used for the socket. | |
bool | sendBufferSize (int value) |
Sets the size of the send buffer used for the socket. | |
int | recvBufferSize () |
Gets the size of the receive buffer used for the socket. | |
bool | recvBufferSize (int value) |
Sets the size of the receive buffer used for the socket. | |
OSFileDescriptor | fd () const |
Gets the platform dependent file descriptor equivalent. | |
![]() | |
template<typename R = void> | |
std::shared_ptr< R > | data () const |
Gets user-defined data. uvw won't use this field in any case. | |
void | data (std::shared_ptr< void > uData) |
Sets arbitrary data. uvw won't use this field in any case. | |
![]() | |
Loop & | loop () const noexcept |
Gets the loop from which the resource was originated. | |
const U * | raw () const noexcept |
Gets the underlying raw data structure. | |
U * | raw () noexcept |
Gets the underlying raw data structure. | |
![]() | |
template<typename E > | |
Connection< E > | on (Listener< E > f) |
Registers a long-lived listener with the event emitter. | |
template<typename E > | |
Connection< E > | once (Listener< E > f) |
Registers a short-lived listener with the event emitter. | |
template<typename E > | |
void | erase (Connection< E > conn) noexcept |
Disconnects a listener from the event emitter. | |
template<typename E > | |
void | clear () noexcept |
Disconnects all the listeners for the given event type. | |
void | clear () noexcept |
Disconnects all the listeners. | |
template<typename E > | |
bool | empty () const noexcept |
Checks if there are listeners registered for the specific event. | |
bool | empty () const noexcept |
Checks if there are listeners registered with the event emitter. | |
Additional Inherited Members | |
![]() | |
![]() | |
template<typename... Args> | |
static std::shared_ptr< T > | create (Args &&...args) |
Creates a new resource of the given type. | |
![]() | |
![]() | |
![]() | |
![]() |
Handle base class.
Base type for all uvw
handle types.
Definition at line 26 of file handle.hpp.
|
inlinenoexcept |
Checks if the handle is active.
What active means depends on the type of handle:
start()
.Rule of thumb: if a handle of type FooHandle
has a start()
member method, then it’s active from the moment that method is called. Likewise, stop()
deactivates the handle again.
Definition at line 107 of file handle.hpp.
|
inlinenoexcept |
Gets the category of the handle.
A base handle offers no functionality to promote it to the actual handle type. By means of this function, an opaque value that identifies the category of the handle is made available to the users.
Definition at line 71 of file handle.hpp.
|
inlinenoexcept |
Request handle to be closed.
This must be called on each handle before memory is released.
In-progress requests are cancelled and this can result in an ErrorEvent emitted.
The handle will emit a CloseEvent when finished.
Definition at line 132 of file handle.hpp.
|
inlinenoexcept |
Checks if a handle is closing or closed.
This function should only be used between the initialization of the handle and the arrival of the close callback.
Definition at line 119 of file handle.hpp.
|
inline |
Gets the platform dependent file descriptor equivalent.
Supported handles:
It will emit an ErrorEvent event if invoked on any other handle.
If a handle doesn’t have an attached file descriptor yet or the handle itself has been closed, an ErrorEvent event will be emitted.
See the official documentation for further details.
Definition at line 260 of file handle.hpp.
|
inline |
Gets the size of the receive buffer used for the socket.
Gets the size of the receive buffer that the operating system uses for the socket.
This function works for TCPHandle, PipeHandle and UDPHandle handles on Unix and for TCPHandle and UDPHandle handles on Windows.
Note that Linux will return double the size of the original set value.
Definition at line 217 of file handle.hpp.
|
inline |
Sets the size of the receive buffer used for the socket.
Sets the size of the receive buffer that the operating system uses for the socket.
This function works for TCPHandle, PipeHandle and UDPHandle handles on Unix and for TCPHandle and UDPHandle handles on Windows.
Note that Linux will set double the size.
Definition at line 234 of file handle.hpp.
|
inlinenoexcept |
Reference the given handle.
References are idempotent, that is, if a handle is already referenced calling this function again will have no effect.
Definition at line 144 of file handle.hpp.
|
inlinenoexcept |
Checks if the given handle referenced.
Definition at line 162 of file handle.hpp.
|
inline |
Gets the size of the send buffer used for the socket.
Gets the size of the send buffer that the operating system uses for the socket.
This function works for TCPHandle, PipeHandle and UDPHandle handles on Unix and for TCPHandle and UDPHandle handles on Windows.
Note that Linux will return double the size of the original set value.
Definition at line 185 of file handle.hpp.
|
inline |
Sets the size of the send buffer used for the socket.
Sets the size of the send buffer that the operating system uses for the socket.
This function works for TCPHandle, PipeHandle and UDPHandle handles on Unix and for TCPHandle and UDPHandle handles on Windows.
Note that Linux will set double the size.
Definition at line 202 of file handle.hpp.
|
inlinenoexcept |
Returns the size of the underlying handle type.
Definition at line 170 of file handle.hpp.
|
inlinenoexcept |
Gets the type of the handle.
A base handle offers no functionality to promote it to the actual handle type. By means of this function, the type of the underlying handle as specified by HandleType is made available to the users.
Definition at line 84 of file handle.hpp.
|
inlinenoexcept |
Unreference the given handle.
References are idempotent, that is, if a handle is not referenced calling this function again will have no effect.
Definition at line 154 of file handle.hpp.