Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void calibrate::init_coeff(int type, double ***mapOut)
- {
- tstring coeffSectionName = _T("");
- tstring stageSectionName = _T("");
- switch (type)
- {
- case 0:
- stageSectionName = _T("TemperatureStage");
- coeffSectionName = _T("TemperatureCoeff");
- break;
- case 1:
- stageSectionName = _T("NonLinerStage");
- coeffSectionName = _T("NonLinerCoeff");
- break;
- }
- TCHAR* pBuf = new TCHAR[1024];
- int dwSize = GetPrivateProfileString(stageSectionName.c_str(), NULL, _T(""), pBuf, 1024, _strConfigFile.c_str());
- int iStageCount = std::count(pBuf, pBuf + dwSize, _T('\0'));
- *mapOut = new double*[iStageCount];//
- int powerNum = 5;
- for (int u = 0; u < iStageCount; ++u)
- {
- (*mapOut)[u] = new double[powerNum + 1];
- tstring keyName = _T("coeff")+to_tstring(u)+_T("_");
- tstring stageName = _T("stage_") + to_tstring(u);
- for (int v = 0; v < powerNum + 1; ++v)
- {
- TCHAR sz[64] = { 0 };
- GetPrivateProfileString(coeffSectionName.c_str(), (keyName + to_tstring(v)).c_str(), _T(""), sz, 64, _strConfigFile.c_str());
- (*mapOut)[u][v] = _ttof(sz);
- ListOut(_T("%s coeff_%d:%s"), coeffSectionName.c_str(), u, sz);
- }
- }
- delete[] pBuf;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement