3 #include <registryFunction.h>
6 #include <epicsString.h>
7 #include <epicsExport.h>
19 if (prec->fta != menuFtypeSTRING)
21 errlogSevPrintf(errlogMajor,
"%s incorrect input argument type A", prec->name);
24 if (prec->ftb != menuFtypeSTRING)
26 errlogSevPrintf(errlogMajor,
"%s incorrect input argument type B", prec->name);
29 if (prec->ftc != menuFtypeSTRING)
31 errlogSevPrintf(errlogMajor,
"%s incorrect input argument type C", prec->name);
35 std::string calibration_file_location =
find_file(prec->a, prec->b, prec->c);
36 std::ifstream calibration_file;
38 calibration_file.open(calibration_file_location);
40 std::vector<std::vector<std::string>> lines;
42 if (calibration_file.is_open())
45 while (calibration_file.peek() != EOF)
49 calibration_file.close();
53 double low_limit = std::stod(lines[0][0]);
54 double high_limit = std::stod(lines[lines.size() - 1][0]);
57 if (prec->ftva != menuFtypeDOUBLE) {
58 errlogSevPrintf(errlogMajor,
"%s incorrect output argument type A", prec->name);
61 if (prec->ftvb != menuFtypeDOUBLE) {
62 errlogSevPrintf(errlogMajor,
"%s incorrect output argument type B", prec->name);
67 (
static_cast<double*
>(prec->vala))[0] = high_limit;
68 (
static_cast<double*
>(prec->valb))[0] = low_limit;
70 catch (std::exception& e) {
71 errlogSevPrintf(errlogMajor,
"%s exception: %s", prec->name, e.what());
std::string find_file(void *BDIR, void *TDIR, void *SPEC)
Finds the directory to the table file.
long find_calibration_range_impl(aSubRecord *prec)
std::vector< std::string > getNextLineAndSplitOnComma(std::ifstream &str)
Gets the next line of an input stream and splits on a comma.