Static Value-Flow Analysis
Public Member Functions | Static Public Member Functions | List of all members
SVF::GraphPrinter Class Reference

#include <GraphPrinter.h>

Public Member Functions

 GraphPrinter ()
 

Static Public Member Functions

template<class GraphType >
static void WriteGraphToFile (SVF::OutStream &O, const std::string &GraphName, const GraphType &GT, bool simple=false)
 
template<class GraphType >
static void PrintGraph (SVF::OutStream &O, const std::string &GraphName, const GraphType &GT)
 

Detailed Description

Definition at line 44 of file GraphPrinter.h.

Constructor & Destructor Documentation

◆ GraphPrinter()

SVF::GraphPrinter::GraphPrinter ( )
inline

Definition at line 48 of file GraphPrinter.h.

49  {
50  }

Member Function Documentation

◆ PrintGraph()

template<class GraphType >
static void SVF::GraphPrinter::PrintGraph ( SVF::OutStream O,
const std::string GraphName,
const GraphType &  GT 
)
inlinestatic

Print the graph to command line

Define the GTraits and node iterator for printing

Definition at line 79 of file GraphPrinter.h.

81  {
83  typedef GenericGraphTraits<GraphType> GTraits;
84 
85  typedef typename GTraits::NodeRef NodeRef;
86  typedef typename GTraits::nodes_iterator node_iterator;
87  typedef typename GTraits::ChildIteratorType child_iterator;
88 
89  O << "Printing VFG Graph" << "'...\n";
90  // Print each node name and its edges
91  node_iterator I = GTraits::nodes_begin(GT);
92  node_iterator E = GTraits::nodes_end(GT);
93  for (; I != E; ++I)
94  {
95  NodeRef *Node = *I;
96  O << "node :" << Node << "'\n";
97  child_iterator EI = GTraits::child_begin(Node);
98  child_iterator EE = GTraits::child_end(Node);
99  for (unsigned i = 0; EI != EE && i != 64; ++EI, ++i)
100  {
101  O << "child :" << *EI << "'\n";
102  }
103  }
104  }

◆ WriteGraphToFile()

template<class GraphType >
static void SVF::GraphPrinter::WriteGraphToFile ( SVF::OutStream O,
const std::string GraphName,
const GraphType &  GT,
bool  simple = false 
)
inlinestatic

Write the graph into dot file for debugging purpose

Definition at line 56 of file GraphPrinter.h.

58  {
59  // Filename of the output dot file
60  std::string Filename = GraphName + ".dot";
61  std::ofstream outFile(Filename);
62  if (outFile.fail())
63  {
64  O << " error opening file for writing!\n";
65  outFile.close();
66  return;
67  }
68 
69  O << "Writing '" << Filename << "'...";
70 
71  WriteGraph(outFile, GT, simple);
72  outFile.close();
73  }
const char *const string
Definition: cJSON.h:172
std::ofstream & WriteGraph(std::ofstream &O, const GraphType &G, bool ShortNames=false)
Definition: GraphWriter.h:328

The documentation for this class was generated from the following file: