USRP Hardware Driver and Device Manual Version: 4.10.0.0_release
UHD and USRP Manual
 
Loading...
Searching...
No Matches
cast.hpp File Reference
#include <uhd/config.hpp>
#include <uhd/exception.hpp>
#include <type_traits>
#include <complex>
#include <cstdint>
#include <iomanip>
#include <ios>
#include <limits>
#include <locale>
#include <sstream>
#include <string>

Go to the source code of this file.

Namespaces

namespace  uhd
 
namespace  uhd::cast
 
namespace  uhd::cast::detail
 Template implementations for uhd::cast::to_str() for common types.
 

Typedefs

template<typename T >
using uhd::cast::detail::has_to_string_method = decltype(has_to_string_method_impl<T>(0))
 

Functions

template<typename T >
uhd::cast::hexstr_cast (const std::string &in)
 Convert a hexadecimal string into a value.
 
template<typename T >
uhd::cast::fromstr_cast (const std::string &in)
 
template<typename data_t >
data_t uhd::cast::from_str (const std::string &val)
 Generic cast-from-string function.
 
template<>
UHD_API bool uhd::cast::from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for Boolean values.
 
template<>
UHD_API double uhd::cast::from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for double-precision values.
 
template<>
UHD_API int uhd::cast::from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for integer values.
 
template<>
UHD_API uint8_t uhd::cast::from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for uint8_t values.
 
template<>
UHD_API uint16_t uhd::cast::from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for uint16_t values.
 
template<>
UHD_API uint32_t uhd::cast::from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for uint32_t values.
 
template<>
UHD_API uint64_t uhd::cast::from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for uint64_t values.
 
template<>
UHD_API std::string uhd::cast::from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for strings.
 
UHD_API std::string uhd::cast::to_ordinal_string (int val)
 Create an ordinal string from a number.
 
template<typename T >
auto uhd::cast::detail::has_to_string_method_impl (int) -> decltype(std::declval< T >().to_string(), std::true_type{})
 
template<typename T >
auto uhd::cast::detail::has_to_string_method_impl (...) -> std::false_type
 
template<typename T >
auto uhd::cast::to_str (const T &val) -> std::enable_if_t< std::is_arithmetic_v< T > &&!std::is_floating_point_v< T > &&!std::is_same_v< T, int8_t > &&!std::is_same_v< T, uint8_t > &&!std::is_enum_v< T > &&!detail::has_to_string_method< T >::value, decltype(std::to_string(val))>
 SFINAE-based template for integer types that std::to_string can handle.
 
template<typename T >
std::string uhd::cast::to_str (const std::complex< T > &val)
 SFINAE-based template for std::complex<T> types.
 
std::string uhd::cast::to_str (const std::string &val)
 Overload for std::string and C-style strings.
 
std::string uhd::cast::to_str (const char *val)