| USRP Hardware Driver and Device Manual Version: 4.10.0.0 UHD and USRP Manual |

Loading...
Searching...
No Matches
uhd::transport::bounded_buffer< elem_type > Class Template Reference

`#include <uhd/transport/bounded_buffer.hpp>`

## Detailed Description

template<typename elem_type>
class uhd::transport::bounded_buffer< elem_type >

Implement a templated bounded buffer: Used for passing elements between threads in a producer-consumer model. The bounded buffer implemented waits and timed waits with condition variables. The pop operation blocks on the bounded_buffer to become non empty. The push operation blocks on the bounded_buffer to become non full.

## Public Member Functions
| bounded_buffer (size_t capacity)
UHD_INLINE bool | push_with_haste (const elem_type &elem)
UHD_INLINE bool | push_with_pop_on_full (const elem_type &elem)
UHD_INLINE void | push_with_wait (const elem_type &elem)
UHD_INLINE bool | push_with_timed_wait (const elem_type &elem, double timeout)
UHD_INLINE bool | pop_with_haste (elem_type &elem)
UHD_INLINE void | pop_with_wait (elem_type &elem)
UHD_INLINE bool | pop_with_timed_wait (elem_type &elem, double timeout)
UHD_INLINE std::vector< elem_type > | pop_all ()

## Constructor & Destructor Documentation

## ◆ bounded_buffer()

template<typename elem_type>

uhd::transport::bounded_buffer< elem_type >::bounded_buffer | ( | size_t | capacity | ) |
| inline

Create a new bounded buffer object.

Parameters

  capacity | the bounded_buffer capacity

## Member Function Documentation

## ◆ pop_all()

template<typename elem_type>

UHD_INLINE std::vector< elem_type > uhd::transport::bounded_buffer< elem_type >::pop_all | ( |  | ) |
| inline

Pop all elements from the bounded_buffer.

Returns
  The vector of the popped elements

## ◆ pop_with_haste()

template<typename elem_type>

UHD_INLINE bool uhd::transport::bounded_buffer< elem_type >::pop_with_haste | ( | elem_type & | elem | ) |
| inline

Pop an element from the bounded buffer immediately. The element will not be popped when the buffer is empty.

Parameters

  elem | the element reference pop to

Returns
  false when the buffer is empty

## ◆ pop_with_timed_wait()

template<typename elem_type>

UHD_INLINE bool uhd::transport::bounded_buffer< elem_type >::pop_with_timed_wait | ( | elem_type & | elem,
|  | double | timeout )
| inline

Pop an element from the bounded_buffer. Wait until the bounded_buffer becomes non-empty or timeout.

Parameters

  elem | the element reference pop to
  timeout | the timeout in seconds

Returns
  false when the operation times out

## ◆ pop_with_wait()

template<typename elem_type>

UHD_INLINE void uhd::transport::bounded_buffer< elem_type >::pop_with_wait | ( | elem_type & | elem | ) |
| inline

Pop an element from the bounded_buffer. Wait until the bounded_buffer becomes non-empty.

Parameters

  elem | the element reference pop to

## ◆ push_with_haste()

template<typename elem_type>

UHD_INLINE bool uhd::transport::bounded_buffer< elem_type >::push_with_haste | ( | const elem_type & | elem | ) |
| inline

Push a new element into the bounded buffer immediately. The element will not be pushed when the buffer is full.

Parameters

  elem | the element reference pop to

Returns
  false when the buffer is full

## ◆ push_with_pop_on_full()

template<typename elem_type>

UHD_INLINE bool uhd::transport::bounded_buffer< elem_type >::push_with_pop_on_full | ( | const elem_type & | elem | ) |
| inline

Push a new element into the bounded buffer. If the buffer is full prior to the push, make room by popping the oldest element.

Parameters

  elem | the new element to push

Returns
  true if the element fit without popping for space

## ◆ push_with_timed_wait()

template<typename elem_type>

UHD_INLINE bool uhd::transport::bounded_buffer< elem_type >::push_with_timed_wait | ( | const elem_type & | elem,
|  | double | timeout )
| inline

Push a new element into the bounded_buffer. Wait until the bounded_buffer becomes non-full or timeout.

Parameters

  elem | the new element to push
  timeout | the timeout in seconds

Returns
  false when the operation times out

## ◆ push_with_wait()

template<typename elem_type>

UHD_INLINE void uhd::transport::bounded_buffer< elem_type >::push_with_wait | ( | const elem_type & | elem | ) |
| inline

Push a new element into the bounded_buffer. Wait until the bounded_buffer becomes non-full.

Parameters

  elem | the new element to push

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

- bounded_buffer.hpp