18 #ifndef INCLUDED_UHD_TRANSPORT_ZERO_COPY_HPP 19 #define INCLUDED_UHD_TRANSPORT_ZERO_COPY_HPP 22 #include <boost/utility.hpp> 23 #include <boost/shared_ptr.hpp> 24 #include <boost/intrusive_ptr.hpp> 25 #include <boost/detail/atomic_count.hpp> 27 namespace uhd{
namespace transport{
34 #ifdef UHD_TXRX_DEBUG_PRINTS 35 _mb_num = s_buffer_count;
48 virtual void release(
void) = 0;
63 return static_cast<T
>(_buffer);
76 T *p,
void *buffer,
size_t length
80 return boost::intrusive_ptr<T>(p);
84 typedef boost::intrusive_ptr<managed_buffer>
sptr;
87 return (
int) _ref_count;
90 #ifdef UHD_TXRX_DEBUG_PRINTS 99 #ifdef UHD_TXRX_DEBUG_PRINTS 104 #ifdef UHD_TXRX_DEBUG_PRINTS 105 static boost::detail::atomic_count s_buffer_count;
124 typedef boost::intrusive_ptr<managed_recv_buffer>
sptr;
134 typedef boost::intrusive_ptr<managed_send_buffer>
sptr;
154 typedef boost::shared_ptr<zero_copy_if>
sptr;
173 virtual size_t get_num_recv_frames(
void)
const = 0;
180 virtual size_t get_recv_frame_size(
void)
const = 0;
194 virtual size_t get_num_send_frames(
void)
const = 0;
201 virtual size_t get_send_frame_size(
void)
const = 0;
Simple managed buffer with release interface.
Definition: zero_copy.hpp:30
UHD_INLINE T cast(void) const
Definition: zero_copy.hpp:62
boost::intrusive_ptr< managed_buffer > sptr
Definition: zero_copy.hpp:84
size_t recv_frame_size
Definition: zero_copy.hpp:141
UHD_INLINE void intrusive_ptr_release(managed_buffer *p)
Definition: zero_copy.hpp:113
UHD_INLINE void commit(size_t num_bytes)
Definition: zero_copy.hpp:54
virtual void release(void)=0
size_t send_frame_size
Definition: zero_copy.hpp:142
Definition: zero_copy.hpp:140
size_t num_recv_frames
Definition: zero_copy.hpp:143
boost::shared_ptr< zero_copy_if > sptr
Definition: zero_copy.hpp:154
Definition: zero_copy.hpp:132
Definition: build_info.hpp:25
Definition: zero_copy.hpp:122
UHD_INLINE size_t size(void) const
Definition: zero_copy.hpp:70
boost::detail::atomic_count _ref_count
Definition: zero_copy.hpp:83
UHD_INLINE void intrusive_ptr_add_ref(managed_buffer *p)
Definition: zero_copy.hpp:109
#define UHD_INLINE
Definition: config.h:63
#define UHD_API
Definition: config.h:73
boost::intrusive_ptr< managed_recv_buffer > sptr
Definition: zero_copy.hpp:124
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:75
Definition: zero_copy.hpp:152
virtual ~zero_copy_if()
Definition: zero_copy.hpp:159
virtual ~managed_buffer(void)
Definition: zero_copy.hpp:41
boost::intrusive_ptr< managed_send_buffer > sptr
Definition: zero_copy.hpp:134
managed_buffer(void)
Definition: zero_copy.hpp:32
int ref_count()
Definition: zero_copy.hpp:86
size_t _length
Definition: zero_copy.hpp:98
void * _buffer
Definition: zero_copy.hpp:97
size_t num_send_frames
Definition: zero_copy.hpp:144