Commit 054fb1e5 authored by Achim Morschhauser's avatar Achim Morschhauser
Browse files

Exceptions parse_adc added

parent 0d12fd6f
......@@ -141,6 +141,8 @@ int Obs_Calibration_Vector::get_adc_calibrate(std::string config,
scale = cal.scale;
offset = cal.offset;
} else {
scale = "";
offset = "";
return(-1);
}
......@@ -263,9 +265,9 @@ int Obs_Calibration_Vector::add_adc_calibrate(std::string config,
if (file.is_open()) {
while ( getline (file,line) ) {
// Parse from line
parse_adc_calibration(line,config,cal);
// Save key-value pair
map_ADC[config]=cal;
if (parse_adc_calibration(line,config,cal))
// Save key-value pair
map_ADC[config]=cal;
}
file.close();
} else {
......@@ -295,13 +297,18 @@ int Obs_Calibration_Vector::add_adc_calibrate(std::string config,
std::string& config, struct adc_cal& cal, std::string& comment) {
size_t pos_c;
comment="";
// Find comment token ("#")
if (line.length()<=0) return(-1);
pos_c=line.find('#');
comment=line.substr(pos_c);
// Proceed with uncommented part
line=line.substr(0,pos_c);
if (pos_c < std::string::npos){
comment=line.substr(pos_c);
line=line.substr(0,pos_c);
}
if (line.size()==0) return(-1);
std::cerr << "PARSE: " << line << std::endl;
// Find configuration string
pos_c=line.find(',');
config=line.substr(0,pos_c);
......
......@@ -3,5 +3,4 @@
# Tatuoca
OD-56A17021/0223/0,3AEC9C,00028E;
OD-56A17021/0223/1,3AEC9C,00028E;
OD-56A17021/0223/2,3AEC9C,00028E;
OD-56A17021/0223/2,3AEC9C,00028E;
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment