int InputDriverAbstract::initialize()
{
	int ret;

	ret = openDevice();
	if (ret < 0) {
		finalize();
		return ret;
	}
	ret = guessDeviceType();
	if (ret < 0) {
		finalize();
		return ret;
	}
	ret = initMapping();
	if (ret < 0) {
		finalize();
		return ret;
	}
	ret = validate();
	if (ret < 0) {
		finalize();
		return ret;
	}
	return 0;
}
예제 #2
0
	/* Constructors */
	SoundConfig::SoundConfig(const Colour3f	&colour, unsigned int sampleId, bool isEnabled)
	{
		this->colour    = colour;
		this->sampleId  = sampleId;
        this->isEnabled = isEnabled;

		initMapping();
	}
예제 #3
0
void CReactionInterface::setFunctionWithEmptyMapping(const std::string & fn)
{
  if ((fn == "") || (fn == "undefined"))
    {clearFunction(); return;}

  //get the function
  mpFunction = dynamic_cast<CFunction *>
               (CCopasiRootContainer::getFunctionList()->findLoadFunction(fn));

  if (!mpFunction) fatalError();

  pdelete(mpParameters);
  initMapping(); //empty mapping
}
예제 #4
0
DediArkMainWindow::DediArkMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::DediArkMainWindow)
{
    ui->setupUi(this);
    container = SettingContainer::DefaultSettings();

    initMapping();

    mapSettings();

    ui->scrollAreaWidgetContents->setLayout(ui->verticalSettings);
    ui->tabServerSetting->setLayout(ui->layoutSettings);
}
예제 #5
0
tags::Tags::Tags(QString path)
{
    initMapping();
    initGenres();

    FILE *fd = fopen(qPrintable(path), "rb");
    if (fd)
    {
        qDebug() << "parsing tags of" << path;
        parse(fd);
        fclose(fd);
    }
    else
    {
        qDebug() << "error opening file" << path;
    }
}
예제 #6
0
void CReactionInterface::copyMapping()
{
  if (!mpParameters) //nothing to copy
    {
      initMapping();
      return;
    }

  // save the old information
  CFunctionParameters *oldParameters = mpParameters;
  std::vector<std::vector<std::string> > oldMap = mNameMap;
  std::vector<C_FLOAT64> oldValues = mValues;
  std::vector<bool> oldIsLocal = mIsLocal;

  //create new mapping
  initMapping();

  //try to preserve as much information from the old mapping as possible
  size_t j, jmax = oldParameters->size();
  size_t i, imax = size();

  for (i = 0; i < imax; ++i)
    {
      //find parameter with same name in old parameters
      for (j = 0; j < jmax; ++j)
        if ((*oldParameters)[j]->getObjectName() == getParameterName(i)) break;

      if (j == jmax) continue;

      //see if usage matches
      if (getUsage(i) != (*oldParameters)[j]->getUsage()) continue;

      //see if vector property matches
      if (isVector(i) != ((*oldParameters)[j]->getType() == CFunctionParameter::VFLOAT64))
        continue;

      mIsLocal[i] = oldIsLocal[j];
      mValues[i] = oldValues[j];

      switch (getUsage(i))
        {
          case CFunctionParameter::SUBSTRATE:
          case CFunctionParameter::PRODUCT:
            //TODO: check with chemeq
            mNameMap[i] = oldMap[j];
            break;

          case CFunctionParameter::MODIFIER:
            //TODO: check existence?
            mNameMap[i] = oldMap[j];
            //TODO: add to chemeq
            break;

          case CFunctionParameter::PARAMETER:
          case CFunctionParameter::VOLUME:
          case CFunctionParameter::TIME:
            //TODO: check existence?
            mNameMap[i] = oldMap[j];
            break;

          default:
            break;
        }
    }

  pdelete(oldParameters);
}
예제 #7
0
CompactTxFinder::CompactTxFinder(const CTxMemPool& m,
        uint64_t idk0, uint64_t idk1) : mempool(m) {
    initMapping(idk0, idk1);
}