From b2054a45d45ba85e30ff601159b18f5ebd15dd76 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 2 Jun 2010 17:44:20 -0700 Subject: Created macros for dealing with pimpls and implemented in code. --- host/lib/transport/zero_copy.cpp | 7 +++---- host/lib/usrp/dboard_base.cpp | 8 ++++---- host/lib/usrp/usrp2/io_impl.cpp | 2 +- host/lib/usrp/usrp2/usrp2_impl.hpp | 3 ++- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'host/lib') diff --git a/host/lib/transport/zero_copy.cpp b/host/lib/transport/zero_copy.cpp index f69fd2774..27f41329b 100644 --- a/host/lib/transport/zero_copy.cpp +++ b/host/lib/transport/zero_copy.cpp @@ -58,12 +58,12 @@ struct phony_zero_copy_recv_if::impl{ }; phony_zero_copy_recv_if::phony_zero_copy_recv_if(size_t max_buff_size){ - _impl = new impl; + _impl = UHD_PIMPL_MAKE(impl, ()); _impl->max_buff_size = max_buff_size; } phony_zero_copy_recv_if::~phony_zero_copy_recv_if(void){ - delete _impl; + /* NOP */ } managed_recv_buffer::sptr phony_zero_copy_recv_if::get_recv_buff(void){ @@ -122,7 +122,7 @@ struct phony_zero_copy_send_if::impl{ }; phony_zero_copy_send_if::phony_zero_copy_send_if(size_t max_buff_size){ - _impl = new impl; + _impl = UHD_PIMPL_MAKE(impl, ()); _impl->send_mem = new boost::uint8_t[max_buff_size]; _impl->send_buff = managed_send_buffer::sptr(new managed_send_buffer_impl( boost::asio::buffer(_impl->send_mem, max_buff_size), @@ -132,7 +132,6 @@ phony_zero_copy_send_if::phony_zero_copy_send_if(size_t max_buff_size){ phony_zero_copy_send_if::~phony_zero_copy_send_if(void){ delete [] _impl->send_mem; - delete _impl; } managed_send_buffer::sptr phony_zero_copy_send_if::get_send_buff(void){ diff --git a/host/lib/usrp/dboard_base.cpp b/host/lib/usrp/dboard_base.cpp index bd4b37ef3..eafb8897f 100644 --- a/host/lib/usrp/dboard_base.cpp +++ b/host/lib/usrp/dboard_base.cpp @@ -25,17 +25,17 @@ using namespace uhd::usrp; /*********************************************************************** * dboard_base dboard dboard_base class **********************************************************************/ -struct dboard_base::dboard_base_impl{ +struct dboard_base::impl{ ctor_args_impl args; - dboard_base_impl(ctor_args_t args) : args(*args){} + impl(ctor_args_t args) : args(*args){} }; dboard_base::dboard_base(ctor_args_t args){ - _impl = new dboard_base_impl(args); + _impl = UHD_PIMPL_MAKE(impl, (args)); } dboard_base::~dboard_base(void){ - delete _impl; + /* NOP */ } std::string dboard_base::get_subdev_name(void){ diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 5d425bd8a..18f2d013f 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -122,7 +122,7 @@ void usrp2_impl::io_init(void){ std::cout << "TX samples per packet: " << get_max_send_samps_per_packet() << std::endl; //create new io impl - _io_impl = boost::shared_ptr(new io_impl(_data_transport)); + _io_impl = UHD_PIMPL_MAKE(io_impl, (_data_transport)); } /*********************************************************************** diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index bb4554e8d..40c193866 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -23,6 +23,7 @@ #include "codec_ctrl.hpp" #include "serdes_ctrl.hpp" #include +#include #include #include #include @@ -153,7 +154,7 @@ private: ; uhd::otw_type_t _rx_otw_type, _tx_otw_type; - struct io_impl; boost::shared_ptr _io_impl; + UHD_PIMPL_DECL(io_impl) _io_impl; void io_init(void); //udp transports for control and data -- cgit v1.2.3