Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
SignalSet Class Reference

C++ wrapper for sigset_t with a fluent interface. More...

#include <ah-signal.H>

Public Member Functions

 SignalSet () noexcept
 Creates an empty signal set.
 
 SignalSet (std::initializer_list< int > signals) noexcept
 Creates a signal set from an initializer list.
 
SignalSetadd (int signo) noexcept
 Adds a signal to the set.
 
SignalSetremove (int signo) noexcept
 Removes a signal from the set.
 
SignalSetclear () noexcept
 Clears the set (removes all signals).
 
SignalSetfill () noexcept
 Fills the set with all signals.
 
bool contains (int signo) const noexcept
 Checks if a signal is in the set.
 
sigset_t * get () noexcept
 Returns a pointer to the underlying sigset_t.
 
const sigset_t * get () const noexcept
 Returns a const pointer to the underlying sigset_t.
 
 operator sigset_t * () noexcept
 Implicit conversion to sigset_t*.
 
 operator const sigset_t * () const noexcept
 Implicit conversion to const sigset_t*.
 

Static Public Member Functions

static SignalSet full () noexcept
 Creates a full signal set (all signals).
 
static SignalSet empty () noexcept
 Creates an empty signal set.
 

Private Attributes

sigset_t set_
 

Detailed Description

C++ wrapper for sigset_t with a fluent interface.

Provides a type-safe way to manipulate signal sets.

Example

SignalSet sigs;
sigs.add(SIGINT).add(SIGTERM).add(SIGHUP);
// Or using initializer list:
SignalSet sigs2({SIGINT, SIGTERM, SIGHUP});
C++ wrapper for sigset_t with a fluent interface.
Definition ah-signal.H:133
SignalSet & add(int signo) noexcept
Adds a signal to the set.
Definition ah-signal.H:161

Definition at line 132 of file ah-signal.H.

Constructor & Destructor Documentation

◆ SignalSet() [1/2]

SignalSet::SignalSet ( )
inlinenoexcept

Creates an empty signal set.

Definition at line 138 of file ah-signal.H.

References set_.

Referenced by empty().

◆ SignalSet() [2/2]

SignalSet::SignalSet ( std::initializer_list< int >  signals)
inlinenoexcept

Creates a signal set from an initializer list.

Definition at line 141 of file ah-signal.H.

References set_.

Member Function Documentation

◆ add()

SignalSet & SignalSet::add ( int  signo)
inlinenoexcept

Adds a signal to the set.

Returns
Reference to this for chaining.

Definition at line 161 of file ah-signal.H.

References set_.

Referenced by TEST(), TEST(), and TEST_F().

◆ clear()

SignalSet & SignalSet::clear ( )
inlinenoexcept

Clears the set (removes all signals).

Returns
Reference to this for chaining.

Definition at line 177 of file ah-signal.H.

References set_.

Referenced by TEST().

◆ contains()

bool SignalSet::contains ( int  signo) const
inlinenoexcept

Checks if a signal is in the set.

Definition at line 192 of file ah-signal.H.

References set_.

Referenced by TEST(), TEST(), and TEST().

◆ empty()

static SignalSet SignalSet::empty ( )
inlinestaticnoexcept

Creates an empty signal set.

Definition at line 157 of file ah-signal.H.

References SignalSet().

Referenced by TEST().

◆ fill()

SignalSet & SignalSet::fill ( )
inlinenoexcept

Fills the set with all signals.

Returns
Reference to this for chaining.

Definition at line 185 of file ah-signal.H.

References set_.

◆ full()

static SignalSet SignalSet::full ( )
inlinestaticnoexcept

Creates a full signal set (all signals).

Definition at line 149 of file ah-signal.H.

References set_.

Referenced by TEST().

◆ get() [1/2]

const sigset_t * SignalSet::get ( ) const
inlinenoexcept

Returns a const pointer to the underlying sigset_t.

Definition at line 201 of file ah-signal.H.

References set_.

◆ get() [2/2]

sigset_t * SignalSet::get ( )
inlinenoexcept

Returns a pointer to the underlying sigset_t.

Definition at line 198 of file ah-signal.H.

References set_.

Referenced by SignalBlocker::SignalBlocker(), TEST(), TEST_F(), and wait_for_signal().

◆ operator const sigset_t *()

SignalSet::operator const sigset_t * ( ) const
inlinenoexcept

Implicit conversion to const sigset_t*.

Definition at line 207 of file ah-signal.H.

References set_.

◆ operator sigset_t *()

SignalSet::operator sigset_t * ( )
inlinenoexcept

Implicit conversion to sigset_t*.

Definition at line 204 of file ah-signal.H.

References set_.

◆ remove()

SignalSet & SignalSet::remove ( int  signo)
inlinenoexcept

Removes a signal from the set.

Returns
Reference to this for chaining.

Definition at line 169 of file ah-signal.H.

References set_.

Referenced by TEST(), and TEST().

Member Data Documentation

◆ set_

sigset_t SignalSet::set_
private

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