• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ VariableList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VariableList的典型用法代码示例。如果您正苦于以下问题:C++ VariableList类的具体用法?C++ VariableList怎么用?C++ VariableList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: GetNumVar

OptError CGProblem::CreateApplicationOptimizer(OptimizeClass* &objfcn,
					       NLP0* &func)
{
  OptError error;

  int numVar = GetNumVar();
  VariableList* variables = GetVariables();
  AppLauncher* launcher = GetAppLauncher();
  USERFCN0APP userFcn = &(launcher->run_app);
  INITFCNAPP initFcn = &(launcher->init_app);

  if ((variables->upperExists()) || (variables->lowerExists()) ||
      (variables->linearExists()) || (variables->nonlinearExists()))
  {
    cout << "CG does not support constraints." << endl;
    cout << "Constraints being ignored" << endl;
  }

  FDNLF1APP * myFunc = new FDNLF1APP(numVar, userFcn, initFcn,
				     launcher);
  myFunc->setIsExpensive(true);
  func = myFunc;

  objfcn = new OptCG(myFunc);

  error.value = 0;
  error.msg = "Success";
  return error;
}	
开发者ID:OpenCMISS-Dependencies,项目名称:optpp,代码行数:29,代码来源:CGProblem.C


示例2: whereClause

	virtual void whereClause (const WhereClause* const, const TableOperation* p_GroupGraphPattern, const BindingClause* p_BindingClause) {
	    ResultSet* joined(NULL);
	    const ResultSet* working = &rs;
	    if (p_BindingClause != NULL) {
		working = joined = new ResultSet(rs);
		p_BindingClause->bindVariables(NULL, joined);
	    }

	    vars.clear(); // probably got filled with e.g. select vars.
	    p_GroupGraphPattern->express(this);
	    const TableOperation* op = last.tableOperation;
	    const VariableList* knownVars = working->getKnownVars();
	    std::vector<const POS*> v(vars.size() + knownVars->size());
	    std::vector<const POS*>::iterator needed =
		std::set_intersection (vars.begin(), vars.end(), knownVars->begin(),
				       knownVars->end(), v.begin());
	    const std::set<const POS*> s(v.begin(), v.end());
	    const Expression* filter = working->getFederationExpression(s, false);
	    if (filter) {
		Filter* f = new Filter(op);
		f->addExpression(filter);
		op = f;
	    }

	    if (joined)
		delete joined;
	    last.whereClause = new WhereClause(op, NULL);
	}
开发者ID:RubenVerborgh,项目名称:SWObjects,代码行数:28,代码来源:ResultSet.cpp


示例3:

std::vector<FormalParameter> juli::Function::transformParameterList(VariableList args, const TypeInfo& typeInfo) {
	std::vector<FormalParameter> formalArguments;
	for (VariableList::iterator i = args.begin(); i != args.end(); ++i) {
		formalArguments.push_back(FormalParameter((*i)->type->resolve(typeInfo), (*i)->name->name));
	}
	return formalArguments;
}
开发者ID:widmoser,项目名称:juli,代码行数:7,代码来源:functions.cpp


示例4: handleFunctionDeclaration

BaseExpression* Parser::handleFunctionDeclaration(DragonType type, string name)
{
	VariableList args;
	LexerToken nextToken;
	DragonVariable argument = {TYPE_NONE, ""};

	while(nextToken.value[0] != ')') {
		nextToken = mLexer->getToken();

		switch (nextToken.type) {
		case TYPE:
			argument.type = toDragonType(nextToken.value);
			break;
		case IDENTIFIER:
			if(argument.type != TYPE_NONE) {
				argument.name = nextToken.value;
				args.push_back(argument);
				argument.type = TYPE_NONE;
			} else {
				printf("No type specified '%s' in argument list for function '%s'", argument.name.c_str(), name.c_str());exit(0);
			}
			break;
		case BRACE:
		case SPECIAL_SYMBOL:
			break;
		default:
			printf("Unexpected '%s' in argument list for function '%s',"
				 " expected ','", nextToken.value.c_str(), name.c_str());exit(0);
			break;
		}
	}

	return new FunctionDeclExpr(type, name, args);
}
开发者ID:nayyden,项目名称:dragonc,代码行数:34,代码来源:DragonParser.cpp


示例5: env

//执行
void COpScript::Execute(CMoveShape* pShape)
{
#ifdef _RUNSTACKINFO1_
    CMessage::AsyWriteFile(GetGame()->GetStatckFileName(), "COpScript::Execute() begin");
#endif
    //  [5/4/2009 chenxianj]
    //CScript *pTempScript =  PopFreeScript("COpScript::Execute");
    //if (pTempScript)
    //{
    //	pTempScript->SetVariableList(m_pParam->pVariableList);
    //	pTempScript->SetUsedItemID(m_pParam->GoodsGuid);
    //	pTempScript->SetSrcShapeEx(m_pParam->pUser);
    //	//  [5/4/2009 chenxianj]
    //	itExpress it = m_Expressions.begin();
    //	for(;it != m_Expressions.end();it++)
    //	{
    //		if(m_pParam->pUser)
    //			pTempScript->SetRegion(dynamic_cast<CRegion*>(m_pParam->pUser->GetFather()));
    //		else
    //			pTempScript->SetRegion(NULL);


    //		(*it)->Execute(pTempScript,pShape);

    //	}
    //	//  [5/4/2009 chenxianj]
    //	PushFreeScript(pTempScript);
    //}
    Script::RunEnv env( m_pParam->pUser, pShape, static_cast<CRegion*>( m_pParam->pUser->GetFather() ),
                        m_pParam->pVariableList );
    VariableList *varList = m_pParam->pVariableList;
    if( !varList->AddVar( "$ParamA", (double)(DWORD)m_pParam->pUser ) )
    {
        varList->SetVarValue( "$ParamA", (double)(DWORD) m_pParam->pUser );
    }
    if( !varList->AddVar( "$ParamB", (double)(DWORD)pShape ) )
    {
        varList->SetVarValue( "$ParamB", (double)(DWORD) pShape );
    }

    Script *script = GetInst( ScriptSys ).NewScript( env );
    for( itExpress it = m_Expressions.begin(); it != m_Expressions.end(); ++ it )
    {
        CExpressions *exp = *it;
        int ret = exp->Execute( script, pShape );
        if( !script->CanDelete( ret ) )
        {
            // yield script, cannot run.
            assert( "Yield script" && 0 );
        }
    }
    GetInst( ScriptSys ).DelScript( script );

#ifdef _RUNSTACKINFO1_
    CMessage::AsyWriteFile(GetGame()->GetStatckFileName(), "COpScript::Execute() end");
#endif
}
开发者ID:,项目名称:,代码行数:58,代码来源:


示例6: GetParameterXML

void NewtonProblem::SetParameters(OptimizeClass* objfcn)
{
  Problem::SetParameters(objfcn);

  DOMElement* searchXML = GetParameterXML();
  VariableList* variables = GetVariables();

  string gradMult, searchSize, maxBack;

  OptNewtonLike * objfcnNewt = (OptNewtonLike *) objfcn;

  if(searchType_ == trustPDS)
  {
    objfcnNewt->setSearchStrategy(TrustPDS);

    gradMult =
      XMLString::transcode(searchXML->getAttribute(XMLString::transcode("gradMult")));
    if (gradMult != "")
      objfcnNewt->setGradMult(atof(gradMult.c_str()));

    searchSize =
      XMLString::transcode(searchXML->getAttribute(XMLString::transcode("searchSize")));
    if (searchSize != "")
      objfcnNewt->setSearchSize(atoi(searchSize.c_str()));
  }
  else if (searchType_ == lineSearch)
  {
    objfcnNewt->setSearchStrategy(LineSearch);

    maxBack =
      XMLString::transcode(searchXML->getAttribute(XMLString::transcode("maxBTIter")));
    if (maxBack != "")
      objfcnNewt->setMaxBacktrackIter(atoi(maxBack.c_str()));
  }
  else if (searchType_ == trustRegion)
  {
    if ((variables->upperExists()) || (variables->lowerExists()))
    {
      cout << "Newton with Trust Region does not support bounds." << endl;
      cout << "Using Line Search instead." << endl;
      objfcnNewt->setSearchStrategy(LineSearch);
    }
    else
    {
      objfcnNewt->setSearchStrategy(TrustRegion);
      gradMult =
	XMLString::transcode(searchXML->getAttribute(XMLString::transcode("gradMult")));
      if (gradMult != "")
	objfcnNewt->setGradMult(atof(gradMult.c_str()));
    }
  }
  else
  {
    cerr << "Unrecognized search strategy type" << endl;
    exit(1);
  }
}
开发者ID:OpenCMISS-Dependencies,项目名称:optpp,代码行数:57,代码来源:NewtonProblem.C


示例7: calculateSignature

std::string NFunctionSignature::calculateSignature(const NType& returnType, const VariableList& arguments)
{
	std::string name = "fp-(";
	name += returnType.name + "-";
	for (VariableList::const_iterator i = arguments.begin(); i != arguments.end(); i++)
		name += (*i)->type.name + ",";
	name += ")";
	return name;
}
开发者ID:tyrel,项目名称:DCPUToolchain,代码行数:9,代码来源:NFunctionSignature.cpp


示例8: SetVar

	///
	/// 设置指定列表里某个变量的值
	///
	/// ret = SetVar( operType, "$varName", val, pos )
	/// @param operType:VT_SCRIPT, VT_SRCSHAPE, VT_DESTSHAPE, VT_GLOBAL
	/// @param varName 变量名
	/// @param val 变量值
	/// @param pos [可选]数组索引
	///
	static int SetVar( lua_State *L )
	{
		Script *script = GetInst( ScriptSys ).GetScript( L );
		long operType = (long) tolua_tonumber( L, 1, 0 );
		VariableList *varList = ( script != NULL ? script->GetVarList( operType ) : NULL );
		bool ret = false;
		if( varList != NULL )
		{
			ret = true;
			long index = (long) tolua_tonumber( L, 4, 0 );
			const char *varName = TOLUA_TOSTRING( varName, L, 2, "" );
			long varType = VarList::VarType( varName );
			if( varType == VariableList::VAR_NUM )
			{
				VariableList::Number val = (VariableList::Number) tolua_tonumber( L, 3, 0 );
				varList->SetVarValue( varName, val, index );
				if( operType == Script::VT_GLOBAL )
				{
					ScriptUtils::UpdateValToWS( varName, val, index );
				}
			}
			else if( varType == VariableList::VAR_STRING )
			{
				const char *val = TOLUA_TOSTRING( val, L, 3, "" ); 
				varList->SetVarValue( varName, tString( val ), index );
				if( operType == Script::VT_GLOBAL )
				{
					ScriptUtils::UpdateValToWS( varName, tString( val ), index );
				}
			}
			else if( varType == VariableList::VAR_GUID )
			{
				const CGUID *val = TOLUA_TOGUID( val, L, 3, &NULL_GUID ); 
				varList->SetVarValue( varName, *val, index );
				if( operType == Script::VT_GLOBAL )
				{
					ScriptUtils::UpdateValToWS( varName, *val, index );
				}
			}
			else
			{
				// argument error
				ret = false;
			}
		}
		else
		{
			// pop the arguments.
			int top = lua_gettop( L );
			lua_settop( L, top - 3 );
		}

		lua_pushboolean( L, ret ? 1 : 0 );
		return 1;
	}
开发者ID:xiongshaogang,项目名称:mmo-resourse,代码行数:64,代码来源:VarListFuncs.cpp


示例9: locker

uint32_t
ModuleList::FindGlobalVariables (const ConstString &name, 
                                 bool append, 
                                 uint32_t max_matches, 
                                 VariableList& variable_list)
{
    size_t initial_size = variable_list.GetSize();
    Mutex::Locker locker(m_modules_mutex);
    collection::iterator pos, end = m_modules.end();
    for (pos = m_modules.begin(); pos != end; ++pos)
    {
        (*pos)->FindGlobalVariables (name, NULL, append, max_matches, variable_list);
    }
    return variable_list.GetSize() - initial_size;
}
开发者ID:fbsd,项目名称:old_lldb,代码行数:15,代码来源:ModuleList.cpp


示例10: locker

size_t
ModuleList::FindGlobalVariables (const RegularExpression& regex, 
                                 bool append, 
                                 size_t max_matches,
                                 VariableList& variable_list) const
{
    size_t initial_size = variable_list.GetSize();
    Mutex::Locker locker(m_modules_mutex);
    collection::const_iterator pos, end = m_modules.end();
    for (pos = m_modules.begin(); pos != end; ++pos)
    {
        (*pos)->FindGlobalVariables (regex, append, max_matches, variable_list);
    }
    return variable_list.GetSize() - initial_size;
}
开发者ID:AlexShiLucky,项目名称:swift-lldb,代码行数:15,代码来源:ModuleList.cpp


示例11: guard

size_t
ModuleList::FindGlobalVariables (const ConstString &name, 
                                 bool append, 
                                 size_t max_matches,
                                 VariableList& variable_list) const
{
    size_t initial_size = variable_list.GetSize();
    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
    collection::const_iterator pos, end = m_modules.end();
    for (pos = m_modules.begin(); pos != end; ++pos)
    {
        (*pos)->FindGlobalVariables(name, nullptr, append, max_matches, variable_list);
    }
    return variable_list.GetSize() - initial_size;
}
开发者ID:envytools,项目名称:lldb,代码行数:15,代码来源:ModuleList.cpp


示例12: FindGlobalVariables

uint32_t SymbolFile::FindGlobalVariables(
    const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
    bool append, uint32_t max_matches, VariableList &variables) {
  if (!append)
    variables.Clear();
  return 0;
}
开发者ID:krytarowski,项目名称:lldb,代码行数:7,代码来源:SymbolFile.cpp


示例13: RemoveVar

	///
	/// 移除指定列表里的某个脚本变量
	///
	/// RemoveVar( operType, "$varName" )
	/// @param operType:VT_SCRIPT, VT_SRCSHAPE, VT_DESTSHAPE
	/// @param varName 变量名
	///
	static int RemoveVar( lua_State *L )
	{
		Script *script = GetInst( ScriptSys ).GetScript( L );
		long operType = (long) tolua_tonumber( L, 1, 0 );
		VariableList *varList = ( script != NULL ? script->GetVarList( operType ) : NULL );
		if( operType == Script::VT_GLOBAL )
		{
			// not support global variable list
			varList = NULL;
		}
		const char *varName = TOLUA_TOSTRING( varName, L, 2, "" );
		if( varList != NULL )
		{
			varList->RemoveVar( varName );
		}
		return 0;
	}
开发者ID:xiongshaogang,项目名称:mmo-resourse,代码行数:24,代码来源:VarListFuncs.cpp


示例14: abstract_rates

void Location::abstract_rates(const VariableList &cvl, 
						       const Valuations &dvl, 
						       vector<int> &v_rates) const
{
    int pos = 0;
    for ( auto it = cvl.begin(); it != cvl.end(); it++, pos++) {
        auto x = *it;
	    for ( auto iit = rates.begin(); iit != rates.end(); iit++) {
	        if (x == iit->get_var()) {
                int r = iit->eval(dvl);
                v_rates[pos] = r;
                break;
            }
        }
    }

}
开发者ID:glipari,项目名称:forts,代码行数:17,代码来源:automaton.cpp


示例15: GetNumVar

OptError NewtonProblem::CreateApplicationOptimizer(OptimizeClass * &objfcn,
						   NLP0 * &func)
{
  OptError error;
  int numVar = GetNumVar();
  VariableList* variables = GetVariables();
  CompoundConstraint* constraints = 0;

  AppLauncher * launcher = GetAppLauncher();
  USERFCN0APP userFcn = &(launcher->run_app);
  INITFCNAPP initFcn = &(launcher->init_app);

  if(userFcn == NULL)
  {
    error.value = -4;
    error.msg = "Error loading  user function";
    return error;
  }
  else if(initFcn == NULL)	
  {
    error.value = -4;
    error.msg = "Error loading init function";
    return error;
  }

  if ((variables->linearExists()) || (variables->nonlinearExists()))
  {
    cout << "Newton does not support linear or nonlinear constraints." << endl;
    cout << "Linear and nonlinear constraints being ignored." << endl;
  }
  if ((variables->upperExists()) || (variables->lowerExists()))
  {
    constraints = new CompoundConstraint(Constraint(variables->GetBoundConstraints()));
  }

  FDNLF1APP * myFunc = new FDNLF1APP(numVar, userFcn, initFcn,
				     launcher, constraints);
  myFunc->setIsExpensive(true);
  if(searchType_ == trustPDS)
    myFunc->setSpecOption(NoSpec);
  func = myFunc;

  if ((variables->upperExists()) || (variables->lowerExists()))
  {
    objfcn = new OptBCQNewton(myFunc);
  }
  else
  {
    objfcn = new OptQNewton(myFunc);
  }

  error.value = 0;
  error.msg = "Success";
  return error;
}	
开发者ID:OpenCMISS-Dependencies,项目名称:optpp,代码行数:55,代码来源:NewtonProblem.C


示例16:

size_t
VariableList::AppendVariablesIfUnique (const RegularExpression& regex, VariableList &var_list, size_t& total_matches)
{
    const size_t initial_size = var_list.GetSize();
    iterator pos, end = m_variables.end();
    for (pos = m_variables.begin(); pos != end; ++pos)
    {
        if ((*pos)->NameMatches (regex))
        {
            // Note the total matches found
            total_matches++;
            // Only add this variable if it isn't already in the "var_list"
            var_list.AddVariableIfUnique (*pos);
        }
    }
    // Return the number of new unique variables added to "var_list"
    return var_list.GetSize() - initial_size;
}
开发者ID:filcab,项目名称:lldb,代码行数:18,代码来源:VariableList.cpp


示例17: testVarParser

void testVarParser(char *buf)
{
    printf("===== Testing Variable parser ======\n");
//	time_t start = GetTickCount();
    VariableList li;
//	fflush(stdout);

    std::map<std::string, std::string> ignoreTokens;
    get_variables(buf, li, ignoreTokens, true);
//	time_t end = GetTickCount();
    for (VariableList::iterator iter = li.begin(); iter != li.end(); iter++) {
        Variable var = *iter;
        var.Print();
    }

//	printf("total time: %d\n", end-start);
    printf("matches found: %d\n", li.size());
}
开发者ID:Hmaal,项目名称:codelite,代码行数:18,代码来源:main.cpp


示例18: stackVariables

   void GeneralConstraint::stackVariables( VariableList& varList,
                                           const VariableSet& varSet )
   {
      for(VariableSet::const_iterator it= varSet.begin();
          it!=varSet.end();
          ++it)
      {
         varList.push_back(*it);
      }

   }  // End of method 'GeneralConstraint::stackVariables()'
开发者ID:Milfhunter,项目名称:gpstk,代码行数:11,代码来源:GeneralConstraint.cpp


示例19:

/**
 * Creates and caches a simplified version of the linear programming problem,
 * where redundant rows, columns and constraints are removed,
 * if it has not been created before.
 * Then, the simplified problem is solved.
 *
 * @return the result of the solving attempt
 */
ResultType
LPSolveInterface::_Presolve(const VariableList& variables)
{
    if (fLpPresolved == NULL) {
        fLpPresolved = copy_lp(fLP);
        set_presolve(fLpPresolved, PRESOLVE_ROWS | PRESOLVE_COLS
                     | PRESOLVE_LINDEP, get_presolveloops(fLpPresolved));
    }

    ResultType result = (ResultType)solve(fLpPresolved);

    if (result == OPTIMAL) {
        int32 size = variables.CountItems();
        for (int32 i = 0; i < size; i++) {
            Variable* current = variables.ItemAt(i);
            current->SetValue(get_var_primalresult(fLpPresolved,
                                                   get_Norig_rows(fLpPresolved) + current->GlobalIndex() + 1));
        }
    }

    return result;
}
开发者ID:,项目名称:,代码行数:30,代码来源:


示例20: rates_to_Linear_Constraint

Linear_Constraint Location::rates_to_Linear_Constraint(const VariableList &cvl, 
						       const Valuations &dvl, 
						       VariableList &lvars) const
{
    Linear_Constraint lc;
    for ( auto const &x : cvl) {
	//string x = it->name;
	for ( auto iit = rates.begin(); iit != rates.end(); iit++) {
	    if (x == iit->get_var()) {
		PPL::Variable v = get_ppl_variable(cvl, x);
		Linear_Expr le = iit->to_Linear_Expr(cvl, dvl);
		AT_Constraint atc = (v==le);
		lc.insert(atc);
		for (auto lt = lvars.begin(); lt != lvars.end(); lt++)
		    if ( x == *lt) {
			lvars.erase(lt);
			break;
		    }
		break;
	    }
	}
    }
    return lc;
}
开发者ID:glipari,项目名称:forts,代码行数:24,代码来源:automaton.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VariablePacker类代码示例发布时间:2022-05-31
下一篇:
C++ VariableIdSet类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap