// // Cal_detPlane.cpp // #include "Cal_detPlane.h" // ================================================== // // ================================================== void Cal_DetPlane::add_cal_line (CString name, int line) { if ( line < 0 || line >= 4 ) return; int tmp[4], i, j; // ---> initilize tmp array <--- for ( i = 0; i < 4; i++ ) tmp[i] = -1; // ---> <---- i = 0; while ( i < 4 ) { if ( _ctrl_blk[i] == _T("") ) { _ctrl_blk[i] = name; } if ( _ctrl_blk[i] == name ) { for ( j = 0; j < 4; j++ ) { if ( _calLines [i][j] != -1 ) tmp [ _calLines [i][j] ] = 1; } tmp [line] = 1; _nLines[i] = 0; for ( j = 0; j < 4; j++ ) { if ( tmp [j] == 1 ) { _calLines [i][_nLines[i]] = j; _nLines[i] ++; } } i = 4; } i++; } } // =============================================== // reset // =============================================== void Cal_DetPlane::reset () { int i; for ( i = 0; i < 4; i++ ) { _ctrl_blk[i] = _T(""); _nLines[i] = 0; for ( int j = 0; j < 4; j++ ) { _calLines[i][j] = -1; } } } // ================================================== // // ================================================== void Cal_DetPlane::print () { int i, j; logFile << endl; for ( i = 0; i < 4; i++ ) { if ( _nLines[i] > 0 ) { logFile << "calLines " << _ctrl_blk[i] << " " << _nLines[i]; for ( j = 0; j < _nLines[i]; j++ ) { logFile << " " << _calLines[i][j]; } logFile << endl; } } } // ================================================== // // ================================================== int Cal_DetPlane::get_calLine (CString &name, int* data, int ind) { if ( ind < 0 || ind >= 4 ) return 0; if ( _nLines [ind] == 0 ) return 0; name = _ctrl_blk[ind]; for ( int i = 0; i < _nLines [ind]; i++ ) { data[i] = _calLines[ind][i]; } return _nLines [ind]; }