summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-02-10 14:24:51 -0800
committerJosh Blum <josh@joshknows.com>2011-02-10 14:24:51 -0800
commit08bad571b7e535bf665aec78d4468dbb231474a7 (patch)
tree1a3e10137b4c39d0890ebc21340dbdd6ba79dcab
parent1be2590962669f307dce24ccb0b0011b3f3f25f5 (diff)
downloaduhd-08bad571b7e535bf665aec78d4468dbb231474a7.tar.gz
uhd-08bad571b7e535bf665aec78d4468dbb231474a7.tar.bz2
uhd-08bad571b7e535bf665aec78d4468dbb231474a7.zip
uhd: use ref vector class for the conversion routines I/O
-rw-r--r--host/include/uhd/convert.hpp8
-rw-r--r--host/lib/convert/convert_common.hpp8
-rw-r--r--host/lib/transport/vrt_packet_handler.hpp4
-rw-r--r--host/tests/convert_test.cpp12
4 files changed, 16 insertions, 16 deletions
diff --git a/host/include/uhd/convert.hpp b/host/include/uhd/convert.hpp
index bfe8c8267..8fc2f38db 100644
--- a/host/include/uhd/convert.hpp
+++ b/host/include/uhd/convert.hpp
@@ -21,15 +21,15 @@
#include <uhd/config.hpp>
#include <uhd/types/io_type.hpp>
#include <uhd/types/otw_type.hpp>
+#include <uhd/types/ref_vector.hpp>
#include <boost/function.hpp>
#include <string>
-#include <vector>
namespace uhd{ namespace convert{
- typedef std::vector<void *> output_type;
- typedef std::vector<const void *> input_type;
- typedef boost::function<void(input_type&, output_type&, size_t)> function_type;
+ typedef uhd::ref_vector<void *> output_type;
+ typedef uhd::ref_vector<const void *> input_type;
+ typedef boost::function<void(const input_type&, const output_type&, size_t)> function_type;
/*!
* Describe the priority of a converter function.
diff --git a/host/lib/convert/convert_common.hpp b/host/lib/convert/convert_common.hpp
index c6ba1fcf9..c2ca233d9 100644
--- a/host/lib/convert/convert_common.hpp
+++ b/host/lib/convert/convert_common.hpp
@@ -25,16 +25,16 @@
#define DECLARE_CONVERTER(fcn, prio) \
static void fcn( \
- uhd::convert::input_type &inputs, \
- uhd::convert::output_type &outputs, \
+ const uhd::convert::input_type &inputs, \
+ const uhd::convert::output_type &outputs, \
size_t nsamps \
); \
UHD_STATIC_BLOCK(register_##fcn##_##prio){ \
uhd::convert::register_converter(#fcn, fcn, prio); \
} \
static void fcn( \
- uhd::convert::input_type &inputs, \
- uhd::convert::output_type &outputs, \
+ const uhd::convert::input_type &inputs, \
+ const uhd::convert::output_type &outputs, \
size_t nsamps \
)
diff --git a/host/lib/transport/vrt_packet_handler.hpp b/host/lib/transport/vrt_packet_handler.hpp
index 795d5bc62..6cb70cfac 100644
--- a/host/lib/transport/vrt_packet_handler.hpp
+++ b/host/lib/transport/vrt_packet_handler.hpp
@@ -68,7 +68,7 @@ template <typename T> UHD_INLINE T get_context_code(
size_t size_of_copy_buffs;
size_t fragment_offset_in_samps;
std::vector<void *> io_buffs;
- uhd::convert::input_type otw_buffs;
+ std::vector<const void *> otw_buffs;
recv_state(size_t width = 1):
width(width),
@@ -309,7 +309,7 @@ template <typename T> UHD_INLINE T get_context_code(
const boost::uint64_t zeros;
std::vector<const void *> zero_buffs;
std::vector<const void *> io_buffs;
- uhd::convert::output_type otw_buffs;
+ std::vector<void *> otw_buffs;
send_state(size_t width = 1):
next_packet_seq(0),
diff --git a/host/tests/convert_test.cpp b/host/tests/convert_test.cpp
index d3c235e9b..d1c2b7625 100644
--- a/host/tests/convert_test.cpp
+++ b/host/tests/convert_test.cpp
@@ -49,8 +49,8 @@ template <typename Range> static void loopback(
//item32 is largest device type
std::vector<boost::uint32_t> interm(nsamps);
- convert::input_type input0(1, &input[0]), input1(1, &interm[0]);
- convert::output_type output0(1, &interm[0]), output1(1, &output[0]);
+ std::vector<const void *> input0(1, &input[0]), input1(1, &interm[0]);
+ std::vector<void *> output0(1, &interm[0]), output1(1, &output[0]);
//convert to intermediate type
convert::get_converter_cpu_to_otw(
@@ -201,8 +201,8 @@ BOOST_AUTO_TEST_CASE(test_convert_types_fc32_to_sc16){
std::vector<boost::uint32_t> interm(nsamps);
std::vector<sc16_t> output(nsamps);
- convert::input_type input0(1, &input[0]), input1(1, &interm[0]);
- convert::output_type output0(1, &interm[0]), output1(1, &output[0]);
+ std::vector<const void *> input0(1, &input[0]), input1(1, &interm[0]);
+ std::vector<void *> output0(1, &interm[0]), output1(1, &output[0]);
//convert float to intermediate
convert::get_converter_cpu_to_otw(
@@ -241,8 +241,8 @@ BOOST_AUTO_TEST_CASE(test_convert_types_sc16_to_fc32){
std::vector<boost::uint32_t> interm(nsamps);
std::vector<fc32_t> output(nsamps);
- convert::input_type input0(1, &input[0]), input1(1, &interm[0]);
- convert::output_type output0(1, &interm[0]), output1(1, &output[0]);
+ std::vector<const void *> input0(1, &input[0]), input1(1, &interm[0]);
+ std::vector<void *> output0(1, &interm[0]), output1(1, &output[0]);
//convert short to intermediate
convert::get_converter_cpu_to_otw(