| USRP Hardware Driver and USRP Manual Version: 4.9.0.makepkg-0-g9ec1f582 UHD and USRP Manual |

Loading...
Searching...
No Matches
ref_vector.hpp
Go to the documentation of this file.
1//
2// Copyright 2011 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 <cstddef>
12
13 namespace uhd {
14
20 template <typename T>
21 class UHD_API ref_vector
22{
23 public:
29 template <typename Ptr>
30 ref_vector(Ptr* ptr) : _ptr(T(ptr)), _mem(_mem_t(&_ptr)), _size(1)
31 {
32 /* NOP */
33 }
34
40 template <typename Vector>
41 ref_vector(const Vector& vec)
42 : _ptr(T()), _mem(_mem_t(&vec.front())), _size(vec.size())
43 {
44 /* NOP */
45 }
46
53 ref_vector(const T* mem, size_t len) : _ptr(T()), _mem(_mem_t(mem)), _size(len)
54 {
55 /* NOP */
56 }
57
59 const T& operator[](size_t index) const
60 {
61 return _mem[index];
62 }
63
65 size_t size(void) const
66 {
67 return _size;
68 }
69
70 private:
71 const T _ptr;
72 typedef T* _mem_t;
73 const _mem_t _mem;
74 const size_t _size;
75};
76
77} // namespace uhd
uhd::ref_vector::ref_vector
ref_vector(const T *mem, size_t len)
Definition ref_vector.hpp:53
uhd::ref_vector< void * >::size
size_t size(void) const
Definition ref_vector.hpp:65
uhd::ref_vector::ref_vector
ref_vector(const Vector &vec)
Definition ref_vector.hpp:41
uhd::ref_vector::ref_vector
ref_vector(Ptr *ptr)
Definition ref_vector.hpp:30
uhd::ref_vector::operator[]
const T & operator[](size_t index) const
Index operator gets the value of rv[index].
Definition ref_vector.hpp:59
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
uhd
Definition build_info.hpp:12