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


C++ SgGraphNode::get_index方法代码示例

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


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

示例1: printGraph


//.........这里部分代码省略.........
    //string hex_address = isSgGraphNode(itn23->second)->get_name();
    int pos = itn23->first;
    //    rose_graph_integer_node_hash_map::iterator it = result.find(hex_address);
    rose_graph_integer_node_hash_map::iterator it = result.find(pos);
    if (it==result.end()) {
      // not found in result, i.e. delete
      //nodesResult.erase(hex_address);
      nodesResult.erase(pos);
    }
  }
  //  vizzGraph->nodes=nodesResult;

#if 0
  // vizzGraph->nodes=result;

  // create file
  bool forward_analysis=true;
  bool multiedge=false;
  std::ofstream myfile;
  myfile.open(fileName.c_str());

  string name = "ROSE Graph";
  vizzGraph->printProlog(myfile, name);

  string functionName="";

  vizzGraph->setGrouping(true);
  vizzGraph->printNodes(true, this, forward_analysis, myfile,functionName);
  nrNodes=vizzGraph->nodes.size();

  vizzGraph->printEdges(this,myfile, multiedge);
  nrEdges=vizzGraph->get_node_index_to_edge_multimap_edgesOut().size();

  vizzGraph->printEpilog(myfile);
  myfile.close();

#endif



#if 1
  RoseBin_Graph* gr = new RoseBin_DotGraph();
  gr->graph = new SgIncidenceDirectedGraph("test");//SgDirectedGraph("test","test");
  gr->get_node_index_to_node_map()=nodesResult;

  //typedef SB_DirectedGraph::edgeType edgeType;
  rose_graph_integer_edge_hash_multimap edges = vizzGraph->get_node_index_to_edge_multimap_edgesOut();
  rose_graph_integer_edge_hash_multimap resultEdges;
  rose_graph_integer_edge_hash_multimap::iterator itEdg = edges.begin();

  for (; itEdg!=edges.end();++itEdg) {
    int index  = itEdg->first;
    SgGraphNode* node = NULL;
    rose_graph_integer_node_hash_map::iterator nIT = vizzGraph->get_node_index_to_node_map().find(index);
    if (nIT!=vizzGraph->get_node_index_to_node_map().end())
      node=nIT->second;
    ROSE_ASSERT(node);
    SgDirectedGraphEdge* edge = isSgDirectedGraphEdge(itEdg->second);
    SgGraphNode* target = isSgGraphNode(edge->get_to());
    rose_graph_integer_node_hash_map::iterator itn2 = nodesResult.begin();
    bool foundS=false;
    if (node)
      foundS=true;
    bool foundT=false;
    for (; itn2!=nodesResult.end();++itn2) {
      SgGraphNode* n = itn2->second;
      //if (n==source) foundS=true;
      if (n==target) foundT=true;
    }
    if (foundS==false || foundT==false) {

    } else
      resultEdges.insert(make_pair(node->get_index(),edge));
  }

  gr->get_node_index_to_edge_multimap_edgesOut()=resultEdges;

  // create file
  bool forward_analysis=true;
  bool multiedge=false;
  std::ofstream myfile;
  myfile.open(fileName.c_str());

  string name = "ROSE Graph";
  gr->printProlog(myfile, name);

  string functionName="";

  gr->setGrouping(true);
  gr->printNodes(true, this, forward_analysis, myfile,functionName);
  nrNodes=gr->get_node_index_to_node_map().size();
  ROSE_ASSERT(g_algo->info);
  gr->printEdges(g_algo->info, this,myfile, multiedge);
  nrEdges=gr->get_node_index_to_edge_multimap_edgesOut().size();

  gr->printEpilog(myfile);
  myfile.close();
#endif
#endif
}
开发者ID:ian-bertolacci,项目名称:rose-develop,代码行数:101,代码来源:RoseBin_ControlFlowAnalysis.cpp


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