USRP Hardware Driver and USRP Manual  Version: 004.000.000.HEAD-0-g8773fb2c
UHD and USRP Manual
muxed_zero_copy_if.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2016 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INCLUDED_LIBUHD_TRANSPORT_MUXED_ZERO_COPY_IF_HPP
19 #define INCLUDED_LIBUHD_TRANSPORT_MUXED_ZERO_COPY_IF_HPP
20 
22 #include <uhd/config.hpp>
23 #include <boost/function.hpp>
24 #include <boost/noncopyable.hpp>
25 #include <stdint.h>
26 
27 namespace uhd { namespace transport {
28 
38 class muxed_zero_copy_if : private boost::noncopyable {
39 public:
40  typedef boost::shared_ptr<muxed_zero_copy_if> sptr;
41 
52  typedef boost::function<uint32_t(void* buff, size_t size)> stream_classifier_fn;
53 
55  virtual ~muxed_zero_copy_if() {}
56 
58  virtual zero_copy_if::sptr make_stream(const uint32_t stream_num) = 0;
59 
61  virtual void remove_stream(const uint32_t stream_num) = 0;
62 
64  virtual size_t get_num_dropped_frames() const = 0;
65 
67  static sptr make(zero_copy_if::sptr base_xport, stream_classifier_fn classify_fn, size_t max_streams);
68 };
69 
70 }} //namespace uhd::transport
71 
72 #endif /* INCLUDED_LIBUHD_TRANSPORT_MUXED_ZERO_COPY_IF_HPP */
Definition: muxed_zero_copy_if.hpp:38
boost::shared_ptr< zero_copy_if > sptr
Definition: zero_copy.hpp:154
virtual ~muxed_zero_copy_if()
virtual dtor
Definition: muxed_zero_copy_if.hpp:55
Definition: build_info.hpp:25
boost::function< uint32_t(void *buff, size_t size)> stream_classifier_fn
Definition: muxed_zero_copy_if.hpp:52
virtual size_t get_num_dropped_frames() const =0
Get number of frames dropped due to unregistered streams.
virtual zero_copy_if::sptr make_stream(const uint32_t stream_num)=0
Make a virtual transport for the specified stream number.
boost::shared_ptr< muxed_zero_copy_if > sptr
Definition: muxed_zero_copy_if.hpp:40
static sptr make(zero_copy_if::sptr base_xport, stream_classifier_fn classify_fn, size_t max_streams)
Make a new demuxer from a transport and parameters.
virtual void remove_stream(const uint32_t stream_num)=0
Unregister the stream number. All packets destined to the stream will be dropped. ...