14 #include <type_traits> 24 typedef std::map<std::string, std::string>
Kwargs;
48 template <
typename Type>
58 template <
typename Type>
72 Range(
const double minimum,
const double maximum,
const double step=0.0);
75 double minimum(
void)
const;
78 double maximum(
void)
const;
81 double step(
void)
const;
84 double _min, _max, _step;
124 enum Type {BOOL, INT, FLOAT, STRING} type;
174 template <
typename Type>
175 typename std::enable_if<std::is_same<Type, bool>::value, Type>::type
StringToSetting(
const std::string &s)
186 }
catch (std::invalid_argument&) {
192 template <
typename Type>
193 typename 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)
195 return Type(std::stoll(s));
198 template <
typename Type>
199 typename 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)
201 return Type(std::stoull(s));
204 template <
typename Type>
205 typename std::enable_if<std::is_floating_point<Type>::value, Type>::type
StringToSetting(
const std::string &s)
207 return Type(std::stod(s));
210 template <
typename Type>
211 typename std::enable_if<std::is_same<typename std::decay<Type>::type, std::string>::value, Type>::type
StringToSetting(
const std::string &s)
231 template <
typename Type>
234 return std::to_string(s);
239 template <
typename Type>
242 return SoapySDR::Detail::StringToSetting<Type>(s);
245 template <
typename Type>
std::enable_if< std::is_same< Type, bool >::value, Type >::type StringToSetting(const std::string &s)
Definition: Types.hpp:175
std::vector< Kwargs > KwargsList
Typedef for a list of key-word dictionaries.
Definition: Types.hpp:39
std::vector< ArgInfo > ArgInfoList
Definition: Types.hpp:149
#define SOAPY_SDR_TRUE
String definition for boolean true used in settings.
Definition: Types.h:20
double step(void) const
Get the range step size.
Definition: Types.hpp:163
Range range
Definition: Types.hpp:131
#define SOAPY_SDR_FALSE
String definition for boolean false used in settings.
Definition: Types.h:23
Type StringToSetting(const std::string &s)
Definition: Types.hpp:240
std::map< std::string, std::string > Kwargs
Typedef for a dictionary of key-value string arguments.
Definition: Types.hpp:24
double maximum(void) const
Get the range maximum.
Definition: Types.hpp:158
double minimum(void) const
Get the range minimum.
Definition: Types.hpp:153
std::vector< Range > RangeList
Definition: Types.hpp:92
std::string SettingToString(const bool &s)
Definition: Types.hpp:216
Definition: ConverterPrimitives.hpp:14
std::string description
A brief description about the argument (optional)
Definition: Types.hpp:118
SOAPY_SDR_API Kwargs KwargsFromString(const std::string &markup)
SOAPY_SDR_API std::string KwargsToString(const Kwargs &args)
#define SOAPY_SDR_API
Definition: Config.h:41
std::string SettingToString(const Type &s)
Definition: Types.hpp:246
std::vector< std::string > options
Definition: Types.hpp:137
std::string key
The key used to identify the argument (required)
Definition: Types.hpp:105
std::vector< std::string > optionNames
Definition: Types.hpp:143
std::string name
The displayable name of the argument (optional, use key if empty)
Definition: Types.hpp:115
std::string units
The units of the argument: dB, Hz, etc (optional)
Definition: Types.hpp:121
Type
The data type of the argument (required)
Definition: Types.hpp:124
std::string value
Definition: Types.hpp:112