diff options
author | Josh Blum <josh@joshknows.com> | 2010-07-06 16:15:49 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-07-06 16:15:49 -0700 |
commit | e771e157f6d210fe2e66294c60581c5953006ba1 (patch) | |
tree | d37050bb85440396bf16bcd4e79f3c96b1388f30 | |
parent | 1ca30a49030da2ef248048e17a46738bb3823c4c (diff) | |
download | uhd-e771e157f6d210fe2e66294c60581c5953006ba1.tar.gz uhd-e771e157f6d210fe2e66294c60581c5953006ba1.tar.bz2 uhd-e771e157f6d210fe2e66294c60581c5953006ba1.zip |
uhd: added back into old send/recv but with deprecation attributes, moved inline device stuff into device.ipp
-rw-r--r-- | host/include/uhd/CMakeLists.txt | 1 | ||||
-rw-r--r-- | host/include/uhd/config.hpp | 11 | ||||
-rw-r--r-- | host/include/uhd/device.hpp | 35 | ||||
-rw-r--r-- | host/include/uhd/device.ipp | 79 |
4 files changed, 109 insertions, 17 deletions
diff --git a/host/include/uhd/CMakeLists.txt b/host/include/uhd/CMakeLists.txt index d63062032..c0339dbd3 100644 --- a/host/include/uhd/CMakeLists.txt +++ b/host/include/uhd/CMakeLists.txt @@ -24,6 +24,7 @@ ADD_SUBDIRECTORY(utils) INSTALL(FILES config.hpp device.hpp + device.ipp wax.hpp DESTINATION ${INCLUDE_DIR}/uhd ) diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp index b23a4dc00..013354d33 100644 --- a/host/include/uhd/config.hpp +++ b/host/include/uhd/config.hpp @@ -78,7 +78,7 @@ #endif // UHD_DLL // Define force inline macro -#ifdef BOOST_MSVC +#if defined(BOOST_MSVC) #define UHD_INLINE __forceinline #elif defined(__GNUG__) && __GNUG__ >= 4 #define UHD_INLINE inline __attribute__((always_inline)) @@ -86,4 +86,13 @@ #define UHD_INLINE inline #endif +// Define deprecated attribute macro +#if defined(BOOST_MSVC) + #define UHD_DEPRECATED __declspec(deprecated) +#elif defined(__GNUG__) && __GNUG__ >= 4 + #define UHD_DEPRECATED __attribute__ ((deprecated)) +#else + #define UHD_DEPRECATED +#endif + #endif /* INCLUDED_UHD_CONFIG_HPP */ diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp index e5ef1181f..a0c29f2e6 100644 --- a/host/include/uhd/device.hpp +++ b/host/include/uhd/device.hpp @@ -26,6 +26,7 @@ #include <boost/utility.hpp> #include <boost/shared_ptr.hpp> #include <boost/function.hpp> +#include <boost/asio/buffer.hpp> #include <vector> namespace uhd{ @@ -128,19 +129,19 @@ public: /*! * Convenience wrapper for send that takes a single buffer. */ - inline size_t send( + size_t send( const void *buff, size_t nsamps_per_buff, const tx_metadata_t &metadata, const io_type_t &io_type, send_mode_t send_mode - ){ - return send( - std::vector<const void *>(1, buff), - nsamps_per_buff, metadata, - io_type, send_mode - ); - } + ); + + //! Deprecated + size_t send( + const boost::asio::const_buffer &, const tx_metadata_t &, + const io_type_t &, send_mode_t send_mode + ); /*! * Receive buffers containing IF data described by the metadata. @@ -186,19 +187,19 @@ public: /*! * Convenience wrapper for recv that takes a single buffer. */ - inline size_t recv( + 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<void *>(1, buff), - nsamps_per_buff, metadata, - io_type, recv_mode - ); - } + ); + + //! Deprecated + size_t recv( + const boost::asio::mutable_buffer &, rx_metadata_t &, + const io_type_t &, recv_mode_t + ); /*! * Get the maximum number of samples per packet on send. @@ -216,4 +217,6 @@ public: } //namespace uhd +#include <uhd/device.ipp> + #endif /* INCLUDED_UHD_DEVICE_HPP */ diff --git a/host/include/uhd/device.ipp b/host/include/uhd/device.ipp new file mode 100644 index 000000000..c38a2e43e --- /dev/null +++ b/host/include/uhd/device.ipp @@ -0,0 +1,79 @@ +// +// Copyright 2010 Ettus Research LLC +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// + +#ifndef INCLUDED_UHD_DEVICE_IPP +#define INCLUDED_UHD_DEVICE_IPP + +namespace uhd{ + + UHD_INLINE size_t device::send( + const void *buff, + size_t nsamps_per_buff, + const tx_metadata_t &metadata, + const io_type_t &io_type, + send_mode_t send_mode + ){ + return this->send( + std::vector<const void *>(1, buff), + nsamps_per_buff, metadata, + io_type, send_mode + ); + } + + UHD_DEPRECATED UHD_INLINE size_t device::send( + const boost::asio::const_buffer &buff, + const tx_metadata_t &metadata, + const io_type_t &io_type, + send_mode_t send_mode + ){ + return this->send( + boost::asio::buffer_cast<const void *>(buff), + boost::asio::buffer_size(buff)/io_type.size, + metadata, io_type, send_mode + ); + } + + UHD_INLINE size_t device::recv( + void *buff, + size_t nsamps_per_buff, + rx_metadata_t &metadata, + const io_type_t &io_type, + recv_mode_t recv_mode + ){ + return this->recv( + std::vector<void *>(1, buff), + nsamps_per_buff, metadata, + io_type, recv_mode + ); + } + + UHD_DEPRECATED UHD_INLINE size_t device::recv( + const boost::asio::mutable_buffer &buff, + rx_metadata_t &metadata, + const io_type_t &io_type, + recv_mode_t recv_mode + ){ + return this->recv( + boost::asio::buffer_cast<void *>(buff), + boost::asio::buffer_size(buff)/io_type.size, + metadata, io_type, recv_mode + ); + } + +} //namespace uhd + +#endif /* INCLUDED_UHD_DEVICE_IPP */ |