Ejemplo n.º 1
0
void ThrowErrCode(int errCode, const std::string &where, int line)
{
    std::stringstream buffer;
    switch(errCode)
    {
    case -116:
        buffer << "TimeOut has elapsed in " << where << " line " << line;
        throw TimeOutException(buffer.str());
        break;
    case -3:
        buffer << "IO error in " << where << " line " << line;
        throw IOException(buffer.str());
        break;
    case -5:
         buffer << "Device not found or not responsing error in " << where << " line " << line;
        throw DeviceNotFoundException(buffer.str());
        break;
    default:
        if(errCode < 0)
        {
            buffer << "Unknown error in " << where << " line " << line << ". Error code = errCode ";
            throw Exception(buffer.str());
        }
    }
}
Ejemplo n.º 2
0
void Timer::check(double timeout) {
	if (VIRTUAL_TIMELAPSE()>timeout) throw TimeOutException();
	//Timer::stop();
	//time += Timer::VIRTUAL_TIMELAPSE();
	//if (time >=time_limit) throw TimeOutException();
	/*
if (Timer::RESIDENT_MEMORY() > 100000)
  {cout << "memory limit " << Timer::RESIDENT_MEMORY() << endl;
    throw MemoryException();
  }
	 */
	//Timer::start();
}
Ejemplo n.º 3
0
void Solver::time_limit_check () {
	Timer::stop();
	time += Timer::VIRTUAL_TIMELAPSE();
	if (time_limit >0 &&  time >=time_limit) throw TimeOutException();
	Timer::start();
}