USRP Hardware Driver and Device Manual  Version: 4.10.0.0-0-g2af4ddb9
UHD and USRP Manual
uhd::cast Namespace Reference

Namespaces

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

Functions

template<typename T >
hexstr_cast (const std::string &in)
 Convert a hexadecimal string into a value. More...
 
template<typename T >
fromstr_cast (const std::string &in)
 
template<typename data_t >
data_t from_str (const std::string &val)
 Generic cast-from-string function. More...
 
template<>
UHD_API bool from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for Boolean values. More...
 
UHD_API std::string to_ordinal_string (int val)
 Create an ordinal string from a number. More...
 
template<typename T >
auto 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. More...
 
template<typename T >
std::string to_str (const std::complex< T > &val)
 SFINAE-based template for std::complex<T> types. More...
 
std::string to_str (const std::string &val)
 Overload for std::string and C-style strings. More...
 
std::string to_str (const char *val)
 

Function Documentation

◆ from_str() [1/2]

template<typename data_t >
data_t uhd::cast::from_str ( const std::string &  val)

Generic cast-from-string function.

◆ from_str() [2/2]

template<>
UHD_API std::string uhd::cast::from_str ( const std::string &  val)
inline

Specialization of uhd::cast::from_str() for Boolean values.

Specialization of uhd::cast::from_str() for strings.

Specialization of uhd::cast::from_str() for uint64_t values.

Specialization of uhd::cast::from_str() for uint32_t values.

Specialization of uhd::cast::from_str() for uint16_t values.

Specialization of uhd::cast::from_str() for uint8_t values.

Specialization of uhd::cast::from_str() for integer values.

Specialization of uhd::cast::from_str() for double-precision values.

◆ fromstr_cast()

template<typename T >
T uhd::cast::fromstr_cast ( const std::string &  in)
inline

Convert hexadecimal, decimal, octal or other strings that support the >> operator into a value depending on the prefix.

◆ hexstr_cast()

template<typename T >
T uhd::cast::hexstr_cast ( const std::string &  in)
inline

Convert a hexadecimal string into a value.

◆ to_ordinal_string()

UHD_API std::string uhd::cast::to_ordinal_string ( int  val)

Create an ordinal string from a number.

◆ to_str() [1/4]

std::string uhd::cast::to_str ( const char *  val)
inline

◆ to_str() [2/4]

template<typename T >
std::string uhd::cast::to_str ( const std::complex< T > &  val)

SFINAE-based template for std::complex<T> types.

◆ to_str() [3/4]

std::string uhd::cast::to_str ( const std::string &  val)
inline

Overload for std::string and C-style strings.

◆ to_str() [4/4]

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.

SFINAE-based template for any type that has a to_string() method.

Template specialization for uint8_t.

Template specialization for int8_t.

Template for floating-point types with round-trip safe precision.

SFINAE-based template for enum types.