7 #ifndef INCLUDED_UHD_TRANSPORT_ZERO_COPY_HPP 8 #define INCLUDED_UHD_TRANSPORT_ZERO_COPY_HPP 11 #include <boost/utility.hpp> 12 #include <boost/shared_ptr.hpp> 13 #include <boost/intrusive_ptr.hpp> 14 #include <boost/detail/atomic_count.hpp> 16 namespace uhd{
namespace transport{
23 #ifdef UHD_TXRX_DEBUG_PRINTS 24 _mb_num = s_buffer_count;
37 virtual void release(
void) = 0;
52 return static_cast<T
>(_buffer);
65 T *p,
void *buffer,
size_t length
69 return boost::intrusive_ptr<T>(p);
73 typedef boost::intrusive_ptr<managed_buffer>
sptr;
76 return (
int) _ref_count;
79 #ifdef UHD_TXRX_DEBUG_PRINTS 88 #ifdef UHD_TXRX_DEBUG_PRINTS 93 #ifdef UHD_TXRX_DEBUG_PRINTS 94 static boost::detail::atomic_count s_buffer_count;
113 typedef boost::intrusive_ptr<managed_recv_buffer>
sptr;
123 typedef boost::intrusive_ptr<managed_send_buffer>
sptr;
143 typedef boost::shared_ptr<zero_copy_if>
sptr;
162 virtual size_t get_num_recv_frames(
void)
const = 0;
169 virtual size_t get_recv_frame_size(
void)
const = 0;
183 virtual size_t get_num_send_frames(
void)
const = 0;
190 virtual size_t get_send_frame_size(
void)
const = 0;
Simple managed buffer with release interface.
Definition: zero_copy.hpp:19
UHD_INLINE T cast(void) const
Definition: zero_copy.hpp:51
boost::intrusive_ptr< managed_buffer > sptr
Definition: zero_copy.hpp:73
size_t recv_frame_size
Definition: zero_copy.hpp:130
UHD_INLINE void intrusive_ptr_release(managed_buffer *p)
Definition: zero_copy.hpp:102
UHD_INLINE void commit(size_t num_bytes)
Definition: zero_copy.hpp:43
virtual void release(void)=0
size_t send_frame_size
Definition: zero_copy.hpp:131
Definition: zero_copy.hpp:129
size_t num_recv_frames
Definition: zero_copy.hpp:132
boost::shared_ptr< zero_copy_if > sptr
Definition: zero_copy.hpp:143
Definition: zero_copy.hpp:121
Definition: build_info.hpp:14
Definition: zero_copy.hpp:111
UHD_INLINE size_t size(void) const
Definition: zero_copy.hpp:59
boost::detail::atomic_count _ref_count
Definition: zero_copy.hpp:72
UHD_INLINE void intrusive_ptr_add_ref(managed_buffer *p)
Definition: zero_copy.hpp:98
#define UHD_INLINE
Definition: config.h:52
#define UHD_API
Definition: config.h:62
boost::intrusive_ptr< managed_recv_buffer > sptr
Definition: zero_copy.hpp:113
UHD_INLINE boost::intrusive_ptr< T > make(T *p, void *buffer, size_t length)
Create smart pointer to a reusable managed buffer.
Definition: zero_copy.hpp:64
Definition: zero_copy.hpp:141
virtual ~zero_copy_if()
Definition: zero_copy.hpp:148
virtual ~managed_buffer(void)
Definition: zero_copy.hpp:30
boost::intrusive_ptr< managed_send_buffer > sptr
Definition: zero_copy.hpp:123
managed_buffer(void)
Definition: zero_copy.hpp:21
int ref_count()
Definition: zero_copy.hpp:75
size_t _length
Definition: zero_copy.hpp:87
void * _buffer
Definition: zero_copy.hpp:86
size_t num_send_frames
Definition: zero_copy.hpp:133