当前位置: 首页>>代码示例>>C++>>正文


C++ ParameterList::size方法代码示例

本文整理汇总了C++中ParameterList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterList::size方法的具体用法?C++ ParameterList::size怎么用?C++ ParameterList::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParameterList的用法示例。


在下文中一共展示了ParameterList::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: help

		virtual void help(const string &command, ParameterList &params) const
		{
			if (command == "-i" || command == "--input" || command == "-o" || command == "--output") {
				cout << "Set current input/output file.\n"
					 << "Usage:\n"
					 << "\tmesher ((--input|-i)|(--output|-o)) (path)\n\n"
					 << "The command is transitory and passive.\n"
					 << "Any further instance of the command will override any previous one.\n"
					 << "Executive commands will use the most recently bound pathname.\n"
					 << endl;
				params.clear();
			} else if (command == "-c" || command == "--convert") {
				string inf,outf,op;
				if (0 < params.size())
					inf = params[0];
				if (1 < params.size())
					outf = params[1];
				if (2 < params.size())
					op = params[2];
				params.clear();

				ConversionImplList& registry = getRegistry();
				for (ConversionImplList::iterator cit=registry.begin(); cit!=registry.end(); ++cit)
					cit->second->conversionHelp(inf, outf, op);
			} else {
				cerr << "Warning: ConvertHandler::help() received an unrecognized command" << endl;
			}
		}
开发者ID:zonkmachine,项目名称:vegastrike,代码行数:28,代码来源:Convert.cpp

示例2: lift2PL

ParameterList lift2PL(const ParameterList& pl1,const ParameterList& pl2,
                      std::function<matrix::Matrix (const matrix::Matrix&, const matrix::Matrix&)> fun){
  ParameterList res;
  assert(pl1.size()==pl2.size());
  FOREACH2(pl1, pl2, p1, p2){
    res.push_back(fun(*p1,*p2));
  }
开发者ID:CentreForBioRobotics,项目名称:lpzrobots,代码行数:7,代码来源:parametrizable.cpp

示例3: same_parameters

bool TypeRegistry::same_parameters(const ParameterList &p1, const ParameterList &p2) const
{
    if (p1.size() != p2.size()) return false;
    ParameterList::const_iterator j=p2.begin();
    for (ParameterList::const_iterator i=p1.begin(); i!=p1.end(); ++i, ++j)
    {
        if (TypeNameUtils::trim(i->type_specifier) != TypeNameUtils::trim(j->type_specifier))
            return false;
    }
    return true;
}
开发者ID:comicfans44,项目名称:cppintrospection,代码行数:11,代码来源:TypeRegistry.cpp

示例4: generateXML

QString ExportHelper::generateXML(QString qtext, QString tableElemName, ParameterList &params, QString &errmsg, int xsltmapid)
{
  if (DEBUG)
    qDebug("ExportHelper::generateXML(%s..., %s, %d params, errmsg, %d) entered",
           qPrintable(qtext.left(80)), qPrintable(tableElemName),
           params.size(), xsltmapid);
  if (DEBUG)
  {
    QStringList plist;
    for (int i = 0; i < params.size(); i++)
      plist.append("\t" + params.name(i) + ":\t" + params.value(i).toString());
    qDebug("generateXML parameters:\n%s", qPrintable(plist.join("\n")));
  }

  QDomDocument xmldoc("xtupleimport");
  QDomElement rootelem = xmldoc.createElement("xtupleimport");
  xmldoc.appendChild(rootelem);

  if (! qtext.isEmpty())
  {
    MetaSQLQuery mql(qtext);
    XSqlQuery qry = mql.toQuery(params);
    if (qry.first())
    {
      do {
        QDomElement tableElem = xmldoc.createElement(tableElemName);

        if (DEBUG)
          qDebug("generateXML starting %s", qPrintable(tableElemName));
        for (int i = 0; i < qry.record().count(); i++)
        {
          QDomElement fieldElem = xmldoc.createElement(qry.record().fieldName(i));
          if (qry.record().value(i).isNull())
            fieldElem.appendChild(xmldoc.createTextNode("[NULL]"));
          else
            fieldElem.appendChild(xmldoc.createTextNode(qry.record().value(i).toString()));
          tableElem.appendChild(fieldElem);
        }
        rootelem.appendChild(tableElem);
      } while (qry.next());
    }
    if (qry.lastError().type() != QSqlError::NoError)
      errmsg = qry.lastError().text();
  }

  if (xsltmapid < 0)
    return xmldoc.toString();
  else
    return XSLTConvertString(xmldoc.toString(), xsltmapid, errmsg);
}
开发者ID:ChristopherCotnoir,项目名称:qt-client,代码行数:50,代码来源:exporthelper.cpp

示例5: CallFunction

// This method calls an existing function with a parameter list
CFunctionCallAttempt CFunctionWrapper::CallFunction(std::string sFunctionName, ParameterList lParameterList)
{
    // The object we'll return to the script
    CReturnValue oReturnValue;

    // Loop through all the functions
    for(FunctionList::iterator iterator = m_lFunctionList.begin(); iterator != m_lFunctionList.end(); iterator++)
    {
        // Do we have a function name match?
        if((*iterator).m_sName == sFunctionName)
        {
            // Do we have enough parameters? (are the parameter lists equally big?)
            if((*iterator).m_lParameterTypes.size() != lParameterList.size())
            {
                // Setup the error message
                std::stringstream ssErrorMessage;
                ssErrorMessage << sFunctionName << " expects " << (*iterator).m_lParameterTypes.size() << " parameter(s), got " << lParameterList.size() << ".";

                return CFunctionCallAttempt(ssErrorMessage.str());
            }

            // Current parameter number
            int iCurrentParameterNumber = 1;

            // Check if every parameter has the correct type, only if the function is type sensitive
            if((*iterator).m_bTypeSensitive)
            {
                for(unsigned int i = 0; i < lParameterList.size(); i++, iCurrentParameterNumber++)
                {
                    if(lParameterList[i].m_eType != (*iterator).m_lParameterTypes[i])
                    {
                        // The types of this parameter differ
                        std::stringstream ssErrorMessage;
                        ssErrorMessage << "Parameter " << iCurrentParameterNumber << " has a bad type (expected " << GetTypeAsString((*iterator).m_lParameterTypes[i]) << ", got " << GetTypeAsString(lParameterList[i].m_eType) << ", in function call " << sFunctionName << ")";

                        return CFunctionCallAttempt(ssErrorMessage.str());
                    }
                }
            }

            // Call the actual function
            oReturnValue = (*iterator).m_pFunctionToCall(lParameterList);
            break;
        }
    }

    // Return a valid CFunctionCallAttempt object
    return CFunctionCallAttempt(oReturnValue);
}
开发者ID:yuan-,项目名称:cminusminus,代码行数:50,代码来源:CFunctionWrapper.cpp

示例6: Exception

void OptimizationTools::ScaleFunction::setParameters(const ParameterList& lambda)
throw (ParameterNotFoundException, ConstraintException)
{
  if (lambda.size() != 1)
    throw Exception("OptimizationTools::ScaleFunction::f(). This is a one parameter function!");
  lambda_.setParametersValues(lambda);
}
开发者ID:matsen,项目名称:bpp-phyl,代码行数:7,代码来源:OptimizationTools.cpp

示例7: doInit

void BrentOneDimension::doInit(const ParameterList & params) throw (Exception)
{
  if(params.size() != 1) throw Exception("BrentOneDimension::init(). This optimizer only deals with one parameter.");

  // Bracket the minimum.
  Bracket bracket = OneDimensionOptimizationTools::bracketMinimum(_xinf, _xsup, _function, _parameters);
  if(_verbose > 0)
  {
    printMessage("Initial bracketing:");
    printMessage("A: x = " + TextTools::toString(bracket.a.x) + ", f = " + TextTools::toString(bracket.a.f));
    printMessage("B: x = " + TextTools::toString(bracket.b.x) + ", f = " + TextTools::toString(bracket.b.f));
    printMessage("C: x = " + TextTools::toString(bracket.c.x) + ", f = " + TextTools::toString(bracket.c.f));
  }
  
  // This will be the distance moved on the step before last.
  e = 0.0;

  // a and b must be in ascending order, but input abscissa need not be.
  a = (bracket.a.x < bracket.c.x ? bracket.a.x : bracket.c.x);
  b = (bracket.a.x > bracket.c.x ? bracket.a.x : bracket.c.x);
  // Initializations...
  fw = fv = fx = _function->f(_parameters);
  if(fx < bracket.b.f)
  {
    //We don't want to lose our initial guess!
    x = w = v = bracket.b.x = _parameters[0]->getValue();
  }
  else
  {
    x = w = v = bracket.b.x;
    _parameters[0]->setValue(x);
    fw = fv = fx = _function->f(_parameters);
  }
}
开发者ID:pjotrp,项目名称:bio---numcalc,代码行数:34,代码来源:BrentOneDimension.cpp

示例8: get_number_of_free_parameters

size_t Alignment::get_number_of_free_parameters() {
    if (!likelihood) throw Exception("Likelihood model not initialised");
    ParameterList pl = likelihood->getBranchLengthsParameters();
    pl.addParameters(model->getIndependentParameters());
    if (rates->getName() == "Gamma") pl.addParameters(rates->getIndependentParameters());
    return pl.size();
}
开发者ID:kgori,项目名称:bpp,代码行数:7,代码来源:Alignment.cpp

示例9: initParameters_

void GlobalClockTreeLikelihoodFunctionWrapper::initParameters_()
{
  // Check if the tree is rooted:
  TreeTemplate<Node> tree(tl_->getTree());
  if (!tree.isRooted()) throw Exception("GlobalClockTreeLikelihoodFunctionWrapper::initParameters_(). Tree is unrooted!");
  if (TreeTemplateTools::isMultifurcating(*(tree.getRootNode()))) throw Exception("GlobalClockTreeLikelihoodFunctionWrapper::initParameters_(). Tree is multifurcating.");
  std::map<const Node*, double> heights;
  TreeTemplateTools::getHeights(*(tree.getRootNode()), heights);
  double totalHeight = heights[tree.getRootNode()];
  addParameter_(new Parameter("TotalHeight", totalHeight, &Parameter::R_PLUS_STAR));
  for (std::map<const Node*, double>::iterator it = heights.begin(); it != heights.end(); it++)
  {
    if (!it->first->isLeaf() && it->first->hasFather())
    {
      double fatherHeight = heights[it->first->getFather()];
      addParameter_(new Parameter("HeightP" + TextTools::toString(it->first->getId()), it->second / fatherHeight, &Parameter::PROP_CONSTRAINT_IN));
    }
  }
  // We add other parameters:
  ParameterList pl = tl_->getParameters();
  for (unsigned int i = 0; i < pl.size(); ++i)
  {
    if (pl[i].getName().substr(0, 5) != "BrLen")
      addParameter_(pl[i].clone());
  }
  // Compute everything:
  fireParameterChanged(getParameters());
}
开发者ID:KhaosResearch,项目名称:MORPHY,代码行数:28,代码来源:GlobalClockTreeLikelihoodFunctionWrapper.cpp

示例10: lineMinimization

unsigned int OneDimensionOptimizationTools::lineMinimization(DirectionFunction & f1dim, ParameterList & parameters, vector<double> & xi, double tolerance, ostream * profiler, ostream * messenger, int verbose)
{
  // Initial guess for brackets:
  double ax = 0.;
  double xx = 0.01;
  
  f1dim.setConstraintPolicy(AutoParameter::CONSTRAINTS_AUTO);
  f1dim.setMessageHandler(messenger);
  f1dim.init(parameters, xi);
  BrentOneDimension bod(&f1dim);
  bod.setMessageHandler(messenger);
  bod.setProfiler(profiler);
  bod.setVerbose(verbose >= 1 ? 1 : 0);
  bod.setOptimizationProgressCharacter(".");
  bod.getStopCondition()->setTolerance(0.01);
  bod.setInitialInterval(ax, xx);
  bod.setConstraintPolicy(AutoParameter::CONSTRAINTS_KEEP);
  ParameterList singleParameter;
  singleParameter.addParameter(Parameter("x", 0.0));
  bod.init(singleParameter);
  bod.optimize();
  //Update parameters:
  //parameters.matchParametersValues(f1dim.getFunction()->getParameters());
  
  double xmin = f1dim.getParameters()[0]->getValue();
  for(unsigned int j = 0; j < parameters.size(); j++)
  {
    xi[j] *= xmin;
    parameters[j]->setValue(parameters[j]->getValue() + xi[j]);
  }
  return bod.getNumberOfEvaluations();
}
开发者ID:pjotrp,项目名称:bio---numcalc,代码行数:32,代码来源:OneDimensionOptimizationTools.cpp

示例11: addParameters

void SubstitutionModelSet::addParameters(const ParameterList& parameters, const vector<int>& nodesId) throw (Exception)
{
  for (size_t i = 0; i < parameters.size(); i++)
    {
      modelParameterNames_.push_back(parameters[i].getName());
    }
  ParameterList pl(parameters);
  for (size_t i = 0; i < pl.size(); i++)
    {
      pl[i].setName(pl[i].getName() + "_" + TextTools::toString(++paramNamesCount_[pl[i].getName()]));
    }
  addParameters_(pl);
  // Build model indexes:
  vector<size_t> modelIndexes(nodesId.size());
  map<size_t, size_t> counts; //Check is a model is affected to several nodes.
  for (size_t i = 0; i < nodesId.size(); i++)
    {
      if (nodeToModel_.find(nodesId[i]) == nodeToModel_.end())
        throw Exception("SubstitutionModelSet::addParameters. This node has no associated model: " + TextTools::toString(nodesId[i]));
      size_t pos = nodeToModel_[nodesId[i]];
      size_t count = counts[pos]++;
      if (count == 0)
        modelParameters_[pos].addParameters(parameters);
      modelIndexes[i] = pos;
    }
  for (size_t i = 0; i < pl.size(); i++)
    {
      paramToModels_.push_back(modelIndexes);
    }
  //Update model values:
  fireParameterChanged(pl);
}
开发者ID:KhaosResearch,项目名称:MORPHY,代码行数:32,代码来源:SubstitutionModelSet.cpp

示例12: AbstractBiblioMixedSubstitutionModel

LLG08_UL2::LLG08_UL2(const ProteicAlphabet* alpha) :
  AbstractBiblioMixedSubstitutionModel("LLG08_UL2."),
  pmixmodel_(0)
{
  // build the submodel

  vector<SubstitutionModel*> vpSM;
  vpSM.push_back(new LLG08_UL2::EmbeddedModel(alpha, "M1"));
  vpSM.push_back(new LLG08_UL2::EmbeddedModel(alpha, "M2"));

  Vdouble vrate, vproba;

  for (unsigned int i = 0; i < vpSM.size(); i++)
  {
    vproba.push_back((dynamic_cast<LLG08_UL2::EmbeddedModel*>(vpSM[i]))->getProportion());
    vrate.push_back(vpSM[i]->getRate());
  }

  pmixmodel_.reset(new MixtureOfSubstitutionModels(alpha, vpSM, vproba, vrate));

  string name, st;
  ParameterList pl = pmixmodel_->getParameters();
  for (size_t i = 0; i < pl.size(); i++)
  {
    name = pl[i].getName();
    lParPmodel_.addParameter(Parameter(pl[i]));
    st = pmixmodel_->getParameterNameWithoutNamespace(name);
    mapParNamesFromPmodel_[name] = st;
    addParameter_(new Parameter("LLG08_UL2." + st,
                            pmixmodel_->getParameterValue(st),
                            pmixmodel_->getParameter(st).hasConstraint() ? pmixmodel_->getParameter(st).getConstraint()->clone() : 0, true));
  }

  updateMatrices();
}
开发者ID:KhaosResearch,项目名称:MORPHY,代码行数:35,代码来源:LLG08_UL2.cpp

示例13: httpRequestRecieved

uHTTP::HTTP::StatusCode TestDevice::httpRequestRecieved(HTTPRequest *httpReq)
{
	ParameterList paramList;
	httpReq->getParameterList(paramList);
	for (int n=0; n<paramList.size(); n++) {
		Parameter *param = paramList.getParameter(n);
		cout << "["<< n << "] : "<< param->getName() << "= "<< param->getValue() << endl;
	}

	string uri;
	httpReq->getURI(uri);
	if (uri.find(PRESENTATION_URI) == string::npos)  {
		return Device::httpRequestRecieved(httpReq);
	}
			 
	string contents;
	contents = "<HTML><BODY><H1>";
	contents += "";
	contents += "</H1></BODY></HTML>";
		
	HTTPResponse httpRes;
	httpRes.setStatusCode(HTTP::OK_REQUEST);
	httpRes.setContent(contents);
	return httpReq->post(&httpRes);
}
开发者ID:SrihariLibre,项目名称:CyberLink4CC,代码行数:25,代码来源:TestDevice.cpp

示例14: exportXML

static QScriptValue exportXML(QScriptContext *context,
                              QScriptEngine  * /*engine*/)
{
  if (context->argumentCount() < 1)
    context->throwError(QScriptContext::UnknownError,
                        "not enough args passed to exportXML");

  int           qryheadid = context->argument(0).toInt32();
  ParameterList params;
  QString       filename;
  QString       errmsg;
  int           xsltmapid = -1;

  if (context->argumentCount() >= 2)
    params = qscriptvalue_cast<ParameterList>(context->argument(1));
  if (context->argumentCount() >= 3)
    filename = context->argument(2).toString();
  if (context->argumentCount() >= 4)
    errmsg = context->argument(3).toString();
  if (context->argumentCount() >= 5)
    xsltmapid = context->argument(4).toInt32();

  if (DEBUG)
    qDebug("exportXML(%d, %d params, %s, %s, %d) called with %d args",
           qryheadid, params.size(), qPrintable(filename),
           qPrintable(errmsg), xsltmapid, context->argumentCount());

  bool result = ExportHelper::exportXML(qryheadid, params, filename,
                                        errmsg, xsltmapid);
  // TODO: how to we pass back filename and errmsg output parameters?

  return QScriptValue(result);
}
开发者ID:ChristopherCotnoir,项目名称:qt-client,代码行数:33,代码来源:exporthelper.cpp

示例15: insert

void SQLiteApplets::insert ()
{
	v1 [3] = "";
	v1 [4] = "1";
	v1 [5] = "0";
	StringVector fileList;
	fileList.push_back ( "dbstat_hist" );
	fileList.push_back ( "error_hist" );
	fileList.push_back ( "fit_graph" );
	fileList.push_back ( "hist" );
	fileList.push_back ( "mmod_hist" );
	fileList.push_back ( "pr_graph" );
	fileList.push_back ( "sp_graph" );
	for ( StringVectorSizeType i = 0 ; i < fileList.size () ; i++ ) {
		string path = MsparamsDir::instance ().getParamPath ( fileList [i] + ".par.txt" );
		GenNameValueStream nvs ( path );
		if ( genFileExists ( path ) ) {
			v1 [0] = fileList [i];
			GenCommentedIFStream ifs ( path );
			ParameterList p ( ifs );
			StringVector sv = p.getNameList ();
			int numValues = p.size ();
			for ( int j = 0 ; j < numValues ; j++ ) {
				StringVector sv2 = p.getStringVectorValue ( sv [j] );
				for ( int k = 0 ; k < sv2.size () ; k++ ) {
					v1 [1] = sv [j];
					v1 [2] = sv2 [k];
					insertTable ( tableName, n1, v1 );
				}
			}
		}
	}
}
开发者ID:proteinprospector,项目名称:prospector,代码行数:33,代码来源:lu_param_db.cpp


注:本文中的ParameterList::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。