idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
idfxx::gpio::unique_isr_handle Class Reference

RAII handle for ISR registration that removes the handler on destruction. More...

#include <idfxx_gpio/include/idfxx/gpio.hpp>

Public Member Functions

 unique_isr_handle () noexcept
 Constructs an empty unique_isr_handle.
 
 unique_isr_handle (isr_handle handle) noexcept
 Constructs from an isr_handle, taking ownership.
 
 unique_isr_handle (unique_isr_handle &&other) noexcept
 Move constructor.
 
unique_isr_handleoperator= (unique_isr_handle &&other) noexcept
 Move assignment operator.
 
 unique_isr_handle (const unique_isr_handle &)=delete
 
unique_isr_handleoperator= (const unique_isr_handle &)=delete
 
 ~unique_isr_handle ()
 Destructor.
 
isr_handle release () noexcept
 Releases ownership of the handle without removing the ISR.
 

Detailed Description

RAII handle for ISR registration that removes the handler on destruction.

Unlike isr_handle, this class provides RAII semantics: when the unique_isr_handle is destroyed, the ISR handler is automatically removed.

This class is move-only. Use release() to transfer ownership back to a non-RAII isr_handle if needed.

Definition at line 141 of file gpio.hpp.

Constructor & Destructor Documentation

◆ unique_isr_handle() [1/4]

idfxx::gpio::unique_isr_handle::unique_isr_handle ( )
inlineexplicitnoexcept

Constructs an empty unique_isr_handle.

Represents no ownership of any ISR handler.

Definition at line 148 of file gpio.hpp.

◆ unique_isr_handle() [2/4]

idfxx::gpio::unique_isr_handle::unique_isr_handle ( isr_handle  handle)
inlineexplicitnoexcept

Constructs from an isr_handle, taking ownership.

Parameters
handleThe isr_handle to take ownership of.

Definition at line 156 of file gpio.hpp.

◆ unique_isr_handle() [3/4]

idfxx::gpio::unique_isr_handle::unique_isr_handle ( unique_isr_handle &&  other)
inlinenoexcept

Move constructor.

Parameters
otherThe handle to move from.

Definition at line 164 of file gpio.hpp.

◆ unique_isr_handle() [4/4]

idfxx::gpio::unique_isr_handle::unique_isr_handle ( const unique_isr_handle )
delete

◆ ~unique_isr_handle()

idfxx::gpio::unique_isr_handle::~unique_isr_handle ( )
inline

Destructor.

Removes the ISR handler if still owned.

Definition at line 193 of file gpio.hpp.

Member Function Documentation

◆ operator=() [1/2]

unique_isr_handle & idfxx::gpio::unique_isr_handle::operator= ( const unique_isr_handle )
delete

◆ operator=() [2/2]

unique_isr_handle & idfxx::gpio::unique_isr_handle::operator= ( unique_isr_handle &&  other)
inlinenoexcept

Move assignment operator.

Parameters
otherThe handle to move from.
Returns
Reference to this handle.

Definition at line 175 of file gpio.hpp.

◆ release()

isr_handle idfxx::gpio::unique_isr_handle::release ( )
inlinenoexcept

Releases ownership of the handle without removing the ISR.

Returns
The underlying isr_handle.

Definition at line 204 of file gpio.hpp.


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