| USRP Hardware Driver and Device Manual Version: 4.10.0.0 UHD and USRP Manual |

Loading...
Searching...
No Matches
buffer_pool.hpp
Go to the documentation of this file.
1//
2// Copyright 2011,2014 Ettus Research LLC
3// Copyright 2018 Ettus Research, a National Instruments Company
4//
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
7
8#pragma once
9
10#include <uhd/config.hpp>
11#include <uhd/utils/noncopyable.hpp>
12#include <cstddef>
13#include <memory>
14#include <vector>
15
16 namespace uhd { namespace transport {
17
22 class UHD_API buffer_pool : uhd::noncopyable
23{
24 public:
25 typedef std::shared_ptr<buffer_pool> sptr;
26 typedef void* ptr_type;
27
28 ~buffer_pool() = default;
29
37 static sptr make(
38 const size_t num_buffs, const size_t buff_size, const size_t alignment = 16);
39
41 ptr_type at(const size_t index) const
42 {
43 return _ptrs.at(index);
44 }
45
47 size_t size() const
48 {
49 return _ptrs.size();
50 }
51
52 private:
53 buffer_pool(std::vector<ptr_type>&& ptrs, std::unique_ptr<char[]> mem)
54 : _ptrs(std::move(ptrs)), _mem(std::move(mem))
55 {
56 }
57
58 std::vector<ptr_type> _ptrs;
59 std::unique_ptr<char[]> _mem;
60};
61
62}} // namespace uhd::transport
uhd::transport::buffer_pool
Definition buffer_pool.hpp:23
uhd::transport::buffer_pool::make
static sptr make(const size_t num_buffs, const size_t buff_size, const size_t alignment=16)
uhd::transport::buffer_pool::at
ptr_type at(const size_t index) const
Get a pointer to the buffer start at the specified index.
Definition buffer_pool.hpp:41
uhd::transport::buffer_pool::sptr
std::shared_ptr< buffer_pool > sptr
Definition buffer_pool.hpp:25
uhd::transport::buffer_pool::size
size_t size() const
Get the number of buffers in this pool.
Definition buffer_pool.hpp:47
uhd::transport::buffer_pool::~buffer_pool
~buffer_pool()=default
uhd::transport::buffer_pool::ptr_type
void * ptr_type
Definition buffer_pool.hpp:26
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
std
STL namespace.
uhd::transport
Definition adapter_id.hpp:11
uhd
Definition build_info.hpp:12
uhd::noncopyable
boost::noncopyable noncopyable
Definition noncopyable.hpp:45
noncopyable.hpp