USRP Hardware Driver and USRP Manual Version: 3.15.0.0-MacPorts-Release
UHD and USRP Manual
 
Loading...
Searching...
No Matches
byte_vector.hpp
Go to the documentation of this file.
1//
2// Copyright 2015 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#ifndef INCLUDED_UHD_TYPES_BYTE_VECTOR_HPP
9#define INCLUDED_UHD_TYPES_BYTE_VECTOR_HPP
10
11#include <uhd/config.hpp>
12#include <boost/range.hpp>
13#include <algorithm>
14#include <string>
15#include <vector>
16
17namespace uhd {
18
20typedef std::vector<uint8_t> byte_vector_t;
21
22template <typename RangeSrc, typename RangeDst>
23UHD_INLINE void byte_copy(const RangeSrc& src, RangeDst& dst)
24{
25 std::copy(boost::begin(src), boost::end(src), boost::begin(dst));
26}
27
29UHD_API std::string bytes_to_string(const byte_vector_t& bytes);
30
32UHD_API byte_vector_t string_to_bytes(const std::string& str, size_t max_length);
33
34} // namespace uhd
35
36#endif /* INCLUDED_UHD_TYPES_BYTE_VECTOR_HPP */
#define UHD_INLINE
Definition config.h:53
#define UHD_API
Definition config.h:68
Definition build_info.hpp:13
std::vector< uint8_t > byte_vector_t
Byte vector used for I2C data passing and EEPROM parsing.
Definition byte_vector.hpp:20
UHD_API byte_vector_t string_to_bytes(const std::string &str, size_t max_length)
Create a byte vector from a string, end at null terminator or max length.
UHD_INLINE void byte_copy(const RangeSrc &src, RangeDst &dst)
Definition byte_vector.hpp:23
UHD_API std::string bytes_to_string(const byte_vector_t &bytes)
Create a string from a byte vector, terminate when invalid ASCII encountered.