void LimitedIo::afterTimeout() { m_reason = EXCEED_TIME; getGlobalIoService().stop(); if (m_fixture != nullptr) { NDN_THROW(StopException()); } }
OperandInterface * OperandFloat::operator %(const OperandInterface& rhs) const { if (type < rhs.getType()) { return rhs + *this; } if (OperandFloat::stringToValue(rhs.toString())) { std::string result = OperandFloat::valueToString(fmod(value, OperandFloat::stringToValue(rhs.toString()))); return AbstractVM::getInstance()->getOperandFactory()->createOperand(type, result); } throw StopException("Modulo by zero!"); }
void SimplyControllable::stopIfStopWallEnabled(void) { if(m_stopWall_enabled) { m_stopWall_enabled = false; /* * No "stopped" signal is provided/emitted because if we had emitted a signal, * this would have only informed us that this controllable is about to stop BUT NOT THAT it has stopped. * So catching a thrown exception really comes in help here. */ throw StopException(); } }
void InstructionPrint::execute() { OperandInterface * operand = AbstractVM::getInstance()->getPile()->get(); std::stringstream ss; int ch; ss << operand->toString(); ss >> ch; if (ch < 256 && ch >= 0) { std::stringstream c; c << (char) ch; (*AbstractVM::getInstance()->getOut()) << c.str(); return; } throw StopException(); }
void LimitedIo::afterOp() { if (!m_isRunning) { // Do not proceed further if .afterOp() is invoked out of .run(), return; } --m_nOpsRemaining; if (m_nOpsRemaining <= 0) { m_reason = EXCEED_OPS; getGlobalIoService().stop(); if (m_fixture != nullptr) { NDN_THROW(StopException()); } } }