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


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

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


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

示例1: haveSameValues

bool Teuchos::haveSameValues( const ParameterList& list1, const ParameterList& list2 )
{
  // Check that the top-level names of the two parameter lists are the same
  //const std::string &paramListName1 = list1.name();
  //const std::string &paramListName2 = list2.name();
  //if ( paramListName1 != paramListName2 ) {
  //  return false;
  //}
  ParameterList::ConstIterator itr1, itr2;
  for(
    itr1 = list1.begin(), itr2 = list2.begin();
    itr1 != list1.end() && itr2 != list2.end();
    ++itr1, ++itr2
    )
  {
    const std::string    &entryName1   = list1.name(itr1);
    const std::string    &entryName2   = list2.name(itr2);
    const ParameterEntry &entry1       = list1.entry(itr1);
    const ParameterEntry &entry2       = list2.entry(itr2);
    if( entryName1 != entryName2 ) {
      return false;
    }
    if( entry1.isList() && entry2.isList() ) {
      if (
        !haveSameValues(
          getValue<ParameterList>(entry1),
          getValue<ParameterList>(entry2))
        )
      {
        // Note: Above we cast to a non-const ParameterList even through we
        // only need a const ParameterList.  We have to do this since a
        // non-const ParameterList is always added initially which determines
        // the value.
        return false;
      }
    }
    else {
      if( entry1.getAny() != entry2.getAny() ) {
        return false;
      }
    }
  }
  // Check that the two parameter lists are the same length:
  if ((itr1 != list1.end()) || (itr2 != list2.end())) {
    return false;
  }
  return true;
}
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:48,代码来源:Teuchos_ParameterList.cpp

示例2: f_internalDcop

static ParseNode f_internalDcop(Parser* parser, const ParameterList& params)
{
  SpecialFunction function = SpecialInformation::functionObject("DCOP", params[0].toString());
  int functionId = SpecialInformation::function(Group::DCOP, params[0].toString());
  if (functionId == -1)
    return f_executeSlot(parser, params);
    //return ParseNode::error("unknown function");
  else if ((uint)function.minArg() > params.count() - 1)
    return ParseNode::error("too few parameters");
  else if ((uint)function.maxArg() < params.count() - 1)
    return ParseNode::error("too many parameters");
  KommanderWidget* widget = parser->currentWidget();
  if (widget)
    widget = widget->widgetByName(params[1].toString());
  if (!widget)
    return ParseNode::error("unknown widget");
  QStringList args;
  ParameterList::ConstIterator it = params.begin(); 
  ++it;   // skip function
  ++it;   // skip widget
  while (it != params.end())
  {
    args += (*it).toString(); 
    ++it;
  }
  return widget->handleDCOP(functionId, args);
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:27,代码来源:functionlib.cpp

示例3: convertParameterList

XMLObject XMLParameterListWriter::convertParameterList(
  const ParameterList& p,
  ParameterEntry::ParameterEntryID& idCounter,
  EntryIDsMap& entryIDsMap,
  const ValidatortoIDMap& validatorIDsMap) const
{
  XMLObject rtn(getParameterListTagName());

  for (ParameterList::ConstIterator i=p.begin(); i!=p.end(); ++i){
    RCP<const ParameterEntry> entry = p.getEntryRCP(i->first);
    if(entry->isList()){
      XMLObject newPL = convertParameterList(
        getValue<ParameterList>(entry),
        idCounter,
        entryIDsMap,
        validatorIDsMap);
      newPL.addAttribute(
        getNameAttributeName(), p.name(i));
      newPL.addAttribute(
        ParameterEntryXMLConverter::getIdAttributeName(), idCounter);
      entryIDsMap.insert(EntryIDsMap::value_type(entry, idCounter));
      rtn.addChild(newPL);
      ++idCounter;
    }
    else{
      rtn.addChild(ParameterEntryXMLConverterDB::convertEntry(
        entry, p.name(i), idCounter, validatorIDsMap));
      entryIDsMap.insert(EntryIDsMap::value_type(entry, idCounter));
      ++idCounter;
    }
  }
  return rtn;
}
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:33,代码来源:Teuchos_XMLParameterListWriter.cpp

示例4: createAnonName

void *
SymbolTableVisitor::visitStreamSpec(StreamSpec *spec)
{
    string scope = syms->getScope();
    if (spec->getName() == "anon") {
	spec->setName( createAnonName() );
	syms->setScope("streamit");
    }
    string name = spec->getName();

    syms->addEntry(name, spec, NULL);
    syms->pushScope(name);

    ParameterList::iterator iter;
    ParameterList *pl = spec->getParams();
    for (iter = pl->begin(); iter != pl->end(); iter++) {
	Parameter *p = *iter;
	FEContext *c = spec->getContext();
	string n = p->getName();
	Type *t = p->getType();
	syms->addEntry(p->getName(), (FENode*)(new StmtVarDecl(c, t, n, 0)), 0);
    }

    FEPrintVisitor::visitStreamSpec(spec);

    syms->setScope(scope);
    return NULL;
}
开发者ID:fifield,项目名称:skir,代码行数:28,代码来源:SymbolTableVisitor.cpp

示例5: doDialog

void ClsQHarborImpl::doDialog(int iItemType, string strItemID, int iIndex) {

    string strItemType;
    string strItemName;
    string strSubItemName;

    ParameterList paramLst;
    list<string> lstParams;
    if(iItemType == ClsFESystemManager::ITEM_GROUP) {
        strItemType = "Group";
        clsItem = ClsFESystemManager::Instance()->getFEGroup( strItemID );
        if(clsItem!=NULL) {
            strItemName = dynamic_cast<ClsFEGroup*>(clsItem)->getGroupName();
            ClsNeuron* clsNeuron = dynamic_cast<ClsFEGroup*>(clsItem)->getNeuron( );
            if(clsNeuron!=NULL) {
                strSubItemName = dynamic_cast<ClsFEGroup*>(clsItem)->getGroupNeuronLabel();
                paramLst = clsNeuron->getListParameters();
            }
        }
    } else if (iItemType == ClsFESystemManager::ITEM_CONNECTION) {
        strItemType = "Connection";
        clsItem = ClsFESystemManager::Instance()->getFEConnection( strItemID );
        if(clsItem!=NULL) {
            strItemName = dynamic_cast<ClsFEConnection*>(clsItem)->getConnectionName();
            ClsSynapse* clsSynapse = dynamic_cast<ClsFEConnection*>(clsItem)->getSynapse( );
            if(clsSynapse!=NULL) {
                strSubItemName = dynamic_cast<ClsFEConnection*>(clsItem)->getConnectionSynapseLabel();
                paramLst = clsSynapse->getListParameters();
            }
        }
    }

    for(ParameterList::iterator it=paramLst.begin(); it!=paramLst.end(); it++) {
        if(dynamic_cast<ClsDoubleParameter*>(*it)) {
            pair<string, string> pairTemp((*it)->getLabel(), (*it)->getName());
            mapParams.insert(pairTemp);
            lstParams.push_back((*it)->getLabel());
        }
    }
    if(lstParams.size()>0) {

        if(iIndex<0) {
            qtableEntries->insertRows(0,1);
            qtableEntries->setText(0, COL_TYPE, strItemType);
            qtableEntries->setText(0, COL_NAME, strItemName);
            qtableEntries->setText(0, COL_ID, strItemID);
            qtableEntries->setText(0, COL_CHILD, strSubItemName);
        }

        ClsQHarborDialogImpl* clsQHarborDialogImpl = new ClsQHarborDialogImpl(strItemType, strItemID,
                strItemName, strSubItemName,
                lstParams, iIndex, this);
        connect(clsQHarborDialogImpl, SIGNAL(sigDoItem(string,int)), SLOT(slotDoItem(string,int)));
        connect(clsQHarborDialogImpl, SIGNAL(sigDoItemCanceled(int)), SLOT(slotDoItemCanceled(int)));
        clsQHarborDialogImpl->show();
    }
}
开发者ID:jeez,项目名称:iqr,代码行数:57,代码来源:ClsQHarborImpl.cpp

示例6:

std::queue<ParameterList> ComparisonHelper::getMetricsToCompare(const ParameterList &pList)
{
  // extract all of the metrics to be tested
  std::queue<ParameterList> metrics;
  for(auto it = pList.begin(); it != pList.end(); ++it) {
    if (pList.isSublist(it->first)) {
      metrics.push(pList.sublist(it->first));
    }
  }
  return metrics;
}
开发者ID:uppatispr,项目名称:trilinos-official,代码行数:11,代码来源:Zoltan2_ComparisonHelper.hpp

示例7: 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

示例8: set

void LCDWidget::set(const ParameterList &pList)
{
  ostringstream params;
  for (ParameterList::const_iterator it = pList.begin();
       it != pList.end(); ++it)
  {
    params << *it << " ";
  }

  setWidgetParameters(params.str());
}
开发者ID:spdawson,项目名称:lcdapi,代码行数:11,代码来源:LCDWidget.cpp

示例9: run

void BCManager::run()
{
  if (jacT != Teuchos::null) isAdjoint = true;
  typedef ParameterList::ConstIterator ParamIter;
  for (ParamIter i = bcParams.begin(); i != bcParams.end(); ++i)
  {
    std::string const& name = bcParams.name(i);
    Teuchos::ParameterEntry const& entry = bcParams.entry(i);
    assert(entry.isList());
    applyBC(Teuchos::getValue<ParameterList>(entry));
  }
}
开发者ID:ImmutableLtd,项目名称:Albany,代码行数:12,代码来源:GOAL_BCUtils.cpp

示例10: if

bool Teuchos::operator==( const ParameterList& list1, const ParameterList& list2 )
{
  // Check that the top-level names of the two parameter lists are the same
  //const std::string &paramListName1 = list1.name();
  //const std::string &paramListName2 = list2.name();
  //if ( paramListName1 != paramListName2 ) {
  //  return false;
  //}
  ParameterList::ConstIterator itr1, itr2;
  for(
    itr1 = list1.begin(), itr2 = list2.begin();
    itr1 != list1.end() && itr2 != list2.end();
    ++itr1, ++itr2
    )
  {
    const std::string    &entryName1   = list1.name(itr1);
    const std::string    &entryName2   = list2.name(itr2);
    const ParameterEntry &entry1       = list1.entry(itr1);
    const ParameterEntry &entry2       = list2.entry(itr2);
    if( entryName1 != entryName2 ) {
      return false;
    }
    else if( entry1 != entry2 ) {
      return false;
    }
    // Note that the above statement automatically recursively compare the
    // sublists since ParameterList objects are stored in the 'any' variable
    // held by the ParameterEntry object and this same comparison operator will
    // be used.
  }
  // Check that the two parameter lists are the same length:
  if ((itr1 != list1.end()) || (itr2 != list2.end())) {
    return false;
  }
  return true;
}
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:36,代码来源:Teuchos_ParameterList.cpp

示例11: buildInitialValidatorMap

void XMLParameterListWriter::buildInitialValidatorMap(
  const ParameterList& p,
  ValidatortoIDMap& validatorIDsMap) const
{
  for (ParameterList::ConstIterator i=p.begin(); i!=p.end(); ++i) {
    const ParameterEntry& entry = p.entry(i);
    if(entry.isList()){
      buildInitialValidatorMap(
        getValue<ParameterList>(entry),
        validatorIDsMap);
    }
    else if(nonnull(entry.validator())){
      validatorIDsMap.insert(entry.validator());
    }
  }
}
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:16,代码来源:Teuchos_XMLParameterListWriter.cpp

示例12: if

void
SexpParser::ListToString(stringstream& ss, const ParameterList& lst)
{
    string space;

    ss.setf(ios_base::fixed,ios_base::floatfield);
    ss.precision(2);

    for (
         ParameterList::TVector::const_iterator i = lst.begin();
         i != lst.end();
         ++i
         )
    {
        if (i->type() == typeid(string))
        {
            ss << space;
            ss << boost::any_cast<string>(*i);
        }
        else if (i->type() == typeid(float))
        {
            ss << space;
            ss << boost::any_cast<float>(*i);
        }
        else if (i->type() == typeid(int))
        {
            ss << space;
            ss <<boost::any_cast<int>(*i);
        }
        else if (i->type() == typeid(ParameterList))
        {
            const any* v = &(*i);
            const ParameterList* lst = any_cast<ParameterList>(v);
            ss << space;
            ss << '(';
            ListToString(ss,*lst);
            ss << ')';
        }
        else
        {
            ss << space;
            ss << "(error data format unknown)";
        }

        space = " ";
    }
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:47,代码来源:sexpparser.cpp

示例13: updateParametersFromXmlFile

TEUCHOS_UNIT_TEST( Teuchos_ParameterList, xmlUpdateAndBroadcast ) {
  const RCP<const Comm<int> > comm = DefaultComm<int>::getComm();
  // Test the broadcast functionality to avoid unscalable I/O collisions
  std::string inputFile="input.xml";
  ParameterList A;
  ParameterList B;
  updateParametersFromXmlFile(inputFile, &A);
  updateParametersFromXmlFileAndBroadcast(inputFile, &B, *comm);
  out << "B = " << B;
  TEST_ASSERT( B.begin() != B.end() ); // Avoid false positive from empty lists

  // See if any process returned a failed (i.e. a non-zero local_failed)
  int local_failed = !(A == B);
  int global_failed = -1;
  reduceAll( *comm, Teuchos::REDUCE_SUM, local_failed, outArg(global_failed) );
  TEST_EQUALITY_CONST( global_failed, 0 );
}
开发者ID:Blevs,项目名称:Trilinos_tutorial,代码行数:17,代码来源:ParameterList_UnitTest_Parallel.cpp

示例14: f_executeSlot

static ParseNode f_executeSlot(Parser* parser, const ParameterList& params)
{
  ParameterList::ConstIterator it = params.begin(); 
  QString slotName = (*it).toString()+"("; 
  ++it;
  QString widgetName = (*it).toString();
  KommanderWidget* widget = parser->currentWidget();
  if (!widget)
    return ParseNode::error("unknown widget");
  widget = widget->widgetByName(widgetName);
  if (!widget)
    return ParseNode::error("unknown widget");
  QObject *object = widget->object();
  if (!object)
    return ParseNode::error("unknown widget");
  QStrList slotSignatures = object->metaObject()->slotNames(true);
  QStringList slotNames = QStringList::fromStrList(slotSignatures);
  int slotNum = -1;
  uint i = 0;
  while (i < slotNames.count())
  {
    if (slotNames[i].startsWith(slotName))
    {
      slotNum = i;
      break;
    }  
    i++;
  }
  if (slotNum == -1)
    return ParseNode::error("unknown function");
  QStringList args;
  ++it;   // skip widget
  while (it != params.end())
  {
    args += (*it).toString(); 
    ++it;
  }
  InvokeClass* inv = new InvokeClass(0);
  inv->invokeSlot(object, slotSignatures.at(slotNum), args);
  inv->deleteLater();

  return ParseNode();
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:43,代码来源:functionlib.cpp

示例15: out

  std::string ML2MueLuParameterTranslator::SetParameterList(const Teuchos::ParameterList & paramList_in, const std::string& defaultVals) {
    Teuchos::ParameterList paramList = paramList_in;

    RCP<Teuchos::FancyOStream> out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); // TODO: use internal out (GetOStream())

#if defined(HAVE_MUELU_ML) && defined(HAVE_MUELU_EPETRA)

    // TODO alternative with standard parameterlist from ML user guide?

    if (defaultVals != "") {
      TEUCHOS_TEST_FOR_EXCEPTION(defaultVals!="SA" && defaultVals!="NSSA", Exceptions::RuntimeError,
                                   "MueLu::MLParameterListInterpreter: only \"SA\" and \"NSSA\" allowed as options for ML default parameters.");
      Teuchos::ParameterList ML_defaultlist;
      ML_Epetra::SetDefaults(defaultVals,ML_defaultlist);

      // merge user parameters with default parameters
      MueLu::MergeParameterList(paramList_in, ML_defaultlist, true);
      paramList = ML_defaultlist;
    }
#else
    if (defaultVals != "") {
        // If no validator available: issue a warning and set parameter value to false in the output list
        *out << "Warning: MueLu_ENABLE_ML=OFF. No ML default values available." << std::endl;
    }
#endif // HAVE_MUELU_ML

    //
    // Move smoothers/aggregation/coarse parameters to sublists
    //

    // ML allows to have level-specific smoothers/aggregation/coarse parameters at the top level of the list or/and defined in sublists:
    // See also: ML Guide section 6.4.1, MueLu::CreateSublists, ML_CreateSublists
    ParameterList paramListWithSubList;
    MueLu::CreateSublists(paramList, paramListWithSubList);
    paramList = paramListWithSubList; // swap
    Teuchos::ParameterList adaptingParamList = paramList;    // copy of paramList which is used to removed already interpreted parameters

    //
    // Validate parameter list
    //
    {
      bool validate = paramList.get("ML validate parameter list", true); /* true = default in ML */
      if (validate) {

#if defined(HAVE_MUELU_ML) && defined(HAVE_MUELU_EPETRA)
        // Validate parameter list using ML validator
        int depth = paramList.get("ML validate depth", 5); /* 5 = default in ML */
        TEUCHOS_TEST_FOR_EXCEPTION(! ML_Epetra::ValidateMLPParameters(paramList, depth), Exceptions::RuntimeError,
                                   "ERROR: ML's Teuchos::ParameterList contains incorrect parameter!");
#else
        // If no validator available: issue a warning and set parameter value to false in the output list
        *out << "Warning: MueLu_ENABLE_ML=OFF. The parameter list cannot be validated." << std::endl;
        paramList.set("ML validate parameter list", false);

#endif // HAVE_MUELU_ML
      } // if(validate)
    } // scope

    // stringstream for concatenating xml parameter strings.
    std::stringstream mueluss;

    // create surrounding MueLu parameter list
    mueluss << "<ParameterList name=\"MueLu\">" << std::endl;

    // loop over all ML parameters in provided parameter list
    for (ParameterList::ConstIterator param = paramListWithSubList.begin(); param != paramListWithSubList.end(); ++param) {

      // extract ML parameter name
      const std::string & pname=paramListWithSubList.name(param);

      // extract corresponding (ML) value
      // remove ParameterList specific information from result string
      std::stringstream valuess;
      valuess << paramList.entry(param);
      std::string valuestr = valuess.str();
      replaceAll(valuestr, "[unused]", "");
      replaceAll(valuestr, "[default]", "");
      valuestr = trim(valuestr);

      // transform ML parameter to corresponding MueLu parameter and generate XML string
      std::string valueInterpreterStr = "\"" + valuestr + "\"";
      std::string ret = MasterList::interpretParameterName(MasterList::ML2MueLu(pname),valueInterpreterStr);

      // add XML string
      if (ret != "") {
        mueluss << ret << std::endl;

        // remove parameter from ML parameter list
        adaptingParamList.remove(pname,false);
      }

      // special handling for energy minimization
      // TAW: this is not optimal for symmetric problems but at least works.
      //      for symmetric problems the "energy minimization" parameter should not exist anyway...
      if (pname == "energy minimization: enable") {
        mueluss << "<Parameter name=\"problem: symmetric\"      type=\"bool\"     value=\"false\"/>" << std::endl;
        mueluss << "<Parameter name=\"transpose: use implicit\" type=\"bool\"     value=\"false\"/>" << std::endl;
      }

      // special handling for smoothers
//.........这里部分代码省略.........
开发者ID:KineticTheory,项目名称:Trilinos,代码行数:101,代码来源:MueLu_ML2MueLuParameterTranslator.cpp


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