aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-04-23 13:45:23 -0700
committerJosh Blum <josh@joshknows.com>2012-04-23 13:45:23 -0700
commit253be8f0da4a030e5060020e38afe6edcf927930 (patch)
treee16c8a4fcdaeb995f8e59342930e85f768e3d40a /host/tests
parentae40e8f5cc10288391961f48c5e55a719f2f80d7 (diff)
downloaduhd-253be8f0da4a030e5060020e38afe6edcf927930.tar.gz
uhd-253be8f0da4a030e5060020e38afe6edcf927930.tar.bz2
uhd-253be8f0da4a030e5060020e38afe6edcf927930.zip
uhd: squashed transport work
Diffstat (limited to 'host/tests')
-rw-r--r--host/tests/sph_recv_test.cpp13
-rw-r--r--host/tests/sph_send_test.cpp18
2 files changed, 10 insertions, 21 deletions
diff --git a/host/tests/sph_recv_test.cpp b/host/tests/sph_recv_test.cpp
index 9b45d7016..5a40029dc 100644
--- a/host/tests/sph_recv_test.cpp
+++ b/host/tests/sph_recv_test.cpp
@@ -50,16 +50,11 @@ public:
sptr get_new(boost::shared_array<char> mem, size_t len){
_mem = mem;
- _len = len;
- return make_managed_buffer(this);
+ return make(this, _mem.get(), len);
}
private:
- const void *get_buff(void) const{return _mem.get();}
- size_t get_size(void) const{return _len;}
-
boost::shared_array<char> _mem;
- size_t _len;
};
/***********************************************************************
@@ -89,8 +84,8 @@ public:
uhd::transport::managed_recv_buffer::sptr get_recv_buff(double){
if (_mems.empty()) return uhd::transport::managed_recv_buffer::sptr(); //timeout
- _mrbs.push_back(dummy_mrb());
- uhd::transport::managed_recv_buffer::sptr mrb = _mrbs.back().get_new(_mems.front(), _lens.front());
+ _mrbs.push_back(boost::shared_ptr<dummy_mrb>(new dummy_mrb()));
+ uhd::transport::managed_recv_buffer::sptr mrb = _mrbs.back()->get_new(_mems.front(), _lens.front());
_mems.pop_front();
_lens.pop_front();
return mrb;
@@ -99,7 +94,7 @@ public:
private:
std::list<boost::shared_array<char> > _mems;
std::list<size_t> _lens;
- std::list<dummy_mrb> _mrbs; //list means no-realloc
+ std::vector<boost::shared_ptr<dummy_mrb> > _mrbs;
std::string _end;
};
diff --git a/host/tests/sph_send_test.cpp b/host/tests/sph_send_test.cpp
index c31399d12..603b36c85 100644
--- a/host/tests/sph_send_test.cpp
+++ b/host/tests/sph_send_test.cpp
@@ -31,23 +31,17 @@
**********************************************************************/
class dummy_msb : public uhd::transport::managed_send_buffer{
public:
- void commit(size_t len){
- if (len == 0) return;
- *_len = len;
+ void release(void){
+ //NOP
}
sptr get_new(boost::shared_array<char> mem, size_t *len){
_mem = mem;
- _len = len;
- return make_managed_buffer(this);
+ return make(this, mem.get(), *len);
}
private:
- void *get_buff(void) const{return _mem.get();}
- size_t get_size(void) const{return *_len;}
-
boost::shared_array<char> _mem;
- size_t *_len;
};
/***********************************************************************
@@ -74,17 +68,17 @@ public:
}
uhd::transport::managed_send_buffer::sptr get_send_buff(double){
- _msbs.push_back(dummy_msb());
+ _msbs.push_back(boost::shared_ptr<dummy_msb>(new dummy_msb()));
_mems.push_back(boost::shared_array<char>(new char[1000]));
_lens.push_back(1000);
- uhd::transport::managed_send_buffer::sptr mrb = _msbs.back().get_new(_mems.back(), &_lens.back());
+ uhd::transport::managed_send_buffer::sptr mrb = _msbs.back()->get_new(_mems.back(), &_lens.back());
return mrb;
}
private:
std::list<boost::shared_array<char> > _mems;
std::list<size_t> _lens;
- std::list<dummy_msb> _msbs; //list means no-realloc
+ std::vector<boost::shared_ptr<dummy_msb> > _msbs;
std::string _end;
};