예제 #1
0
void
LimitedIo::afterTimeout()
{
  m_reason = EXCEED_TIME;
  getGlobalIoService().stop();
  if (m_fixture != nullptr) {
    NDN_THROW(StopException());
  }
}
예제 #2
0
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!");
}
예제 #3
0
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();
    }
}
예제 #4
0
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();
}
예제 #5
0
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());
    }
  }
}