23 #ifndef ETCPAL_CPP_QUEUE_H 
   24 #define ETCPAL_CPP_QUEUE_H 
   30 #include "etcpal/common.h" 
   31 #include "etcpal/queue.h" 
   96   explicit Queue(
size_t size);
 
  103   template <
class Rep, 
class Period>
 
  104   bool Receive(T& data, 
const std::chrono::duration<Rep, Period>& timeout);
 
  109   etcpal_queue_t queue_{};
 
  168 template <
class Rep, 
class Period>
 
  171   int timeout_ms_clamped =
 
  172       static_cast<int>(std::min(std::chrono::milliseconds(timeout).count(),
 
  173                                 static_cast<std::chrono::milliseconds::rep
>(std::numeric_limits<int>::max())));
 
An RTOS queue class.
Definition: queue.h:94
~Queue()
Destroy a queue.
Definition: queue.h:123
bool SendFromIsr(const T &data)
Add to a queue from an interrupt service routine.
Definition: queue.h:146
bool IsEmpty() const
Check if a queue is empty.
Definition: queue.h:181
bool IsEmptyFromIsr() const
Check if a queue is empty from an interrupt service routine.
Definition: queue.h:190
bool Send(const T &data, int timeout_ms=ETCPAL_WAIT_FOREVER)
Add some data to the queue.
Definition: queue.h:137
bool Receive(T &data, int timeout_ms=ETCPAL_WAIT_FOREVER)
Get an item from the queue.
Definition: queue.h:156
Queue(size_t size)
Create a new queue.
Definition: queue.h:116
Common definitions used by EtcPal C++ wrappers.
bool etcpal_queue_is_empty_from_isr(const etcpal_queue_t *id)
Determine whether a queue is currently empty from an interrupt context.
bool etcpal_queue_timed_receive(etcpal_queue_t *id, void *data, int timeout_ms)
Retrieve the first item from a queue, giving up after a timeout.
bool etcpal_queue_send_from_isr(etcpal_queue_t *id, const void *data)
Add an item to a queue from an interrupt context.
bool etcpal_queue_is_empty(const etcpal_queue_t *id)
Determine whether a queue is currently empty.
void etcpal_queue_destroy(etcpal_queue_t *id)
Destroy a queue.
bool etcpal_queue_timed_send(etcpal_queue_t *id, const void *data, int timeout_ms)
Add an item to a queue, giving up after a timeout.
bool etcpal_queue_create(etcpal_queue_t *id, size_t size, size_t item_size)
Create a new queue.
#define ETCPAL_WAIT_FOREVER
For etcpal_ functions that take a millisecond timeout, this means to wait indefinitely.
Definition: common.h:111