USRP Hardware Driver and USRP Manual  Version: 003.009.004-0-g2b5a88bb
UHD and USRP Manual
bounded_buffer.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2011 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INCLUDED_UHD_TRANSPORT_BOUNDED_BUFFER_HPP
19 #define INCLUDED_UHD_TRANSPORT_BOUNDED_BUFFER_HPP
20 
21 #include <uhd/transport/bounded_buffer.ipp> //detail
22 
23 namespace uhd{ namespace transport{
24 
32  template <typename elem_type> class bounded_buffer{
33  public:
34 
39  bounded_buffer(size_t capacity):
40  _detail(capacity)
41  {
42  /* NOP */
43  }
44 
51  UHD_INLINE bool push_with_haste(const elem_type &elem){
52  return _detail.push_with_haste(elem);
53  }
54 
62  UHD_INLINE bool push_with_pop_on_full(const elem_type &elem){
63  return _detail.push_with_pop_on_full(elem);
64  }
65 
71  UHD_INLINE void push_with_wait(const elem_type &elem){
72  return _detail.push_with_wait(elem);
73  }
74 
82  UHD_INLINE bool push_with_timed_wait(const elem_type &elem, double timeout){
83  return _detail.push_with_timed_wait(elem, timeout);
84  }
85 
92  UHD_INLINE bool pop_with_haste(elem_type &elem){
93  return _detail.pop_with_haste(elem);
94  }
95 
101  UHD_INLINE void pop_with_wait(elem_type &elem){
102  return _detail.pop_with_wait(elem);
103  }
104 
112  UHD_INLINE bool pop_with_timed_wait(elem_type &elem, double timeout){
113  return _detail.pop_with_timed_wait(elem, timeout);
114  }
115 
116  private: bounded_buffer_detail<elem_type> _detail;
117  };
118 
119 }} //namespace
120 
121 #endif /* INCLUDED_UHD_TRANSPORT_BOUNDED_BUFFER_HPP */
UHD_INLINE bool pop_with_haste(elem_type &elem)
Definition: bounded_buffer.hpp:92
Definition: bounded_buffer.hpp:32
bounded_buffer(size_t capacity)
Definition: bounded_buffer.hpp:39
UHD_INLINE bool push_with_haste(const elem_type &elem)
Definition: bounded_buffer.hpp:51
UHD_INLINE bool pop_with_timed_wait(elem_type &elem, double timeout)
Definition: bounded_buffer.hpp:112
Definition: convert.hpp:28
#define UHD_INLINE
Definition: config.h:56
UHD_INLINE bool push_with_timed_wait(const elem_type &elem, double timeout)
Definition: bounded_buffer.hpp:82
UHD_INLINE void push_with_wait(const elem_type &elem)
Definition: bounded_buffer.hpp:71
UHD_INLINE bool push_with_pop_on_full(const elem_type &elem)
Definition: bounded_buffer.hpp:62
Definition: bounded_buffer.ipp:31
UHD_INLINE void pop_with_wait(elem_type &elem)
Definition: bounded_buffer.hpp:101