Joos1W Compiler Framework
All Classes Functions Typedefs Pages
utils::DotPrinter Class Reference

A class to help print DOT graphs! More...

#include <DotPrinter.h>

Public Member Functions

 DotPrinter (ostream &os)
 Constructor takes in the output stream to print into.
 
 DotPrinter (ostream &os, string_view min_height)
 Constructor takes in the output stream to print into.
 
void printTableSingleRow (string_view cell_text, string_list cell_attrs={}, bool left_align=false)
 Prints a table row with a single column.
 
void printTableDoubleRow (string_view cell1_text, string_view cell2_text, string_list cell1_attrs={}, string_list cell2_attrs={})
 Prints a table row with 2 columns.
 
void printTableTripleRow (string_view cell1_text, string_view cell2_text, string_view cell3_text, string_list cell1_attrs={}, string_list cell2_attrs={}, string_list cell3_attrs={})
 Prints a table row with 3 columns.
 
void startTLabel (int id, string_list attrs={}, string_view cellpadding="1")
 Starts a DOT label that is also an HTML table.
 
void endTLabel ()
 Ends a DOT label that is also an HTML table.
 
void startLabel (int id, string_list attrs={})
 Starts a DOT label.
 
void endLabel ()
 Ends a DOT label.
 
void printLabel (int id, string_view label, string_list attrs={})
 Prints a DOT label.
 
void startSubgraph (int id, string_view label="")
 Prints the DOT subgraph { given id.
 
void endSubgraph ()
 Prints the remainder of the DOT subgraph.
 
void startGraph ()
 Prints the DOT graph {.
 
void endGraph ()
 Prints the remainder of the DOT graph.
 
void printConnection (int from, int to)
 Prints a DOT connection between 2 nodes.
 
void printBackedge (int from, int to)
 Prints a DOT connection between 2 nodes but it goes against the hierarchy and is dotted red arrow.
 
void printConnection (int from, string_view port, int to, int lhead_cluster=-1)
 Prints a DOT connection between 2 nodes. More...
 
int id ()
 Allocates a new unique id.
 
template<typename T >
int id (T const *ptr)
 
template<typename T >
int getId (T const *ptr)
 
void sanitize (string_view str)
 Print a santized string as a label value.
 
void print (string_view str)
 Print a single line of indented text.
 

Friends

ostream & operator<< (ostream &os, Sanitize s)
 

Detailed Description

A class to help print DOT graphs!

Definition at line 10 of file DotPrinter.h.

Member Function Documentation

◆ printConnection()

void utils::DotPrinter::printConnection ( int  from,
string_view  port,
int  to,
int  lhead_cluster = -1 
)
inline

Prints a DOT connection between 2 nodes.

Parameters
fromThe node from which the connection starts
port1The port of the from node
toThe node to which the connection ends
lhead_clusterIf we should connect to a subgraph, the id of it

Definition at line 167 of file DotPrinter.h.

168  {
169  indent() << "node" << from << port << " -> node" << to;
170  if(lhead_cluster != -1) {
171  os << " [lhead=cluster_" << lhead_cluster << "]";
172  }
173  os << "\n";
174  }

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