distortos  v0.5.0
object-oriented C++ RTOS for microcontrollers
distortos::SignalSet Class Reference

SignalSet class is used as a set of signals. More...

#include <SignalSet.hpp>

Collaboration diagram for distortos::SignalSet:
[legend]

Classes

struct  Empty
 tag struct to construct empty SignalSet More...
 
struct  Full
 tag struct to construct full SignalSet More...
 

Public Types

using Bitset = std::bitset< 32 >
 type of internal bitset for 32 signals More...
 

Public Member Functions

constexpr SignalSet (uint32_t bitmask)
 SignalSet's constructor. More...
 
constexpr SignalSet (const Bitset &bitset)
 SignalSet's constructor. More...
 
constexpr SignalSet (const Empty &)
 SignalSet's constructor. More...
 
constexpr SignalSet (const Full &)
 SignalSet's constructor. More...
 
int add (const uint8_t signalNumber)
 Sets single bit. More...
 
Bitset getBitset () const
 
int remove (const uint8_t signalNumber)
 Clears single bit. More...
 
std::pair< int, bool > test (uint8_t signalNumber) const
 Tests whether the bit is set. More...
 

Static Public Attributes

static constexpr Empty empty = {}
 tag object to construct empty SignalSet More...
 
static constexpr Full full = {}
 tag object to construct full SignalSet More...
 

Private Member Functions

int set (uint8_t signalNumber, bool value)
 Sets value of single bit. More...
 

Private Attributes

Bitset bitset_
 internal bitset for 32 signals More...
 

Detailed Description

SignalSet class is used as a set of signals.

Similar to POSIX sigset_t - http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html

Member Typedef Documentation

◆ Bitset

using distortos::SignalSet::Bitset = std::bitset<32>

type of internal bitset for 32 signals

Constructor & Destructor Documentation

◆ SignalSet() [1/4]

constexpr distortos::SignalSet::SignalSet ( uint32_t  bitmask)
inlineexplicit

SignalSet's constructor.

Parameters
[in]bitmaskis the bit mask used to initialize internal bitset

◆ SignalSet() [2/4]

constexpr distortos::SignalSet::SignalSet ( const Bitset bitset)
inlineexplicit

SignalSet's constructor.

Parameters
[in]bitsetis a reference to Bitset from which internal bitset is copy-constructed

◆ SignalSet() [3/4]

constexpr distortos::SignalSet::SignalSet ( const Empty )
inlineexplicit

SignalSet's constructor.

Constructs empty SignalSet.

Similar to sigemptyset() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/sigemptyset.html#

◆ SignalSet() [4/4]

constexpr distortos::SignalSet::SignalSet ( const Full )
inlineexplicit

SignalSet's constructor.

Constructs full SignalSet.

Similar to sigfillset() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/sigfillset.html#

Member Function Documentation

◆ add()

int distortos::SignalSet::add ( const uint8_t  signalNumber)
inline

Sets single bit.

Similar to sigaddset() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaddset.html#

Parameters
[in]signalNumberis the bit position that will be set, [0; 31]
Returns
0 on success, error code otherwise:
  • EINVAL - signalNumber value is invalid;
Here is the caller graph for this function:

◆ getBitset()

Bitset distortos::SignalSet::getBitset ( ) const
inline
Returns
copy of internal bitset
Here is the caller graph for this function:

◆ remove()

int distortos::SignalSet::remove ( const uint8_t  signalNumber)
inline

Clears single bit.

Similar to sigdelset() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/sigdelset.html#

Parameters
[in]signalNumberis the bit position that will be cleared, [0; 31]
Returns
0 on success, error code otherwise:
  • EINVAL - signalNumber value is invalid;
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set()

int distortos::SignalSet::set ( uint8_t  signalNumber,
bool  value 
)
private

Sets value of single bit.

Parameters
[in]signalNumberis the bit position that will be modified, [0; 31]
[in]valueis the new value for selected bit
Returns
0 on success, error code otherwise:
  • EINVAL - signalNumber value is invalid;

◆ test()

std::pair< int, bool > distortos::SignalSet::test ( uint8_t  signalNumber) const

Tests whether the bit is set.

Similar to sigismember() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/sigismember.html#

Parameters
[in]signalNumberis the bit position that will be tested, [0; 31]
Returns
pair with return code (0 on success, error code otherwise) and value of selected bit; error codes:
  • EINVAL - signalNumber value is invalid;
Here is the caller graph for this function:

Member Data Documentation

◆ bitset_

Bitset distortos::SignalSet::bitset_
private

internal bitset for 32 signals

◆ empty

constexpr SignalSet::Empty distortos::SignalSet::empty = {}
static

tag object to construct empty SignalSet

◆ full

constexpr SignalSet::Full distortos::SignalSet::full = {}
static

tag object to construct full SignalSet


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