co_usb
Loading...
Searching...
No Matches
Public Member Functions | List of all members
co_usb::device_ref Struct Reference

Wrapper for nullable libusb_device that increments ref count on ctor and decrements on dtor. More...

#include <device_ref.hpp>

Public Member Functions

 device_ref () noexcept
 constructs a null ref
 
 device_ref (libusb_device *dev) noexcept
 constructs a new ref object and increments ref count of underlying device
 
 ~device_ref () noexcept
 
 device_ref (const device_ref &) noexcept
 
device_refoperator= (const device_ref &) noexcept
 
libusb_deviceget () const noexcept
 

Detailed Description

Wrapper for nullable libusb_device that increments ref count on ctor and decrements on dtor.

Objects of this type must be used for returning devices from hotplug callbacks since normally devices obtained through this callback will expire unless their ref count was incremented.

Constructor & Destructor Documentation

◆ device_ref() [1/3]

co_usb::device_ref::device_ref ( )
noexcept

constructs a null ref

◆ device_ref() [2/3]

co_usb::device_ref::device_ref ( libusb_device dev)
explicitnoexcept

constructs a new ref object and increments ref count of underlying device

◆ ~device_ref()

co_usb::device_ref::~device_ref ( )
noexcept

◆ device_ref() [3/3]

co_usb::device_ref::device_ref ( const device_ref other)
noexcept

Member Function Documentation

◆ get()

libusb_device * co_usb::device_ref::get ( ) const
noexcept
Returns
underlying pointer to libusb_device

◆ operator=()

co_usb::device_ref & co_usb::device_ref::operator= ( const device_ref other)
noexcept

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