zpp
Zephyr C++20 Framework
zpp::poll_event_set< T_Size > Class Template Reference

A set of poll events. More...

#include <poll_event_set.hpp>

Public Member Functions

auto begin () noexcept
 
auto end () noexcept
 
 poll_event_set () noexcept
 default constructor More...
 
template<class... T_Args>
 poll_event_set (T_Args &&... t) noexcept
 constructor that takes arguments for initialization More...
 
auto operator[] (size_t idx) noexcept
 access an element of the set More...
 
auto poll () noexcept
 poll events waiting for ever More...
 
auto try_poll () noexcept
 try poll events without waiting More...
 
template<class T_Rep , class T_Period >
auto try_poll_for (const std::chrono::duration< T_Rep, T_Period > &timeout) noexcept
 try poll events waiting for e certain time More...
 

Detailed Description

template<int T_Size>
class zpp::poll_event_set< T_Size >

A set of poll events.

Parameters
Sizethe size of the set

Definition at line 37 of file poll_event_set.hpp.

Constructor & Destructor Documentation

◆ poll_event_set() [1/2]

template<int T_Size>
zpp::poll_event_set< T_Size >::poll_event_set ( )
inlinenoexcept

default constructor

Definition at line 46 of file poll_event_set.hpp.

47  {
48  }

◆ poll_event_set() [2/2]

template<int T_Size>
template<class... T_Args>
zpp::poll_event_set< T_Size >::poll_event_set ( T_Args &&...  t)
inlinenoexcept

constructor that takes arguments for initialization

Parameters
tthe arguments to use for initialization

Definition at line 56 of file poll_event_set.hpp.

57  {
58  assign(0, std::forward<T_Args>(t)...);
59  }

Member Function Documentation

◆ begin()

template<int T_Size>
auto zpp::poll_event_set< T_Size >::begin ( )
inlinenoexcept

Definition at line 40 of file poll_event_set.hpp.

40 { return m_events.begin(); }

◆ end()

template<int T_Size>
auto zpp::poll_event_set< T_Size >::end ( )
inlinenoexcept

Definition at line 41 of file poll_event_set.hpp.

41 { return m_events.end(); }

◆ operator[]()

template<int T_Size>
auto zpp::poll_event_set< T_Size >::operator[] ( size_t  idx)
inlinenoexcept

access an element of the set

Parameters
idxthe index of the event to get
Returns
a poll_event that has a reference to the indexed event

Definition at line 68 of file poll_event_set.hpp.

69  {
70  __ASSERT_NO_MSG(idx < T_Size);
71  return poll_event(&m_events[idx]);
72  }

◆ poll()

template<int T_Size>
auto zpp::poll_event_set< T_Size >::poll ( )
inlinenoexcept

poll events waiting for ever

Returns
false on error

Definition at line 79 of file poll_event_set.hpp.

80  {
81  return poll(K_FOREVER);
82  }
auto poll() noexcept
poll events waiting for ever

Referenced by zpp::poll_event_set< T_Size >::try_poll(), and zpp::poll_event_set< T_Size >::try_poll_for().

◆ try_poll()

template<int T_Size>
auto zpp::poll_event_set< T_Size >::try_poll ( )
inlinenoexcept

try poll events without waiting

Returns
false on error

Definition at line 89 of file poll_event_set.hpp.

90  {
91  return poll(K_NO_WAIT);
92  }

References zpp::poll_event_set< T_Size >::poll().

◆ try_poll_for()

template<int T_Size>
template<class T_Rep , class T_Period >
auto zpp::poll_event_set< T_Size >::try_poll_for ( const std::chrono::duration< T_Rep, T_Period > &  timeout)
inlinenoexcept

try poll events waiting for e certain time

Parameters
timeoutthe time to wait
Returns
false on error

Definition at line 102 of file poll_event_set.hpp.

104  {
105  using namespace std::chrono;
106 
107  return poll(to_timeout(timeout));
108  }
constexpr k_timeout_t to_timeout(const std::chrono::duration< T_Rep, T_Period > &d) noexcept
convert a duration to tick
Definition: clock.hpp:88

References zpp::poll_event_set< T_Size >::poll(), and zpp::to_timeout().


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