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


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

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


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

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

示例2: main

int main(int argc, char** argv)
{
    // Register the error handler
    vc_error_hdlr = errorHandler;

#if  !defined(__MINGW32__) && !defined(__MINGW64__) && !defined( _MSC_VER)
    // Grab some memory from the OS upfront to reduce system time when
    // individual hash tables are being allocated
    if (sbrk(INITIAL_MEMORY_PREALLOCATION_SIZE) == ((void*) - 1)) {
        FatalError("Initial allocation of memory failed.");
    }
#endif /* !defined(__MINGW32__) && !defined(__MINGW64__) && !defined( _MSC_VER) */


    bm = new STPMgr();
    toClose = NULL;

    auto_ptr<SimplifyingNodeFactory> simplifyingNF( new SimplifyingNodeFactory(*bm->hashingNodeFactory, *bm));
    bm->defaultNodeFactory = simplifyingNF.get();

    // The simplified keeps a pointer to whatever is set as the default node factory.
    Simplifier* simp  = new Simplifier(bm);
    auto_ptr<Simplifier> simpCleaner(simp);

    ArrayTransformer* arrayTransformer = new ArrayTransformer(bm, simp);
    auto_ptr<ArrayTransformer> atClearner(arrayTransformer);

    ToSAT* tosat = new ToSAT(bm);
    auto_ptr<ToSAT> tosatCleaner(tosat);

    AbsRefine_CounterExample* Ctr_Example = new AbsRefine_CounterExample(bm, simp, arrayTransformer);
    auto_ptr<AbsRefine_CounterExample> ctrCleaner(Ctr_Example);

    create_options();
    int ret = parse_options(argc, argv);
    if (ret != 0) {
        return ret;
    }

    GlobalSTP = new STP(bm, simp, arrayTransformer, tosat, Ctr_Example);

    // If we're not reading the file from stdin.
    if (!infile.empty()) {
        read_file();
    }

    //want to print the output always from the commandline.
    bm->UserFlags.print_output_flag = true;
    ASTVec* AssertsQuery = new ASTVec;

    bm->GetRunTimes()->start(RunTimes::Parsing);
    parse_file(AssertsQuery);
    bm->GetRunTimes()->stop(RunTimes::Parsing);

    /*  The SMTLIB2 has a command language. The parser calls all the functions,
     *  so when we get to here the parser has already called "exit". i.e. if the
     *  language is smt2 then all the work has already been done, and all we need
     *  to do is cleanup...
     *    */
    if (!bm->UserFlags.smtlib2_parser_flag) {

        if (((ASTVec*) AssertsQuery)->empty()) {
            FatalError("Input is Empty. Please enter some asserts and query\n");
        }

        if (((ASTVec*) AssertsQuery)->size() != 2) {
            FatalError("Input must contain a query\n");
        }

        ASTNode asserts = (*(ASTVec*) AssertsQuery)[0];
        ASTNode query = (*(ASTVec*) AssertsQuery)[1];

        if (onePrintBack) {
            print_back(query, asserts);
            return 0;
        }

        SOLVER_RETURN_TYPE ret = GlobalSTP->TopLevelSTP(asserts, query);
        if (bm->UserFlags.quick_statistics_flag) {
            bm->GetRunTimes()->print();
        }
        (GlobalSTP->tosat)->PrintOutput(ret);

        asserts = ASTNode();
        query = ASTNode();
    }

    //Without cleanup
    if (bm->UserFlags.isSet("fast-exit", "1")) {
        exit(0);
    }

    //Propery tidy up
    AssertsQuery->clear();
    delete AssertsQuery;

    _empty_ASTVec.clear();

    simpCleaner.release();
    atClearner.release();
//.........这里部分代码省略.........
开发者ID:AmesianX,项目名称:stp,代码行数:101,代码来源:main.cpp

示例3: main

int Main::main(int argc, char** argv)
{
  unique_ptr<SimplifyingNodeFactory> simplifyingNF(
      new SimplifyingNodeFactory(*bm->hashingNodeFactory, *bm));
  bm->defaultNodeFactory = simplifyingNF.get();

  unique_ptr<Simplifier> simp(new Simplifier(bm));
  unique_ptr<ArrayTransformer> arrayTransformer(
      new ArrayTransformer(bm, simp.get()));
  unique_ptr<ToSAT> tosat(new ToSAT(bm));

  unique_ptr<AbsRefine_CounterExample> Ctr_Example(
      new AbsRefine_CounterExample(bm, simp.get(), arrayTransformer.get()));

  int ret = create_and_parse_options(argc, argv);
  if (ret != 0)
  {
    return ret;
  }

  STP* stp = new STP(bm, simp.get(), arrayTransformer.get(), tosat.get(),
                     Ctr_Example.get());

  GlobalSTP = stp;
  // If we're not reading the file from stdin.
  if (!infile.empty())
    read_file();

  // want to print the output always from the commandline.
  bm->UserFlags.print_output_flag = true;
  ASTVec* AssertsQuery = new ASTVec;

  bm->GetRunTimes()->start(RunTimes::Parsing);
  parse_file(AssertsQuery);
  bm->GetRunTimes()->stop(RunTimes::Parsing);

  GlobalSTP = NULL;

  /*  The SMTLIB2 has a command language. The parser calls all the functions,
   *  so when we get to here the parser has already called "exit". i.e. if the
   *  language is smt2 then all the work has already been done, and all we need
   *  to do is cleanup...
   *    */
  if (!bm->UserFlags.smtlib2_parser_flag)
  {
    if (AssertsQuery->empty())
      FatalError("Input is Empty. Please enter some asserts and query\n");

    if (AssertsQuery->size() != 2)
      FatalError("Input must contain a query\n");

    ASTNode asserts = (*AssertsQuery)[0];
    ASTNode query = (*AssertsQuery)[1];

    if (onePrintBack)
    {
      print_back(query, asserts);
    }
    else
    {
      SOLVER_RETURN_TYPE ret = stp->TopLevelSTP(asserts, query);

      if (bm->UserFlags.quick_statistics_flag)
      {
        bm->GetRunTimes()->print();
      }
      stp->tosat->PrintOutput(ret);
    }

    asserts = ASTNode();
    query = ASTNode();
  }

  // Previously we used fast-exit to avoid destroying lots of objects, for example in the node manager.
  // We use unique_ptr now on lots of stuff, so there seems little difference in the time it takes to
  // exit normally vs. not.
  //if (bm->UserFlags.isSet("fast-exit", "0"))
  //  exit(0);

  //Cleanup
  AssertsQuery->clear();
  delete AssertsQuery;
  _empty_ASTVec.clear();
  delete stp;
  CNFClearMemory();

  return 0;
}
开发者ID:stp,项目名称:stp,代码行数:88,代码来源:main_common.cpp

示例4: main


//.........这里部分代码省略.........
   *  so when we get to here the parser has already called "exit". i.e. if the
   *  language is smt2 then all the work has already been done, and all we need
   *  to do is cleanup...
   *    */
  if (!bm->UserFlags.smtlib2_parser_flag)
    {

      if (((ASTVec*) AssertsQuery)->empty())
        {
          FatalError("Input is Empty. Please enter some asserts and query\n");
        }

      if (((ASTVec*) AssertsQuery)->size() != 2)
        {
          FatalError("Input must contain a query\n");
        }

      ASTNode asserts = (*(ASTVec*) AssertsQuery)[0];
      ASTNode query = (*(ASTVec*) AssertsQuery)[1];

      if (onePrintBack)
        {

          ASTNode original_input = bm->CreateNode(AND, bm->CreateNode(NOT, query), asserts);

          if (bm->UserFlags.print_STPinput_back_flag)
            {
              if (bm->UserFlags.smtlib1_parser_flag)
                bm->UserFlags.print_STPinput_back_SMTLIB2_flag = true;
              else
                bm->UserFlags.print_STPinput_back_CVC_flag = true;
            }

          if (bm->UserFlags.print_STPinput_back_CVC_flag)
            {
              //needs just the query. Reads the asserts out of the data structure.
              print_STPInput_Back(original_input);
            }

          if (bm->UserFlags.print_STPinput_back_SMTLIB1_flag)
            {
              printer::SMTLIB1_PrintBack(cout, original_input);
            }

          if (bm->UserFlags.print_STPinput_back_SMTLIB2_flag)
            {
              printer::SMTLIB2_PrintBack(cout, original_input);
            }

          if (bm->UserFlags.print_STPinput_back_C_flag)
            {
              printer::C_Print(cout, original_input);
            }

          if (bm->UserFlags.print_STPinput_back_GDL_flag)
            {
              printer::GDL_Print(cout, original_input);
            }

          if (bm->UserFlags.print_STPinput_back_dot_flag)
            {
              printer::Dot_Print(cout, original_input);
            }

          return 0;
        }

      SOLVER_RETURN_TYPE ret = GlobalSTP->TopLevelSTP(asserts, query);
      if (bm->UserFlags.quick_statistics_flag)
        {
          bm->GetRunTimes()->print();
        }
      (GlobalSTP->tosat)->PrintOutput(ret);

      asserts = ASTNode();
      query = ASTNode();
    }

  // Currently for testcase12.stp.smt2 we spend 3 seconds running the destructors,
  // the total runtime is 17 seconds, so about 20% of runtime is spent destructing
  // which is wasted work because the process is going to be killed anyway.
  if (bm->UserFlags.isSet("fast-exit", "1"))
	  exit(0);

  AssertsQuery->clear();
  delete AssertsQuery;

  _empty_ASTVec.clear();

  simpCleaner.release();
  atClearner.release();
  tosatCleaner.release();
  ctrCleaner.release();

  delete GlobalSTP;
  delete ParserBM;


  return 0;
}//end of Main
开发者ID:0bliv10n,项目名称:s2e,代码行数:101,代码来源:main.cpp

示例5: main

int Main::main(int argc, char** argv)
{
  auto_ptr<SimplifyingNodeFactory> simplifyingNF(
      new SimplifyingNodeFactory(*bm->hashingNodeFactory, *bm));
  bm->defaultNodeFactory = simplifyingNF.get();

  // The simplified keeps a pointer to whatever is set as the default node
  // factory.
  Simplifier* simp = new Simplifier(bm);
  auto_ptr<Simplifier> simpCleaner(simp);

  ArrayTransformer* arrayTransformer = new ArrayTransformer(bm, simp);
  auto_ptr<ArrayTransformer> atClearner(arrayTransformer);

  ToSAT* tosat = new ToSAT(bm);
  auto_ptr<ToSAT> tosatCleaner(tosat);

  AbsRefine_CounterExample* Ctr_Example =
      new AbsRefine_CounterExample(bm, simp, arrayTransformer);
  auto_ptr<AbsRefine_CounterExample> ctrCleaner(Ctr_Example);

  int ret = create_and_parse_options(argc, argv);
  if (ret != 0)
  {
    return ret;
  }

  GlobalSTP = new STP(bm, simp, arrayTransformer, tosat, Ctr_Example);

  // If we're not reading the file from stdin.
  if (!infile.empty())
  {
    read_file();
  }

  // want to print the output always from the commandline.
  bm->UserFlags.print_output_flag = true;
  ASTVec* AssertsQuery = new ASTVec;

  bm->GetRunTimes()->start(RunTimes::Parsing);
  parse_file(AssertsQuery);
  bm->GetRunTimes()->stop(RunTimes::Parsing);

  /*  The SMTLIB2 has a command language. The parser calls all the functions,
   *  so when we get to here the parser has already called "exit". i.e. if the
   *  language is smt2 then all the work has already been done, and all we need
   *  to do is cleanup...
   *    */
  if (!bm->UserFlags.smtlib2_parser_flag)
  {

    if (((ASTVec*)AssertsQuery)->empty())
    {
      FatalError("Input is Empty. Please enter some asserts and query\n");
    }

    if (((ASTVec*)AssertsQuery)->size() != 2)
    {
      FatalError("Input must contain a query\n");
    }

    ASTNode asserts = (*(ASTVec*)AssertsQuery)[0];
    ASTNode query = (*(ASTVec*)AssertsQuery)[1];

    if (onePrintBack)
    {
      print_back(query, asserts);
      return 0;
    }

    SOLVER_RETURN_TYPE ret = GlobalSTP->TopLevelSTP(asserts, query);
    if (bm->UserFlags.quick_statistics_flag)
    {
      bm->GetRunTimes()->print();
    }
    (GlobalSTP->tosat)->PrintOutput(ret);

    asserts = ASTNode();
    query = ASTNode();
  }

  // Without cleanup
  if (bm->UserFlags.isSet("fast-exit", "1"))
  {
    exit(0);
  }

  // Propery tidy up
  AssertsQuery->clear();
  delete AssertsQuery;

  _empty_ASTVec.clear();

  simpCleaner.release();
  atClearner.release();
  tosatCleaner.release();
  ctrCleaner.release();

  delete GlobalSTP;

//.........这里部分代码省略.........
开发者ID:delcypher,项目名称:stp,代码行数:101,代码来源:main_common.cpp


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