Otawa  0.10
ODisplay Library

This library is delivered with OTAWA to provide graphical display of managed graphs. More...

Classes

class  otawa::display::Color
 A color description. More...
 
class  otawa::display::TextStyle
 Description of the style of text. More...
 
class  otawa::display::FillStyle
 The style of a filled area. More...
 
class  otawa::display::ShapeStyle
 Shape style. More...
 
class  otawa::display::AbstractDrawer
 Provides facilities to draw a graph. More...
 
class  otawa::display::AbstractDrawer::Vertex
 This class represents vertices in the AbstractDrawer. More...
 
class  otawa::display::AbstractDrawer::Edge
 An edge in a AbstractDrawer. More...
 
class  otawa::display::CFGAdapter
 This adapter implements the otawa::concept::DiGraphWithNodeMap and allows to use apply the GenDrawer to a CFG. More...
 
class  otawa::display::GenDrawer< G, D >
 A simple engine to draw graphs. More...
 
class  otawa::display::DefaultDecorator< G >
 Default decorator that just output the given edges and vertices. More...
 
class  otawa::display::Item
 This class is the base of Graph, Node and Edge. More...
 
class  otawa::display::Graph
 A graph provides facilities to display a graph. More...
 
class  otawa::display::Driver
 A driver provides facilities to display a graph. More...
 
class  otawa::display::DisplayException
 This exception is thrown during the display of a graph if there is an error. More...
 
class  otawa::display::Plugin
 A plugin to provide driver to display graphs. More...
 

Functions

Identifier< AbstractIdentifier * > otawa::display::INCLUDE ("otawa::display::include")
 Tells that the properties with the given identifier have to be printed. More...
 
Identifier< AbstractIdentifier * > otawa::display::EXCLUDE ("otawa::display::exclude")
 Tells that the properties with the given identifier mustn't be printed. More...
 
Identifier< AbstractIdentifier * > otawa::display::DEFAULT ("otawa::display::default")
 The value of the property must be either INCLUDE or EXCLUDE. More...
 
Identifier< elm::CStringotawa::display::BACKGROUND ("otawa::display::background")
 Identifier of the background color. More...
 
Identifier< elm::CStringotawa::display::COLOR ("otawa::display::color")
 Identifier of the drawing color (boxes, edges) More...
 
Identifier< int > otawa::display::STYLE ("otawa::display::style")
 Identifier of the drawing style. More...
 
Identifier< elm::CStringotawa::display::FONT_COLOR ("otawa::display::text_color")
 Identifier of the text color. More...
 
Identifier< int > otawa::display::FONT_SIZE ("otawa::display::text_size")
 Identifier of the text size. More...
 
Identifier< elm::CStringotawa::display::FONT ("otawa::display::font_name")
 Identifier of the font name. More...
 
Identifier< elm::CStringotawa::display::HREF ("otawa::display::href")
 Identifier of the url of the link the object is pointing to. More...
 
Identifier< elm::Stringotawa::display::TITLE ("otawa::display::title")
 Identifier of the title of a node. More...
 
Identifier< elm::Stringotawa::display::BODY ("otawa::display::body")
 Identifier of the body of a node. More...
 
Identifier< int > otawa::display::SHAPE ("otawa::display::shape")
 Identifier of a shape of a node. More...
 
Identifier< elm::Stringotawa::display::LABEL ("otawa::display::label")
 Identifier of a label of an edge. More...
 
Identifier< int > otawa::display::WEIGHT ("otawa::display::weight")
 Identifier of a weight of an edge. More...
 
Identifier< kind_t > otawa::display::OUTPUT_KIND ("otawa::display::output_kind", OUTPUT_ANY)
 Passed to the graph style of the Driver::newGraph() method, selects the kind of output. More...
 
Identifier< string > otawa::display::OUTPUT_PATH ("otawa::display::output_path","")
 Passed to the graph style of the Driver::newGraph() method, selects the file to output to when the driver display in a file. More...
 

Variables

Identifier< AbstractIdentifier * > otawa::display::INCLUDE
 Tells that the properties with the given identifier have to be printed. More...
 
Identifier< AbstractIdentifier * > otawa::display::EXCLUDE
 Tells that the properties with the given identifier mustn't be printed. More...
 
Identifier< AbstractIdentifier * > otawa::display::DEFAULT
 The value of the property must be either INCLUDE or EXCLUDE. More...
 
Identifier< elm::CStringotawa::display::BACKGROUND
 Identifier of the background color. More...
 
Identifier< elm::CStringotawa::display::COLOR
 Identifier of the drawing color (boxes, edges) More...
 
Identifier< int > otawa::display::STYLE
 Identifier of the drawing style. More...
 
Identifier< elm::CStringotawa::display::FONT_COLOR
 Identifier of the text color. More...
 
Identifier< elm::CString > & otawa::display::TEXT_COLOR = FONT_COLOR
 Identifier of the text color. More...
 
Identifier< int > otawa::display::FONT_SIZE
 Identifier of the text size. More...
 
Identifier< int > & otawa::display::TEXT_SIZE = FONT_SIZE
 Identifier of the text size. More...
 
Identifier< elm::CStringotawa::display::FONT
 Identifier of the font name. More...
 
Identifier< elm::CStringotawa::display::HREF
 Identifier of the url of the link the object is pointing to. More...
 
Identifier< elm::Stringotawa::display::TITLE
 Identifier of the title of a node. More...
 
Identifier< elm::Stringotawa::display::BODY
 Identifier of the body of a node. More...
 
Identifier< int > otawa::display::SHAPE
 Identifier of a shape of a node. More...
 
Identifier< elm::Stringotawa::display::LABEL
 Identifier of a label of an edge. More...
 
Identifier< int > otawa::display::WEIGHT
 Identifier of a weight of an edge. More...
 
Identifier< kind_t > otawa::display::OUTPUT_KIND
 Passed to the graph style of the Driver::newGraph() method, selects the kind of output. More...
 
Identifier< string > otawa::display::OUTPUT_PATH
 Passed to the graph style of the Driver::newGraph() method, selects the file to output to when the driver display in a file. More...
 
ShapeStyle otawa::display::AbstractDrawer::Vertex::shape
 Shape of the vertex publicly accessible for customization. More...
 

Detailed Description

This library is delivered with OTAWA to provide graphical display of managed graphs.

The main principle is to provides the same interface to each graph application whatever the required final output using a display driver system.

Classes
Using abstract graph description using classes otawa::display::Graph, otawa::display::Node or otawa::display::Edge, the applications describes the graph and the driver is responsible for outputting the graph in the user-chosen form (vector graphics, bitmap, screen display and so on).
Linking with ODisplay
The linkage options for using the ODisplay library may be easily obtained by using otawa-config:
$ otawa-config --libs display
Graph Look

The look of the graph is described using a set of object allowing to set the different display attributes.

GenDrawer class

The Gendrawer<G, D> class is the main entry point to use the display module. It accepts two generic arguments. The first one is the type of the displayed graph and must implement the concept otawa::concept::DiGraphWithNodeMap. The second one gives the look of each item of the graph and must implement the concept display::Decorator.

To display a graph, you have to :

In the example below, we draw a CFG from OTAWA. As the CFG does not implement the DiGraphWithNodeMap concept, we use te display::CFGAdapter to wrap it. The nodes of the graph is displayed with their basic block number except for entry and exit that are described with diamond and name. The edges are displayed using dashed lines.

#include <otawa/cfg.h>
using namespace otawa::display;
class MyDecorator {
public:
class CFGDecorator {
public:
static void decorate(
const G& graph,
const display::CFGAdapter& graph,
Output& caption,
display::TextStyle& text,
display::FillStyle& fill)
{ caption << graph->label() << " CFG"; }
static void decorate(
const G& graph,
const display::CFGAdapter::Vertex vertex,
Output& content,
display::ShapeStyle& style)
{
if(vertex->isEntry() || vertex->isExit())
if(vertex->isEntry()) content << "ENTRY";
else if(vertex->isExit()) content << "EXIT";
else content << vertex->number();
}
static void decorate(
const display::CFGAdapter::Edge edge,
Output& label,
display::TextStyle& text,
display::LineStyle& line)
{ line.style = LineStyle::DASHED;
};
CFG *my_cfg;
CFGAdapter adapter(my_cfg);
drawer.path = "my_cfg.ps";
drawer.draw();

There exist other adapters like the display::GenGraphAdapter for the GenGraph class.

Old Properties
This system of properties to describe the graph look is still supported but deprecated. It used in the CFGDrawer class.

Most classes of this library use a common set of properties described here.

The first set concerns the selection of the displayed attributes.

Other properties allow to select the lookup of the displayed elements:

We have properties that describes the content of the object:

Finally, some properties select the kind of output:

GraphViz Driver
ODisplay is delivered with a driver for the GraphViz package using the DOT textual format. This is the default driver and it accepts some specialized properties:

Function Documentation

Identifier<elm::CString> otawa::display::BACKGROUND ( "otawa::display::background"  )

Identifier of the background color.

Identifier<elm::String> otawa::display::BODY ( "otawa::display::body"  )

Identifier of the body of a node.

Identifier<elm::CString> otawa::display::COLOR ( "otawa::display::color"  )

Identifier of the drawing color (boxes, edges)

Identifier<AbstractIdentifier*> otawa::display::DEFAULT ( "otawa::display::default"  )

The value of the property must be either INCLUDE or EXCLUDE.

Gives a default behaviour to the properties that doesn't appear in any of the INCLUDE / EXCLUDE lists.

Identifier<AbstractIdentifier*> otawa::display::EXCLUDE ( "otawa::display::exclude"  )

Tells that the properties with the given identifier mustn't be printed.

Identifier<elm::CString> otawa::display::FONT ( "otawa::display::font_name"  )

Identifier of the font name.

Identifier<elm::CString> otawa::display::FONT_COLOR ( "otawa::display::text_color"  )

Identifier of the text color.

It is the same Identifier as TEXT_COLOR

Identifier<int> otawa::display::FONT_SIZE ( "otawa::display::text_size"  )

Identifier of the text size.

It is the same Identifier as TEXT_SIZE

Identifier<elm::CString> otawa::display::HREF ( "otawa::display::href"  )

Identifier of the url of the link the object is pointing to.

Identifier<AbstractIdentifier*> otawa::display::INCLUDE ( "otawa::display::include"  )

Tells that the properties with the given identifier have to be printed.

Identifier<elm::String> otawa::display::LABEL ( "otawa::display::label"  )

Identifier of a label of an edge.

Identifier<kind_t> otawa::display::OUTPUT_KIND ( "otawa::display::output_kind"  ,
OUTPUT_ANY   
)

Passed to the graph style of the Driver::newGraph() method, selects the kind of output.

Identifier<string> otawa::display::OUTPUT_PATH ( "otawa::display::output_path"  ,
""   
)

Passed to the graph style of the Driver::newGraph() method, selects the file to output to when the driver display in a file.

Identifier<int> otawa::display::SHAPE ( "otawa::display::shape"  )

Identifier of a shape of a node.

Must be one of shape_t

Identifier<int> otawa::display::STYLE ( "otawa::display::style"  )

Identifier of the drawing style.

Must be one of style_t

Identifier<elm::String> otawa::display::TITLE ( "otawa::display::title"  )

Identifier of the title of a node.

Identifier<int> otawa::display::WEIGHT ( "otawa::display::weight"  )

Identifier of a weight of an edge.

Variable Documentation

Identifier<elm::CString> otawa::display::BACKGROUND("otawa::display::background")

Identifier of the background color.

Referenced by otawa::display::GraphVizItem::printAttribute().

Identifier<elm::CString> otawa::display::COLOR("otawa::display::color")

Identifier of the drawing color (boxes, edges)

Referenced by otawa::display::GraphVizItem::printAttribute().

Identifier<AbstractIdentifier*> otawa::display::DEFAULT("otawa::display::default")

The value of the property must be either INCLUDE or EXCLUDE.

Gives a default behaviour to the properties that doesn't appear in any of the INCLUDE / EXCLUDE lists.

Referenced by otawa::display::GraphVizItem::printAttribute().

Identifier<AbstractIdentifier*> otawa::display::EXCLUDE("otawa::display::exclude")

Tells that the properties with the given identifier mustn't be printed.

Referenced by otawa::display::CFGDrawer::onInit(), and otawa::display::GraphVizItem::printAttribute().

Identifier<elm::CString> otawa::display::FONT("otawa::display::font_name")
Identifier<elm::CString> otawa::display::FONT_COLOR("otawa::display::text_color")

Identifier of the text color.

It is the same Identifier as TEXT_COLOR

Referenced by otawa::display::GraphVizGraphElement::printAttribute().

Identifier<int> otawa::display::FONT_SIZE("otawa::display::text_size")
Identifier<elm::CString> otawa::display::HREF("otawa::display::href")

Identifier of the url of the link the object is pointing to.

Referenced by otawa::display::GraphVizItem::printAttribute().

Identifier<AbstractIdentifier*> otawa::display::INCLUDE("otawa::display::include")

Tells that the properties with the given identifier have to be printed.

Referenced by otawa::display::GraphVizItem::printAttribute().

Identifier<kind_t> otawa::display::OUTPUT_KIND("otawa::display::output_kind", OUTPUT_ANY)

Passed to the graph style of the Driver::newGraph() method, selects the kind of output.

Referenced by otawa::display::GraphVizGraph::display(), and otawa::display::AbstractDrawer::draw().

Identifier<string> otawa::display::OUTPUT_PATH("otawa::display::output_path","")

Passed to the graph style of the Driver::newGraph() method, selects the file to output to when the driver display in a file.

Referenced by otawa::display::GraphVizGraph::display(), and otawa::display::AbstractDrawer::draw().

otawa::display::AbstractDrawer::Vertex::shape

Shape of the vertex publicly accessible for customization.

Referenced by otawa::display::AbstractDrawer::Vertex::Vertex().

Identifier<int> otawa::display::SHAPE("otawa::display::shape")
Identifier<int> otawa::display::STYLE("otawa::display::style")
Identifier< elm::CString > & otawa::display::TEXT_COLOR = FONT_COLOR

Identifier of the text color.

It is the same Identifier as FONT_COLOR

Identifier< int > & otawa::display::TEXT_SIZE = FONT_SIZE

Identifier of the text size.

It is the same Identifier as FONT_SIZE

Identifier<int> otawa::display::WEIGHT("otawa::display::weight")

Identifier of a weight of an edge.

Referenced by otawa::display::GraphVizEdge::printAttribute().