Loading...
Searching...
No Matches
ref_vector.hpp
Go to the documentation of this file.
//
// Copyright 2011 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <cstddef>
namespace uhd {
template <typename T>
class UHD_API ref_vector
{
public:
template <typename Ptr>
ref_vector(Ptr* ptr) : _ptr(T(ptr)), _mem(_mem_t(&_ptr)), _size(1)
{
/* NOP */
}
template <typename Vector>
ref_vector(const Vector& vec)
: _ptr(T()), _mem(_mem_t(&vec.front())), _size(vec.size())
{
/* NOP */
}
ref_vector(const T* mem, size_t len) : _ptr(T()), _mem(_mem_t(mem)), _size(len)
{
/* NOP */
}
const T& operator[](size_t index) const
{
return _mem[index];
}
size_t size(void) const
{
return _size;
}
private:
const T _ptr;
typedef T* _mem_t;
const _mem_t _mem;
const size_t _size;
};
} // 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