co_usb
Loading...
Searching...
No Matches
co_usb::ev::event_handler_ref Struct Reference

Type-erased reference to any event handler. More...

#include <event_handler_ref.hpp>

Public Member Functions

 event_handler_ref () noexcept
 
template<detail::EventHandler HandlerTy>
requires (!std::same_as<HandlerTy, event_handler_ref>)
 event_handler_ref (HandlerTy &handler)
 
template<detail::EventHandler HandlerTy>
requires (!std::same_as<HandlerTy, event_handler_ref>)
event_handler_refoperator= (HandlerTy &handler)
 
 event_handler_ref (event_handler_ref const &other)
 
event_handler_refoperator= (event_handler_ref const &other)
 
 event_handler_ref (event_handler_ref &&other) noexcept
 
event_handler_refoperator= (event_handler_ref &&other) noexcept
 
 ~event_handler_ref ()
 
auto valid () const noexcept -> bool
 
auto start (libusb_context *usb_ctx, std::stop_token stop) -> bool
 
auto ref () noexcept -> void
 
auto unref () noexcept -> void
 
auto stop () -> void
 

Detailed Description

Type-erased reference to any event handler.

The purpose of this type is to be held by an object within the lifetime of which the event handler cannot be let to shutdown. An example of a situation where this would be ill-formed is if a transfer is in flight, cancellation is requested, co_usb::transfer::cancel_transfer is called on it but the event loop has already finished its shutdown and the transfer would never be cancelled nor is it completion callback would ever be called.

Note
This type is copy constructible, copy assignable, move constructible and move assignable. Use move to avoid refcount increment/decrement.
See also
any_event_handler

Constructor & Destructor Documentation

◆ event_handler_ref() [1/4]

co_usb::ev::event_handler_ref::event_handler_ref ( )
inlineexplicitnoexcept

◆ event_handler_ref() [2/4]

template<detail::EventHandler HandlerTy>
requires (!std::same_as<HandlerTy, event_handler_ref>)
co_usb::ev::event_handler_ref::event_handler_ref ( HandlerTy &  handler)
inline

◆ event_handler_ref() [3/4]

co_usb::ev::event_handler_ref::event_handler_ref ( event_handler_ref const &  other)
inline

◆ event_handler_ref() [4/4]

co_usb::ev::event_handler_ref::event_handler_ref ( event_handler_ref &&  other)
inlinenoexcept

◆ ~event_handler_ref()

co_usb::ev::event_handler_ref::~event_handler_ref ( )
inline

Member Function Documentation

◆ operator=() [1/3]

event_handler_ref & co_usb::ev::event_handler_ref::operator= ( event_handler_ref &&  other)
inlinenoexcept

◆ operator=() [2/3]

event_handler_ref & co_usb::ev::event_handler_ref::operator= ( event_handler_ref const &  other)
inline

◆ operator=() [3/3]

template<detail::EventHandler HandlerTy>
requires (!std::same_as<HandlerTy, event_handler_ref>)
event_handler_ref & co_usb::ev::event_handler_ref::operator= ( HandlerTy &  handler)
inline

◆ ref()

auto co_usb::ev::event_handler_ref::ref ( ) -> void
inlinenoexcept

◆ start()

auto co_usb::ev::event_handler_ref::start ( libusb_context *  usb_ctx,
std::stop_token  stop 
) -> bool
inline

◆ stop()

auto co_usb::ev::event_handler_ref::stop ( ) -> void
inline

◆ unref()

auto co_usb::ev::event_handler_ref::unref ( ) -> void
inlinenoexcept

◆ valid()

auto co_usb::ev::event_handler_ref::valid ( ) const -> bool
inlinenoexcept

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