USRP Hardware Driver and Device Manual Version: 4.10.0.0_release
UHD and USRP Manual
 
Loading...
Searching...
No Matches
uhd::cast Namespace Reference

Namespaces

namespace  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.
 
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.
 
template<>
UHD_API bool from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for Boolean values.
 
template<>
UHD_API double from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for double-precision values.
 
template<>
UHD_API int from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for integer values.
 
template<>
UHD_API uint8_t from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for uint8_t values.
 
template<>
UHD_API uint16_t from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for uint16_t values.
 
template<>
UHD_API uint32_t from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for uint32_t values.
 
template<>
UHD_API uint64_t from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for uint64_t values.
 
template<>
UHD_API std::string from_str (const std::string &val)
 Specialization of uhd::cast::from_str() for strings.
 
UHD_API std::string to_ordinal_string (int val)
 Create an ordinal string from a number.
 
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.
 
template<typename T >
std::string to_str (const std::complex< T > &val)
 SFINAE-based template for std::complex<T> types.
 
std::string to_str (const std::string &val)
 Overload for std::string and C-style strings.
 
std::string to_str (const char *val)
 

Function Documentation

◆ from_str() [1/9]

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

Generic cast-from-string function.

◆ from_str() [2/9]

template<>
UHD_API bool 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 Boolean values.

◆ from_str() [3/9]

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

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

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

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

◆ from_str() [4/9]

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

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

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

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

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

◆ from_str() [5/9]

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

Specialization of uhd::cast::from_str() for uint8_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.

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

◆ from_str() [6/9]

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

Specialization of uhd::cast::from_str() for uint16_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.

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

◆ from_str() [7/9]

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

Specialization of uhd::cast::from_str() for uint32_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.

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

◆ from_str() [8/9]

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

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

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.

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

◆ from_str() [9/9]

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

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.

Specialization of uhd::cast::from_str() for Boolean 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.