36 explicit device_ref (libusb_device *dev) noexcept : m_dev(dev)
38 libusb_ref_device(m_dev);
45 libusb_unref_device(m_dev);
52 libusb_ref_device(m_dev);
59 libusb_ref_device(m_dev);
68 auto valid () const noexcept ->
bool
70 return m_dev !=
nullptr;
76 auto get () const noexcept -> libusb_device *
89 auto release () noexcept -> libusb_device *
Definition flag_type.hpp:6
Wrapper for nullable libusb_device that increments ref count on ctor and decrements on dtor.
Definition device_ref.hpp:25
device_ref() noexcept
constructs a null ref
Definition device_ref.hpp:29
device_ref(device_ref const &other) noexcept
Definition device_ref.hpp:49
device_ref(libusb_device *dev) noexcept
constructs a new ref object and increments ref count of underlying device
Definition device_ref.hpp:36
auto get() const noexcept -> libusb_device *
Definition device_ref.hpp:76
auto release() noexcept -> libusb_device *
Releases the device from a ref.
Definition device_ref.hpp:89
device_ref & operator=(device_ref const &other) noexcept
Definition device_ref.hpp:55
~device_ref() noexcept
Definition device_ref.hpp:41
auto valid() const noexcept -> bool
Checks if a device reference is valid.
Definition device_ref.hpp:68