26typedef std::map<std::string, std::string>
Kwargs;
50template <
typename Type>
60template <
typename Type>
74 Range(
const double minimum,
const double maximum,
const double step=0.0);
77 double minimum(
void)
const;
80 double maximum(
void)
const;
83 double step(
void)
const;
86 double _min, _max, _step;
176template <
typename Type>
177typename std::enable_if<std::is_same<Type, bool>::value, Type>::type
StringToSetting(
const std::string &s)
187 char *str_end =
nullptr;
188 double d = std::strtod(s.c_str(), &str_end);
192 return (s == str_end) or ((d != 0.0) and (std::strlen(str_end) == 0));
193 }
catch (std::invalid_argument&) {
199template <
typename Type>
200typename std::enable_if<not std::is_same<Type, bool>::value and std::is_integral<Type>::value and std::is_signed<Type>::value, Type>::type
StringToSetting(
const std::string &s)
202 return Type(std::stoll(s));
205template <
typename Type>
206typename std::enable_if<not std::is_same<Type, bool>::value and std::is_integral<Type>::value and std::is_unsigned<Type>::value, Type>::type
StringToSetting(
const std::string &s)
208 return Type(std::stoull(s));
211template <
typename Type>
212typename std::enable_if<std::is_floating_point<Type>::value, Type>::type
StringToSetting(
const std::string &s)
214 return Type(std::stod(s));
217template <
typename Type>
218typename std::enable_if<std::is_same<typename std::decay<Type>::type, std::string>::value, Type>::type
StringToSetting(
const std::string &s)
238template <
typename Type>
241 return std::to_string(s);
246template <
typename Type>
252template <
typename Type>
#define SOAPY_SDR_API
Definition Config.h:41
#define SOAPY_SDR_FALSE
String definition for boolean false used in settings.
Definition Types.h:23
#define SOAPY_SDR_TRUE
String definition for boolean true used in settings.
Definition Types.h:20
ArgInfo(void)
Default constructor.
std::string units
The units of the argument: dB, Hz, etc (optional)
Definition Types.hpp:123
Range range
Definition Types.hpp:133
std::vector< std::string > options
Definition Types.hpp:139
std::string description
A brief description about the argument (optional)
Definition Types.hpp:120
std::vector< std::string > optionNames
Definition Types.hpp:145
std::string value
Definition Types.hpp:114
std::string name
The displayable name of the argument (optional, use key if empty)
Definition Types.hpp:117
std::string key
The key used to identify the argument (required)
Definition Types.hpp:107
Type
The data type of the argument (required)
Definition Types.hpp:126
@ BOOL
Definition Types.hpp:126
double maximum(void) const
Get the range maximum.
Definition Types.hpp:160
Range(const double minimum, const double maximum, const double step=0.0)
Create a min/max range.
double minimum(void) const
Get the range minimum.
Definition Types.hpp:155
double step(void) const
Get the range step size.
Definition Types.hpp:165
Range(void)
Create an empty range (0.0, 0.0)
std::enable_if< std::is_same< Type, bool >::value, Type >::type StringToSetting(const std::string &s)
Definition Types.hpp:177
std::string SettingToString(const bool &s)
Definition Types.hpp:223
Definition ConverterPrimitives.hpp:15
SOAPY_SDR_API Kwargs KwargsFromString(const std::string &markup)
std::vector< Range > RangeList
Definition Types.hpp:94
std::vector< ArgInfo > ArgInfoList
Definition Types.hpp:151
Type StringToSetting(const std::string &s)
Definition Types.hpp:247
SOAPY_SDR_API std::string KwargsToString(const Kwargs &args)
std::map< std::string, std::string > Kwargs
Typedef for a dictionary of key-value string arguments.
Definition Types.hpp:26
std::vector< Kwargs > KwargsList
Typedef for a list of key-word dictionaries.
Definition Types.hpp:41
std::string SettingToString(const Type &s)
Definition Types.hpp:253