From 11f2aa1ea0fd6c28a20c6d85f94e41a06b3a6770 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 3 Jul 2010 16:50:45 -0700 Subject: uhd: replaced old send and recv with inline wrappers that take a single buffer and look more like the vectored send/recv --- host/include/uhd/device.hpp | 53 +++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'host/include') diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp index f04a5b4fb..e5ef1181f 100644 --- a/host/include/uhd/device.hpp +++ b/host/include/uhd/device.hpp @@ -26,7 +26,6 @@ #include #include #include -#include #include namespace uhd{ @@ -97,20 +96,6 @@ public: RECV_MODE_ONE_PACKET = 1 }; - //! wrapper call for single buffer recv //TODO put somewhere - size_t send( - const boost::asio::const_buffer &buff, - const tx_metadata_t &metadata, - const io_type_t &io_type, - send_mode_t send_mode - ){ - return send( - std::vector(1, boost::asio::buffer_cast(buff)), - boost::asio::buffer_size(buff)/io_type.size, - metadata, io_type, send_mode - ); - } - /*! * Send buffers containing IF data described by the metadata. * @@ -140,17 +125,20 @@ public: send_mode_t send_mode ) = 0; - //! wrapper call for single buffer recv //TODO put somewhere - size_t recv( - const boost::asio::mutable_buffer &buff, - rx_metadata_t &metadata, + /*! + * Convenience wrapper for send that takes a single buffer. + */ + inline size_t send( + const void *buff, + size_t nsamps_per_buff, + const tx_metadata_t &metadata, const io_type_t &io_type, - recv_mode_t recv_mode + send_mode_t send_mode ){ - return recv( - std::vector(1, boost::asio::buffer_cast(buff)), - boost::asio::buffer_size(buff)/io_type.size, - metadata, io_type, recv_mode + return send( + std::vector(1, buff), + nsamps_per_buff, metadata, + io_type, send_mode ); } @@ -195,6 +183,23 @@ public: recv_mode_t recv_mode ) = 0; + /*! + * Convenience wrapper for recv that takes a single buffer. + */ + inline size_t recv( + void *buff, + size_t nsamps_per_buff, + rx_metadata_t &metadata, + const io_type_t &io_type, + recv_mode_t recv_mode + ){ + return recv( + std::vector(1, buff), + nsamps_per_buff, metadata, + io_type, recv_mode + ); + } + /*! * Get the maximum number of samples per packet on send. * \return the number of samples -- cgit v1.2.3