* Add new DOTGraphTraits::addCustomGraphFeatures method
authorChris Lattner <sabre@nondot.org>
Wed, 16 Oct 2002 01:44:59 +0000 (01:44 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 16 Oct 2002 01:44:59 +0000 (01:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4197 91177308-0d34-0410-b5e6-96231b3b80d8

include/Support/DOTGraphTraits.h
include/Support/GraphWriter.h
include/llvm/Support/DOTGraphTraits.h
include/llvm/Support/GraphWriter.h

index ca7c463f1c715c1b975e06fb43cdd73440f0ec77..42f9af24c6160423e752e124a207f2d370b346ea 100644 (file)
@@ -60,6 +60,15 @@ struct DefaultDOTGraphTraits {
   /// edge.
   template<typename EdgeIter>
   static EdgeIter getEdgeTarget(void *Node, EdgeIter I) { return I; }
+
+  /// addCustomGraphFeatures - If a graph is made up of more than just
+  /// straight-forward nodes and edges, this is the place to put all of the
+  /// custom stuff neccesary.  The GraphWriter object, instantiated with your
+  /// GraphType is passed in as an argument.  You may call arbitrary methods on
+  /// it to add things to the output graph.
+  ///
+  template<typename GraphWriter>
+  static void addCustomGraphFeatures(void *Graph, GraphWriter &GW) {}
 };
 
 
index 0a7576cd7c516bd19e368df0642c38ffe33822cd..7783b4680876fb57055ef77f802d57506125cdf2 100644 (file)
@@ -72,7 +72,11 @@ public:
     O << DOTTraits::getGraphProperties(G);
     O << "\n";
 
+    // Emit all of the nodes in the graph...
     writeNodes();
+
+    // Output any customizations on the graph
+    DOTTraits::addCustomGraphFeatures(G, *this);
   }
 
   ~GraphWriter() {
index ca7c463f1c715c1b975e06fb43cdd73440f0ec77..42f9af24c6160423e752e124a207f2d370b346ea 100644 (file)
@@ -60,6 +60,15 @@ struct DefaultDOTGraphTraits {
   /// edge.
   template<typename EdgeIter>
   static EdgeIter getEdgeTarget(void *Node, EdgeIter I) { return I; }
+
+  /// addCustomGraphFeatures - If a graph is made up of more than just
+  /// straight-forward nodes and edges, this is the place to put all of the
+  /// custom stuff neccesary.  The GraphWriter object, instantiated with your
+  /// GraphType is passed in as an argument.  You may call arbitrary methods on
+  /// it to add things to the output graph.
+  ///
+  template<typename GraphWriter>
+  static void addCustomGraphFeatures(void *Graph, GraphWriter &GW) {}
 };
 
 
index 0a7576cd7c516bd19e368df0642c38ffe33822cd..7783b4680876fb57055ef77f802d57506125cdf2 100644 (file)
@@ -72,7 +72,11 @@ public:
     O << DOTTraits::getGraphProperties(G);
     O << "\n";
 
+    // Emit all of the nodes in the graph...
     writeNodes();
+
+    // Output any customizations on the graph
+    DOTTraits::addCustomGraphFeatures(G, *this);
   }
 
   ~GraphWriter() {