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


C++ i2string函数代码示例

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


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

示例1: if

void component_exprt::gen_loc_var(
    exprt &loc_var,
    const exprt &expr, 
    std::string suffix)
{
  std::string base;
  if (expr.id()==ID_symbol)
    base="."+id2string(to_symbol_expr(expr).get_identifier());
  else if (expr.id()==ID_constant)
    base=".const";
  else if (expr.id()==ID_typecast)
  {
    base=".typecast__"+id2string(expr.type().id());
    if (expr.type().id()==ID_signedbv)
    {
      base=base+i2string(to_signedbv_type(expr.type()).get_width());
    }
    else if (expr.type().id()==ID_unsignedbv)
    {
      base=base+i2string(to_unsignedbv_type(expr.type()).get_width());
    }
  }
  else if(id_maps.find(expr.id())!=id_maps.end())
    base=".OPERATOR."+id_maps[expr.id()];
  else
    base=".OPERATOR."+id2string(expr.id());
  std::string final_name="L."+id2string(source_location.get_line())+"."+i2string(instruction_number)+"_"+i2string(component_cnt)+"_"+i2string(unique_identifier)+base+suffix;
  //typet type(ID_integer);
  //exprt loc_var(ID_symbol, type);
  to_symbol_expr(loc_var).set_identifier(final_name);
}
开发者ID:rbavishi,项目名称:iCBMC,代码行数:31,代码来源:component_e.cpp

示例2: i2string

propt::resultt qbf_squolem_coret::prop_solve()
{
  {
    std::string msg=
      "Squolem: "+
      i2string(no_variables())+" variables, "+
      i2string(no_clauses())+" clauses";
    messaget::status() << msg << messaget::eom;
  }

  squolem->endOfOriginals();
  bool result = squolem->decide();

  if(result)
  {
    messaget::status() << "Squolem: VALID" << messaget::eom;
    return P_SATISFIABLE;
  }
  else
  {
    messaget::status() << "Squolem: INVALID" << messaget::eom;
    return P_UNSATISFIABLE;
  }

  return P_ERROR;
}
开发者ID:sarnold,项目名称:cbmc,代码行数:26,代码来源:qbf_squolem_core.cpp

示例3: parameter_expr

void simulator_loop_detectiont::get_fresh_induction_parameter(
    exprt &parameter)
{
  symbol_exprt parameter_expr(uint_type());

  bool found;
  do 
  {
    parameter_index++;
    parameter_expr.set_identifier("c::N$"+i2string(parameter_index));
    parameter_expr.set("induction_symbol", true);

    try 
    {
      concrete_model.ns.lookup(parameter_expr);
      found = true;
    }
    catch (std::string ex) 
    {
      found = false;
    }
  }
  while (found);

  symbolt sym;

  sym.name = parameter_expr.get_identifier();
  sym.base_name = "N$"+i2string(parameter_index);
  sym.module = ID_C;

  shadow_context.add (sym);

  parameter = parameter_expr;
}
开发者ID:olivo,项目名称:BP,代码行数:34,代码来源:simulator_loop_detection.cpp

示例4: solver_text

propt::resultt qbf_bdd_coret::prop_solve()
{
  {
    std::string msg=
      solver_text() + ": "+
      i2string(no_variables())+" variables, "+
      i2string(matrix->nodeCount())+" nodes";
    messaget::status(msg);
  }

  model_bdds.resize(no_variables()+1, NULL);

  // Eliminate variables
  for(quantifierst::const_reverse_iterator it=quantifiers.rbegin();
      it!=quantifiers.rend();
      it++)
  {
    unsigned var=it->var_no;

    if(it->type==quantifiert::EXISTENTIAL)
    {
      #if 0
      std::cout << "BDD E: " << var << ", " <<
        matrix->nodeCount() << " nodes" << std::endl;
      #endif

      BDD* model = new BDD();
      const BDD &varbdd=*bdd_variable_map[var];
      *model = matrix->AndAbstract(varbdd.Xnor(bdd_manager->bddOne()),
                                   varbdd);
      model_bdds[var]=model;

      *matrix = matrix->ExistAbstract(*bdd_variable_map[var]);
    }
    else if(it->type==quantifiert::UNIVERSAL)
    {
      #if 0
      std::cout << "BDD A: " << var << ", " <<
        matrix->nodeCount() << " nodes" << std::endl;
      #endif

      *matrix = matrix->UnivAbstract(*bdd_variable_map[var]);
    }
    else
      throw ("Unquantified variable");
  }

  if(*matrix==bdd_manager->bddOne())
  {
    compress_certificate();
    return P_SATISFIABLE;
  }
  else if(*matrix==bdd_manager->bddZero())
  {
    model_bdds.clear();
    return P_UNSATISFIABLE;
  }
  else
    return P_ERROR;
}
开发者ID:ashokkelur,项目名称:CBMC-With-DSP-C,代码行数:60,代码来源:qbf_bdd_core.cpp

示例5: get_temporary_file

std::string get_temporary_file(
  const std::string &prefix,
  const std::string &suffix)
{
  #ifdef _WIN32
  TCHAR lpTempPathBuffer[MAX_PATH];
  DWORD dwRetVal;

  dwRetVal = GetTempPath(MAX_PATH,          // length of the buffer
                         lpTempPathBuffer); // buffer for path 

  if (dwRetVal > MAX_PATH || (dwRetVal == 0))
    throw "GetTempPath failed";

  std::string t_template=
    std::string(lpTempPathBuffer)+"\\"+prefix+
    i2string(getpid())+".XXXXXX"+suffix;
  #else
  std::string t_template=
    "/tmp/"+prefix+i2string(getpid())+".XXXXXX"+suffix;
  #endif

  char *t_ptr=strdup(t_template.c_str());
  
  int fd=my_mkstemps(t_ptr, suffix.size());

  if(fd<0)
    throw "mkstemps failed";  
    
  close(fd);

  std::string result=std::string(t_ptr);  
  free(t_ptr);
  return result;
}
开发者ID:ashokkelur,项目名称:CBMC-With-DSP-C,代码行数:35,代码来源:tempfile.cpp

示例6: class_template_identifier

std::string cpp_typecheckt::class_template_identifier(
  const irep_idt &base_name,
  const template_typet &template_type,
  const cpp_template_args_non_tct &partial_specialization_args)
{
  std::string identifier=
    cpp_scopes.current_scope().prefix+
    "template."+id2string(base_name) + "<";

  int counter=0;

  // these are probably not needed -- templates
  // should be unique in a namespace
  for(template_typet::template_parameterst::const_iterator
      it=template_type.template_parameters().begin();
      it!=template_type.template_parameters().end();
      it++)
  {
    if(counter!=0) identifier+=',';
  
    if(it->id()==ID_type)
      identifier+="Type"+i2string(counter);
    else
      identifier+="Non_Type"+i2string(counter);

    counter++;
  }

  identifier += ">";
  
  if(!partial_specialization_args.arguments().empty())
  {
    identifier+="_specialized_to_<";
  
    counter=0;
    for(cpp_template_args_non_tct::argumentst::const_iterator
        it=partial_specialization_args.arguments().begin();
        it!=partial_specialization_args.arguments().end();
        it++, counter++)
    {  
      if(counter!=0) identifier+=',';
      
      // These are not yet typechecked, as they may depend
      // on unassigned template parameters.

      if(it->id()==ID_type || it->id()=="ambiguous")
        identifier+=cpp_type2name(it->type());
      else
        identifier+=cpp_expr2name(*it);
    }
    
    identifier+='>';
  }
  
  return identifier;
}
开发者ID:martin-cs,项目名称:cbmc,代码行数:56,代码来源:cpp_typecheck_template.cpp

示例7: pretty

std::string abstract_independencet::pretty() const
{
	std::string result;
	
	result+="N"+i2string(current->number)+"/"
				+"N"+i2string(ancestor->number)+"/"
				+"N"+i2string(mover->number);
				
	return result;
}
开发者ID:bjowac,项目名称:impara,代码行数:10,代码来源:sensitivity.cpp

示例8: if

std::string cvc_propt::cvc_literal(literalt l)
{
  if(l==const_literal(false))
    return "FALSE";
  else if(l==const_literal(true))
    return "TRUE";

  if(l.sign())
    return "(NOT l"+i2string(l.var_no())+")";  

  return "l"+i2string(l.var_no());
}
开发者ID:sarnold,项目名称:cbmc,代码行数:12,代码来源:cvc_prop.cpp

示例9: get_variable_names

void modelcheckert::get_variable_names(
    const abstract_modelt &abstract_model)
{
    variable_names.resize(abstract_model.variables.size());

    for(unsigned i=0;
            i<abstract_model.variables.size();
            i++)
    {
        variable_names[i]="b"+i2string(i);

        std::string description=
            abstract_model.variables[i].description;

        // do some substitution
        substitute(description, " ", "_");
        substitute(description, "==", "eq");
        substitute(description, "!=", "neq");
        substitute(description, ">=", "ge");
        substitute(description, "<=", "le");
        substitute(description, ">>", "shr");
        substitute(description, "<<", "shl");
        substitute(description, "<", "lt");
        substitute(description, ">", "gt");
        substitute(description, "&", "amp");
        substitute(description, "|", "or");
        substitute(description, "+", "plus");
        substitute(description, "-", "minus");
        substitute(description, "*", "deref_");

        if(is_variable_name(description))
            variable_names[i]+="_"+description;
    }
}
开发者ID:olivo,项目名称:BP,代码行数:34,代码来源:modelchecker.cpp

示例10: assign_rec

void local_SSAt::build_transfer(locationt loc)
{
  if(loc->is_assign())
  {
    const code_assignt &code_assign=to_code_assign(loc->code);

    exprt deref_lhs=dereference(code_assign.lhs(), loc);
    exprt deref_rhs=dereference(code_assign.rhs(), loc);

    assign_rec(deref_lhs, deref_rhs, true_exprt(), loc);
  }
  else if(loc->is_function_call())
  {
    const code_function_callt &code_function_call=
      to_code_function_call(loc->code);
      
    const exprt &lhs=code_function_call.lhs();
      
    if(lhs.is_not_nil())
    {
      exprt deref_lhs=dereference(lhs, loc);
    
      // generate a symbol for rhs
      irep_idt identifier="ssa::return_value"+i2string(loc->location_number);
      symbol_exprt rhs(identifier, code_function_call.lhs().type());
      
      assign_rec(deref_lhs, rhs, true_exprt(), loc);
    }
  }
}
开发者ID:AnnaTrost,项目名称:deltacheck,代码行数:30,代码来源:local_ssa.cpp

示例11: tvt

tvt z3_propt::l_get(literalt a) const
{
  tvt result=tvt(false);
  std::string literal;
  Z3_ast z3_literal;
  size_t found;

  if(a.is_true())
    return tvt(true);
  else if(a.is_false())
    return tvt(false);

  literal = "l"+i2string(a.var_no());

  map_prop_varst::const_iterator cache_result=map_prop_vars.find(literal.c_str());
  if(cache_result!=map_prop_vars.end())
  {
    //std::cout << "Cache hit on " << cache_result->first << "\n";
	z3_literal = cache_result->second;
    Z3_app app = Z3_to_app(z3_ctx, z3_literal);
    Z3_func_decl d = Z3_get_app_decl(z3_ctx, app);
    literal = Z3_func_decl_to_string(z3_ctx, d);

    found=literal.find("true");

    if (found!=std::string::npos)
      result=tvt(true);
    else
      result=tvt(false);
  }

  if (a.sign()) result=!result;

  return result;
}
开发者ID:smaorus,项目名称:rvt,代码行数:35,代码来源:z3_prop.cpp

示例12: convert_literal

BtorExp* boolector_propt::convert_literal(unsigned l)
{
#ifdef DEBUG
  std::cout << "\n" << __FUNCTION__ << "[" << __LINE__ << "]" << "\n";
#endif

  std::string literal_s;

  literal_cachet::const_iterator cache_result=literal_cache.find(l);
  if(cache_result!=literal_cache.end())
  {
    //std::cout << "Cache hit on " << cache_result->first << "\n";
    return cache_result->second;
  }

  BtorExp* result;

  literal_s = "l"+i2string(l);
  result = boolector_var(boolector_ctx, 1, literal_s.c_str());

  // insert into cache
  literal_cache.insert(std::pair<unsigned, BtorExp*>(l, result));

  return result;
}
开发者ID:smaorus,项目名称:rvt,代码行数:25,代码来源:boolector_prop.cpp

示例13: from_expr

std::string bv_refinementt::approximationt::as_string() const
{
  #if 0
  return from_expr(expr);
  #else
  return i2string(id_nr)+"/"+id2string(expr.id());
  #endif
}
开发者ID:rbavishi,项目名称:iCBMC,代码行数:8,代码来源:refine_arithmetic.cpp

示例14: replace_nondet_sideeffects

void termination_baset::replace_nondet_sideeffects(exprt &expr)
{
  if(expr.id()=="sideeffect" &&
     expr.get("statement")=="nondet")
  {
    symbolt symbol;
    symbol.name=std::string("termination::nondet")+i2string(++nondet_counter);
    symbol.base_name=std::string("nondet")+i2string(nondet_counter);
    symbol.type=expr.type();

    expr=symbol_expr(symbol);
    shadow_context.move(symbol);
  }
  else
    Forall_operands(it, expr)
      replace_nondet_sideeffects(*it);
}
开发者ID:olivo,项目名称:BP,代码行数:17,代码来源:termination_base.cpp

示例15:

cvc_temp_filet::cvc_temp_filet()
{
  temp_out_filename="cvc_dec_out_"+i2string(getpid())+".tmp";

  temp_out.open(
    temp_out_filename.c_str(),
    std::ios_base::out | std::ios_base::trunc);
}
开发者ID:Dthird,项目名称:CBMC,代码行数:8,代码来源:cvc_dec.cpp


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