8 #ifndef INCLUDED_UHD_TRANSPORT_ZERO_COPY_HPP 9 #define INCLUDED_UHD_TRANSPORT_ZERO_COPY_HPP 12 #include <boost/utility.hpp> 13 #include <boost/shared_ptr.hpp> 14 #include <boost/intrusive_ptr.hpp> 15 #include <boost/detail/atomic_count.hpp> 17 namespace uhd{
namespace transport{
24 #ifdef UHD_TXRX_DEBUG_PRINTS 25 _mb_num = s_buffer_count;
38 virtual void release(
void) = 0;
53 return static_cast<T
>(_buffer);
66 T *p,
void *buffer,
size_t length
70 return boost::intrusive_ptr<T>(p);
74 typedef boost::intrusive_ptr<managed_buffer>
sptr;
77 return (
int) _ref_count;
80 #ifdef UHD_TXRX_DEBUG_PRINTS 89 #ifdef UHD_TXRX_DEBUG_PRINTS 94 #ifdef UHD_TXRX_DEBUG_PRINTS 95 static boost::detail::atomic_count s_buffer_count;
114 typedef boost::intrusive_ptr<managed_recv_buffer>
sptr;
124 typedef boost::intrusive_ptr<managed_send_buffer>
sptr;
144 typedef boost::shared_ptr<zero_copy_if>
sptr;
163 virtual size_t get_num_recv_frames(
void)
const = 0;
170 virtual size_t get_recv_frame_size(
void)
const = 0;
184 virtual size_t get_num_send_frames(
void)
const = 0;
191 virtual size_t get_send_frame_size(
void)
const = 0;
Simple managed buffer with release interface.
Definition: zero_copy.hpp:20
UHD_INLINE T cast(void) const
Definition: zero_copy.hpp:52
boost::intrusive_ptr< managed_buffer > sptr
Definition: zero_copy.hpp:74
size_t recv_frame_size
Definition: zero_copy.hpp:131
UHD_INLINE void intrusive_ptr_release(managed_buffer *p)
Definition: zero_copy.hpp:103
UHD_INLINE void commit(size_t num_bytes)
Definition: zero_copy.hpp:44
virtual void release(void)=0
size_t send_frame_size
Definition: zero_copy.hpp:132
Definition: zero_copy.hpp:130
size_t num_recv_frames
Definition: zero_copy.hpp:133
boost::shared_ptr< zero_copy_if > sptr
Definition: zero_copy.hpp:144
Definition: zero_copy.hpp:122
Definition: build_info.hpp:14
Definition: zero_copy.hpp:112
UHD_INLINE size_t size(void) const
Definition: zero_copy.hpp:60
boost::detail::atomic_count _ref_count
Definition: zero_copy.hpp:73
UHD_INLINE void intrusive_ptr_add_ref(managed_buffer *p)
Definition: zero_copy.hpp:99
#define UHD_INLINE
Definition: config.h:53
#define UHD_API
Definition: config.h:63
boost::intrusive_ptr< managed_recv_buffer > sptr
Definition: zero_copy.hpp:114
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:65
Definition: zero_copy.hpp:142
virtual ~zero_copy_if()
Definition: zero_copy.hpp:149
virtual ~managed_buffer(void)
Definition: zero_copy.hpp:31
boost::intrusive_ptr< managed_send_buffer > sptr
Definition: zero_copy.hpp:124
managed_buffer(void)
Definition: zero_copy.hpp:22
int ref_count()
Definition: zero_copy.hpp:76
size_t _length
Definition: zero_copy.hpp:88
void * _buffer
Definition: zero_copy.hpp:87
size_t num_send_frames
Definition: zero_copy.hpp:134