Otawa  0.10
Graph.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * Copyright (c) 2006, IRIT UPS.
4  *
5  * otawa/display/Graph.h -- display::Graph class interface.
6  */
7 #ifndef OTAWA_DISPLAY_GRAPH_H
8 #define OTAWA_DISPLAY_GRAPH_H
9 
10 #include <otawa/properties.h>
11 #include <otawa/display/display.h>
12 
13 namespace otawa { namespace display {
14 
15 // Filters
16 extern Identifier<AbstractIdentifier*> INCLUDE;
17 extern Identifier<AbstractIdentifier*> EXCLUDE;
18 
19 // either INCLUDE or EXCLUDE
20 extern Identifier<AbstractIdentifier*> DEFAULT;
21 
22 // Item class
23 class Item: public PropList {
24 public:
25  virtual void setProps(const PropList& props) = 0;
26 };
29 
30 // draw_style_t enum
31 typedef enum style_t {
38 } style_t;
39 extern Identifier<int> STYLE;
46 
47 
48 
49 // Node class
50 class Node: public Item {
51 };
54 
55 // form_t enum
56 extern Identifier<int> SHAPE;
57 
58 
59 // Edge class
60 class Edge: public Item {
61 public:
62 };
63 extern Identifier<int> WEIGHT;
65 
66 
67 // DisplayException class
68 class DisplayException: public Exception {
69 public:
70  inline DisplayException(void) { }
71  inline DisplayException(const string& msg): Exception(msg) { }
72 };
73 
74 
75 // Graph class
76 class Graph: public Item {
77 public:
78  virtual Node *newNode(const PropList& style = PropList::EMPTY,
79  const PropList& props = PropList::EMPTY) = 0;
80  virtual Edge *newEdge(Node *source, Node *target,
81  const PropList& style = PropList::EMPTY,
82  const PropList& props = PropList::EMPTY) = 0;
83  virtual void display(void) throw(DisplayException) = 0;
84 };
85 
86 } } // otawa::display
87 
88 #endif // OTAWA_DISPLAY_GRAPH_H
dtd::RefAttr< BasicBlock * > source("source", dtd::STRICT|dtd::REQUIRED)
virtual void display(void)=0
This functions displays the graph.
style_t
Definition: Graph.h:31
This exception is thrown during the display of a graph if there is an error.
Definition: Graph.h:68
Identifier< int > STYLE
Identifier of the drawing style.
static const PropList EMPTY
This is an empty proplist for convenience.
Definition: PropList.h:66
Identifier< elm::String > BODY
Identifier of the body of a node.
Identifier< elm::CString > & TEXT_COLOR
Identifier of the text color.
Definition: display_Graph.cpp:85
Identifier< int > & TEXT_SIZE
Identifier of the text size.
Definition: display_Graph.cpp:99
Identifier< elm::CString > HREF
Identifier of the url of the link the object is pointing to.
Definition: Graph.h:33
virtual void setProps(const PropList &props)=0
Set the object properties that have to be printed.
Definition: Graph.h:35
Identifier< AbstractIdentifier * > DEFAULT
The value of the property must be either INCLUDE or EXCLUDE.
Definition: Graph.h:37
Identifier< elm::CString > FONT
Identifier of the font name.
Identifier< elm::CString > FONT_COLOR
Identifier of the text color.
Identifier< int > WEIGHT
Identifier of a weight of an edge.
Identifier< AbstractIdentifier * > EXCLUDE
Tells that the properties with the given identifier mustn't be printed.
Identifier< int > FONT_SIZE
Identifier of the text size.
dtd::RefAttr< BasicBlock * > target("target", dtd::STRICT|dtd::REQUIRED)
virtual Node * newNode(const PropList &style=PropList::EMPTY, const PropList &props=PropList::EMPTY)=0
This function creates a new node in the graph.
Identifier< elm::String > TITLE
Identifier of the title of a node.
Definition: Graph.h:36
Definition: Graph.h:60
Identifier< elm::CString > COLOR
Identifier of the drawing color (boxes, edges)
This class is the base of Graph, Node and Edge.
Definition: Graph.h:23
This a list of properties.
Definition: PropList.h:63
Identifier< int > SHAPE
Identifier of a shape of a node.
A graph provides facilities to display a graph.
Definition: Graph.h:76
Identifier< AbstractIdentifier * > INCLUDE
Tells that the properties with the given identifier have to be printed.
Definition: Graph.h:34
Identifier< elm::String > LABEL
Identifier of a label of an edge.
DisplayException(const string &msg)
Definition: Graph.h:71
DisplayException(void)
Definition: Graph.h:70
Definition: Graph.h:32
virtual Edge * newEdge(Node *source, Node *target, const PropList &style=PropList::EMPTY, const PropList &props=PropList::EMPTY)=0
This function creates a new edge between the two given nodes, in the graph.
Identifier< elm::CString > BACKGROUND
Identifier of the background color.
Definition: Graph.h:50