mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-13 19:29:08 -04:00
Save/Load and persist SoapySDR device settings
This commit is contained in:
@@ -356,6 +356,31 @@ DataElementGetNumericVectorDef(DATA_FLOAT_VECTOR, float, DATA_DOUBLE_VECTOR, DAT
|
||||
DataElementGetNumericVectorDef(DATA_DOUBLE_VECTOR, double, DATA_FLOAT_VECTOR, DATA_LONGDOUBLE_VECTOR);
|
||||
DataElementGetNumericVectorDef(DATA_LONGDOUBLE_VECTOR, long double, DATA_DOUBLE_VECTOR, DATA_FLOAT_VECTOR);
|
||||
|
||||
std::string DataElement::toString() {
|
||||
int dataType = getDataType();
|
||||
std::string strValue = "";
|
||||
|
||||
try {
|
||||
if (dataType == DATA_STRING) {
|
||||
get(strValue);
|
||||
} else if (dataType == DATA_INT || dataType == DATA_LONG || dataType == DATA_LONGLONG) {
|
||||
long long intSettingValue;
|
||||
get(intSettingValue);
|
||||
strValue = std::to_string(intSettingValue);
|
||||
} else if (dataType == DATA_FLOAT || dataType == DATA_DOUBLE) {
|
||||
double floatSettingValue;
|
||||
get(floatSettingValue);
|
||||
strValue = std::to_string(floatSettingValue);
|
||||
} else {
|
||||
std::cout << "Unhandled DataElement toString for type: " << dataType << std::endl;
|
||||
}
|
||||
} catch (DataTypeMismatchException e) {
|
||||
std::cout << "toString() DataTypeMismatch: " << dataType << std::endl;
|
||||
}
|
||||
|
||||
return strValue;
|
||||
}
|
||||
|
||||
|
||||
long DataElement::getSerializedSize() {
|
||||
return sizeof(int) + sizeof(long) + data_size;
|
||||
|
||||
@@ -207,6 +207,7 @@ public:
|
||||
double getDouble() throw (DataTypeMismatchException) { double d_get; get(d_get); return d_get; };
|
||||
long double getLongDouble() throw (DataTypeMismatchException) { long double d_get; get(d_get); return d_get; };
|
||||
|
||||
std::string toString();
|
||||
|
||||
/* serialize functions */
|
||||
long getSerializedSize();
|
||||
|
||||
Reference in New Issue
Block a user