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


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

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


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

示例1: CreateTerm

ASTNode NodeFactory::CreateTerm(Kind kind, unsigned int width,
                                const ASTNode& child0, const ASTVec &children)
{
    ASTVec child;
    child.reserve(children.size() + 1);
    child.push_back(child0);
    child.insert(child.end(), children.begin(), children.end());
    return CreateTerm(kind, width, child);
}
开发者ID:khooyp,项目名称:stp,代码行数:9,代码来源:NodeFactory.cpp

示例2: checkChildrenAreBV

  void checkChildrenAreBV(const ASTVec& v, const ASTNode&n) {
	for (ASTVec::const_iterator it = v.begin(), itend = v.end(); it != itend; it++)
		if (BITVECTOR_TYPE != it->GetType()) {
			cerr << "The type is: " << it->GetType() << endl;
			FatalError(
					"BVTypeCheck:ChildNodes of bitvector-terms must be bitvectors\n",
					n);
		}
}
开发者ID:chubbymaggie,项目名称:Tac-Symbolic-Executor,代码行数:9,代码来源:ASTmisc.cpp

示例3: CreateNode

ASTNode NodeFactory::CreateNode(Kind kind, const ASTNode& child0,
                                const ASTVec & back_children)
{
    ASTVec front_children;
    front_children.reserve(1 + back_children.size());
    front_children.push_back(child0);
    front_children.insert(front_children.end(), back_children.begin(),
                          back_children.end());
    return CreateNode(kind, front_children);
}
开发者ID:khooyp,项目名称:stp,代码行数:10,代码来源:NodeFactory.cpp

示例4: printAssertsToStream

void STPMgr::printAssertsToStream(ostream& os)
{
  ASTVec v = GetAsserts();
  for (ASTVec::iterator i = v.begin(), iend = v.end(); i != iend; i++)
  {
    ASTNode q = *i;
    os << "ASSERT( ";
    q.PL_Print(os, this);
    os << ");" << endl;
  }
}
开发者ID:stp,项目名称:stp,代码行数:11,代码来源:AssortedPrinters.cpp

示例5: printAssertsToStream

 void STPMgr::printAssertsToStream(ostream &os, int simplify_print) {
   ASTVec v = GetAsserts();
   for(ASTVec::iterator i=v.begin(),iend=v.end();i!=iend;i++) {
     //Begin_RemoveWrites = true; ASTNode q = (simplify_print == 1) ?
     //SimplifyFormula_TopLevel(*i,false) : *i; q = (simplify_print
     //== 1) ? SimplifyFormula_TopLevel(q,false) : q;
     ASTNode q = *i;
     //Begin_RemoveWrites = false;
     os << "ASSERT( ";
     q.PL_Print(os);
     os << ");" << endl;
   }
 }
开发者ID:0bliv10n,项目名称:s2e,代码行数:13,代码来源:AssortedPrinters.cpp

示例6: FlattenKind

 void FlattenKind(const Kind k, const ASTVec &children, ASTVec & flat_children)
 {
   ASTVec::const_iterator ch_end = children.end();
   for (ASTVec::const_iterator it = children.begin(); it != ch_end; it++)
     {
       Kind ck = it->GetKind();
       if (k == ck)
         {
           FlattenKind(k,it->GetChildren(), flat_children);
         }
       else
         {
           flat_children.push_back(*it);
         }
     }
 }
开发者ID:chubbymaggie,项目名称:Tac-Symbolic-Executor,代码行数:16,代码来源:ASTmisc.cpp

示例7: print_STPInput_Back

  void print_STPInput_Back(const ASTNode& query) {

	  // Determine the symbols in the query and asserts.
	  ASTNodeSet visited;
	  ASTNodeSet symbols;
	  buildListOfSymbols(query,  visited, symbols);
      ASTVec v = (BEEV::GlobalSTP->bm)->GetAsserts();
      for(ASTVec::iterator i=v.begin(),iend=v.end();i!=iend;i++)
    	buildListOfSymbols(*i,  visited, symbols);

	(BEEV::GlobalSTP->bm)->printVarDeclsToStream(cout, symbols);
    (BEEV::GlobalSTP->bm)->printAssertsToStream(cout,0);
    cout << "QUERY(";
    query.PL_Print(cout);
    cout << ");\n";
  } //end of print_STPInput_Back()
开发者ID:0bliv10n,项目名称:s2e,代码行数:16,代码来源:AssortedPrinters.cpp

示例8: switch

  void Dot_Print1(ostream &os, const ASTNode n, hash_set<int> *alreadyOutput)
  {

    // check if this node has already been printed. If so return.
    if (alreadyOutput->find(n.GetNodeNum()) != alreadyOutput->end())
      return;

    alreadyOutput->insert(n.GetNodeNum());

    os << "n" << n.GetNodeNum() << "[label =\"";
    switch (n.GetKind())
      {
      case SYMBOL:
        n.nodeprint(os);
        break;

      case BITVECTOR:
      case BVCONST:
        outputBitVec(n, os);
        break;

      default:
        os << _kind_names[n.GetKind()];
      }

    os << "\"];" << endl;

    // print the edges to each child.
    ASTVec ch = n.GetChildren();
    ASTVec::iterator itend = ch.end();
    int i = 0;
    for (ASTVec::iterator it = ch.begin(); it < itend; it++)
      {
        os << "n" << n.GetNodeNum() 
           << " -> " << "n" 
           << it->GetNodeNum() 
           << "[label=" << i++ 
           << "];" << endl;
      }

    // print each of the children.
    for (ASTVec::iterator it = ch.begin(); it < itend; it++)
      {
        Dot_Print1(os, *it, alreadyOutput);
      }
  }
开发者ID:AmesianX,项目名称:stp,代码行数:46,代码来源:dotPrinter.cpp

示例9: FlattenKindNoDuplicates

/* Maintains a set of nodes that have already been seen. So that deeply shared
 * AND,OR operations are not
 * flattened multiple times.
 */
void FlattenKindNoDuplicates(const Kind k, const ASTVec& children,
                             ASTVec& flat_children,
                             ASTNodeSet& alreadyFlattened)
{
  const ASTVec::const_iterator ch_end = children.end();
  for (ASTVec::const_iterator it = children.begin(); it != ch_end; it++)
  {
    const Kind ck = it->GetKind();
    if (k == ck)
    {
      if (alreadyFlattened.find(*it) == alreadyFlattened.end())
      {
        alreadyFlattened.insert(*it);
        FlattenKindNoDuplicates(k, it->GetChildren(), flat_children,
                                alreadyFlattened);
      }
    }
    else
    {
      flat_children.push_back(*it);
    }
  }
}
开发者ID:cambridgehackers,项目名称:stp,代码行数:27,代码来源:ASTmisc.cpp

示例10: FlattenKind

  // Flatten (k ... (k ci cj) ...) to (k ... ci cj ...)
  // This is local to this file.
  ASTVec FlattenKind(Kind k, const ASTVec &children)
  {
    ASTVec flat_children;

    ASTVec::const_iterator ch_end = children.end();
    for (ASTVec::const_iterator it = children.begin(); it != ch_end; it++)
      {
        Kind ck = it->GetKind();
        const ASTVec &gchildren = it->GetChildren();
        if (k == ck)
          {
            // append grandchildren to children
            flat_children.insert(flat_children.end(),
                                 gchildren.begin(), gchildren.end());
          }
        else
          {
            flat_children.push_back(*it);
          }
      }

    return flat_children;
  }
开发者ID:Esail,项目名称:CourseProject,代码行数:25,代码来源:ASTmisc.cpp

示例11: BVConstEvaluator


//.........这里部分代码省略.........
      //zero the useless bits of q
      q &= qmask;

      //64 bit mask for r
      unsigned long long int rmask = 0xffffffffffffffffLL;     
      rmask >>= 64-rlen;
      //zero the useless bits of r
      r &= rmask;
      
      //concatenate
      q <<= rlen;
      q |= r;

      //64 bit mask for output s
      unsigned long long int smask = 0xffffffffffffffffLL;
      smask >>= 64-slen;
      
      //currently q has the output
      output = q;      
      output &= smask;
      break;
    }
    case BVMULT: {
      output = t0.GetBVConst() * t1.GetBVConst();

      //64 bit mask
      unsigned long long int mask = 0xffffffffffffffffLL;
      mask = mask >> (64 - inputwidth);
      output &= mask;
      break;
    }
    case BVPLUS: {
      ASTVec c = t.GetChildren();
      for(ASTVec::iterator it=c.begin(),itend=c.end();it!=itend;it++)
  output += BVConstEvaluator(*it).GetBVConst();

      //64 bit mask
      unsigned long long int mask = 0xffffffffffffffffLL;
      mask = mask >> (64 -inputwidth);
      output &= mask;
      break;
    }
    case SBVDIV:
    case SBVMOD: {
      output = BVConstEvaluator(TranslateSignedDivMod(t)).GetBVConst();
      break;
    }
    case BVDIV: {
      if(0 == t1.GetBVConst()) {
  //if denominator is 0 then 
  //  (if refinement is ON then output is set to 0) 
  //   (else produce a fatal error)
  if(counterexample_checking_during_refinement) {
    output = 0;
    bvdiv_exception_occured = true;
    break;
  }
  else {
    FatalError("BVConstEvaluator: divide by zero not allowed:",t);
  }
      }

      output = t0.GetBVConst() / t1.GetBVConst();
      //64 bit mask
      unsigned long long int mask = 0xffffffffffffffffLL;
      mask = mask >> (64 - inputwidth);
开发者ID:Icefroge,项目名称:cloud9,代码行数:67,代码来源:consteval.cpp

示例12: GDL_Print1

void GDL_Print1(ostream& os, const ASTNode& n, hash_set<int>* alreadyOutput,
                string (*annotate)(const ASTNode&))
{
  // check if this node has already been printed. If so return.
  if (alreadyOutput->find(n.GetNodeNum()) != alreadyOutput->end())
    return;

  alreadyOutput->insert(n.GetNodeNum());

  os << "node: { title:\"n" << n.GetNodeNum() << "\" label: \"";
  switch (n.GetKind())
  {
    case SYMBOL:
      n.nodeprint(os);
      break;

    case BITVECTOR:
    case BVCONST:
      outputBitVec(n, os);
      break;

    default:
      os << _kind_names[n.GetKind()];
  }

  os << annotate(n);
  os << "\"}" << endl;

  // print the edges to each child.
  const ASTVec ch = n.GetChildren();
  const ASTVec::const_iterator itend = ch.end();

  // If a node has the child 'TRUE' twice, we only want to output one TRUE node.
  ASTNodeSet constantOutput;

  int i = 0;
  for (ASTVec::const_iterator it = ch.begin(); it < itend; it++)
  {
    std::stringstream label;

    if (!isCommutative(n.GetKind()))
      label << " label:\"" << i << "\"";

    if (it->isConstant())
    {
      std::stringstream ss;
      ss << n.GetNodeNum() << "_" << it->GetNodeNum();

      if (constantOutput.end() == constantOutput.find(*it))
      {
        os << "node: { title:\"n";

        os << ss.str() << "\" label: \"";
        if (it->GetType() == BEEV::BOOLEAN_TYPE)
          os << _kind_names[it->GetKind()];
        else
          outputBitVec(*it, os);
        os << "\"}" << endl;
        constantOutput.insert(*it);
      }

      os << "edge: { source:\"n" << n.GetNodeNum() << "\" target: \""
         << "n" << ss.str() << "\"" << label.str() << "}" << endl;
    }
    else
      os << "edge: { source:\"n" << n.GetNodeNum() << "\" target: \""
         << "n" << it->GetNodeNum() << "\"" << label.str() << "}" << endl;
    i++;
  }

  // print each of the children.
  for (ASTVec::const_iterator it = ch.begin(); it < itend; it++)
  {
    if (!it->isConstant())
      GDL_Print1(os, *it, alreadyOutput, annotate);
  }
}
开发者ID:delcypher,项目名称:stp,代码行数:77,代码来源:GDLPrinter.cpp

示例13: TopLevelSTPAux

  //UserGuided abstraction refinement
  SOLVER_RETURN_TYPE
  STP::
  UserGuided_AbsRefine(SATSolver& NewSolver,
		       const ASTNode& original_input)
  {
    ASTVec v = bm->GetAsserts_WithKey(0);
    if(v.empty())
      {
	FatalError("UserGuided_AbsRefine: Something is seriously wrong."\
		   "The input set is empty");
      }
    ASTNode sureAddInput = 
      (v.size() == 1) ? v[0] : bm->CreateNode(AND, v); 

    SOLVER_RETURN_TYPE res = SOLVER_UNDECIDED;
    res = TopLevelSTPAux(NewSolver, sureAddInput, original_input);
    if(SOLVER_UNDECIDED != res)
      {
	return res;
      }
    
    //Do refinement here
    if(AND != original_input.GetKind())
      {
	FatalError("UserGuided_AbsRefine: The input must be an AND");
      }

    ASTVec RefineFormulasVec;
    ASTVec RemainingFormulasVec;
    ASTNode asttrue = bm->CreateNode(TRUE);
    ASTNode astfalse = bm->CreateNode(FALSE);
    for(int count=0; count < bm->UserFlags.num_absrefine; count++)
      {
	RemainingFormulasVec.clear();
	RemainingFormulasVec.push_back(asttrue);
	RefineFormulasVec.clear();	
	RefineFormulasVec.push_back(asttrue);
	ASTVec InputKids = original_input.GetChildren();
	for(ASTVec::iterator it = InputKids.begin(), itend = InputKids.end();
	    it!=itend;it++)
	  {
	    Ctr_Example->ClearComputeFormulaMap();
	    if(astfalse == Ctr_Example->ComputeFormulaUsingModel(*it))
	      {
		RefineFormulasVec.push_back(*it);
	      }
	    else
	      {
		RemainingFormulasVec.push_back(*it);
	      }
	  }
	ASTNode RefineFormulas =
	  (RefineFormulasVec.size() == 1) ?
	  RefineFormulasVec[0] : bm->CreateNode(AND, RefineFormulasVec);
	res = TopLevelSTPAux(NewSolver, RefineFormulas, original_input);
	if(SOLVER_UNDECIDED != res)
	  {
	    return res;
	  }
      }

    ASTNode RemainingFormulas = 
      (RemainingFormulasVec.size() == 1) ?
      RemainingFormulasVec[0] : bm->CreateNode(AND, RemainingFormulasVec);
    res = TopLevelSTPAux(NewSolver, RemainingFormulas, original_input);
    
    if(SOLVER_UNDECIDED != res)
      {
	return res;
      }
    
    FatalError("TopLevelSTPAux: reached the end without proper conclusion:"
	       "either a divide by zero in the input or a bug in STP");    
    return SOLVER_ERROR;
  } //End of UserGuided_AbsRefine()
开发者ID:DidwardFrenkel,项目名称:stp,代码行数:76,代码来源:STP.cpp

示例14: CreateSimpXor

  // Constant children are accumulated in "accumconst".
  ASTNode STPMgr::CreateSimpXor(ASTVec &children)
  {

    if (_trace_simpbool)
      {
        cout << "========" << endl << "CreateSimpXor ";
        lpvec(children);
        cout << endl;
      }

    ASTVec flat_children; // empty vector
    ASTVec::const_iterator it_end = children.end();

    if (UserFlags.xor_flatten_flag)
      {
        flat_children = FlattenKind(XOR, children);
      }
    else
      {
        flat_children = children;
      }

    // sort so that identical nodes occur in sequential runs, followed by
    // their negations.
    SortByExprNum(flat_children);

    ASTNode retval;

    // This is the C Boolean value of all constant args seen.  It is initially
    // 0.  TRUE children cause it to change value.
    bool accumconst = 0;

    ASTVec new_children;

    it_end = flat_children.end();
    ASTVec::iterator next_it;
    for (ASTVec::iterator it = flat_children.begin(); it != it_end; it++)
      {
        next_it = it + 1;
        bool nextexists = (next_it < it_end);

        if (ASTTrue == *it)
          {
            accumconst = !accumconst;
          }
        else if (ASTFalse == *it)
          {
            // Ignore it
          }
        else if (nextexists && (*next_it == *it))
          {
            // x XOR x = FALSE.  Skip current, write "false" into next_it
            // so that it gets tossed, too.
            *next_it = ASTFalse;
          }
        else if (nextexists && (next_it->GetKind() == NOT) 
                 && ((*next_it)[0] == *it))
          {
            // x XOR NOT x = TRUE.  Skip current, write "true" into next_it
            // so that it gets tossed, too.
            *next_it = ASTTrue;
          }
        else if (NOT == it->GetKind())
          {
            // If child is (NOT alpha), we can flip accumconst and use alpha.
            // This is ok because (NOT alpha) == TRUE XOR alpha
            accumconst = !accumconst;
            // CreateSimpNot just takes child of not.
            new_children.push_back(CreateSimpNot(*it));
          }
        else
          {
            new_children.push_back(*it);
          }
      }

    // Children should be non-constant.
    if (new_children.size() < 2)
      {
        if (0 == new_children.size())
          {
            // XOR(TRUE, FALSE) -- accumconst will be 1.
            if (accumconst)
              {
                retval = ASTTrue;
              }
            else
              {
                retval = ASTFalse;
              }
          }
        else
          {
            // there is just one child
            // XOR(x, TRUE) -- accumconst will be 1.
            if (accumconst)
              {
                retval = CreateSimpNot(new_children[0]);
              }
//.........这里部分代码省略.........
开发者ID:DidwardFrenkel,项目名称:stp,代码行数:101,代码来源:SimpBool.cpp

示例15: SortByArith

 void SortByArith(ASTVec& v)
 {
   sort(v.begin(), v.end(), arithless);
 }
开发者ID:chubbymaggie,项目名称:Tac-Symbolic-Executor,代码行数:4,代码来源:ASTmisc.cpp


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