USRP Hardware Driver and USRP Manual
Version: 3.11.0.HEAD-0-ga1b5c4ae
UHD and USRP Manual
cast.hpp
Go to the documentation of this file.
1
//
2
// Copyright 2014-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_UTILS_CAST_HPP
9
#define INCLUDED_UHD_UTILS_CAST_HPP
10
11
#include <
uhd/config.hpp
>
12
#include <string>
13
#include <sstream>
14
15
namespace
uhd
{
namespace
cast{
17
//
18
// Example:
19
// uint16_t x = hexstr_cast<uint16_t>("0xDEADBEEF");
20
// Uses stringstream.
21
template
<
typename
T>
UHD_INLINE
T
hexstr_cast
(
const
std::string &in)
22
{
23
T x;
24
std::stringstream ss;
25
ss << std::hex << in;
26
ss >> x;
27
return
x;
28
}
29
30
}}
//namespace uhd::cast
31
32
#endif
/* INCLUDED_UHD_UTILS_CAST_HPP */
33
uhd::cast::hexstr_cast
UHD_INLINE T hexstr_cast(const std::string &in)
Convert a hexadecimal string into a value.
Definition:
cast.hpp:21
config.hpp
uhd
Definition:
build_info.hpp:14
UHD_INLINE
#define UHD_INLINE
Definition:
config.h:53
include
uhd
utils
cast.hpp
Generated by
1.8.13