23 fin.open(
"/proc/mdstat");
27 for(
int i=0;i<4;i++) dstat[i] =
'?';
31 fin.read(mdstat, 1024);
33 mdstat[fin.gcount()] = 0;
37 std::string mdstr = mdstat;
39 int pos = mdstr.find(
"] [");
47 pos = mdstr.find(
"] [", pos+3);
54 dstat[0] = mdstr[pos+3];
55 dstat[1] = mdstr[pos+4];
59 pos = mdstr.find(
"] [", pos+3);
66 dstat[4] = mdstr[pos+3];
67 dstat[5] = mdstr[pos+4];
72 int save_preset(std::string calname,
double fw1pos,
int wollstat,
double fw2pos,
double fw3pos, std::vector<double> *vec)
75 std::ostringstream fname;
79 std::cerr <<
"Wollaston intermediate.\n";
82 if(wollstat < 0) wollstat = 0;
84 fname << getenv(
"VISAO_ROOT") <<
"/calib/visao/" << calname <<
"/presets/";
85 fname << (
int)(fw1pos + .5) << wollstat << (
int)(fw2pos + .5) << (
int)(fw3pos + .5) <<
".preset";
87 std::cout << fname.str() <<
"\n";
89 fout.open(fname.str().c_str(), std::ofstream::trunc);
93 std::cerr <<
"Preset " << fname.str() <<
" can't be created.\n";
97 for(
unsigned int i=0;i<vec->size();i++)
109 int get_focuscal(
double * fcal)
114 std::ostringstream fname;
117 fname << getenv(
"VISAO_ROOT") <<
"/calib/visao/focus/";
118 fname <<
"focus.cal";
120 presetf = fname.str();
123 fin.open(fname.str().c_str());
127 std::cerr <<
"Preset " << fname.str() <<
" not found.\n";
139 int get_preset(std::string calname,
double fw1pos,
int wollstat,
double fw2pos,
double fw3pos, std::vector<double> *vec, std::string & presetf)
143 std::ostringstream fname;
147 std::cerr <<
"Wollaston intermediate.\n";
150 if(wollstat < 0) wollstat = 0;
152 fname << getenv(
"VISAO_ROOT") <<
"/calib/visao/" << calname <<
"/presets/";
153 fname << (
int)(fw1pos + .5) << wollstat << (
int)(fw2pos + .5) << (
int)(fw3pos + .5) <<
".preset";
155 presetf = fname.str();
158 fin.open(fname.str().c_str());
162 std::cerr <<
"Preset " << fname.str() <<
" not found.\n";
166 for(
unsigned int i=0;i<vec->size();i++)
VisAO software utilitites, declarations.
#define SYS_N_LOGDRV
Number of logical drives in the system.