void AbstractInstructionWithParams::finalize() {
	if (params.size() == 2) {
		std::list<std::string>::iterator iter = params.begin();
		OperandFactory * factory = AbstractVM::getInstance()->getOperandFactory();
		std::string type = *iter;
		iter++;
		std::string value = *iter;
		operand = factory->createOperand(factory->retrieveFromString(type), value);
		return;
	}
	throw BadParamException();
}
示例#2
0
文件: Instruction.cpp 项目: T4lus/AVM
void Instruction::AInstructionParams::end()
{
  std::list<std::string>::iterator  it;
  OperandFactory                    *factory;
  eOperandType                      type;
  std::string                       str_type;
  std::string                       str_value;

  if (this->params.size() == 2)
  {
    it = this->params.begin();
    factory = AbstractVM::getVM()->getOperandFactory();
    str_type = *it;
    it++;
    str_value = *it;
    type = factory->getTypeFromString(str_type);
    this->op = factory->createOperand(type, str_value);
    return ;
  }
  throw WrongParameterException("wrong parameters");
}
示例#3
0
OperandFactory::OperandFactory(const OperandFactory &factory) :
		_stringFunctions(factory.get_stringFunctions()),
		_numberFunctions(factory.get_numberFunctions()),
		_names(factory.get_names()) {}