Otawa  0.10
otawa::display::GraphVizGraph Class Reference

#include </home/casse/otawa/otawa/src/odisplay/graphviz.h>

Inheritance diagram for otawa::display::GraphVizGraph:
otawa::display::Graph otawa::display::GraphVizItem otawa::display::Item otawa::PropList

Public Member Functions

 GraphVizGraph (const PropList &defaultGraphStyle=PropList::EMPTY, const PropList &defaultNodeStyle=PropList::EMPTY, const PropList &defaultEdgeStyle=PropList::EMPTY)
 Constructs a new GraphVizGraph. More...
 
virtual String attributes ()
 calls attributes(const PropList& style) with the PropList containing the style of the item. More...
 
virtual void setProps (const PropList &props)
 
virtual NodenewNode (const PropList &style=PropList::EMPTY, const PropList &props=PropList::EMPTY)
 This function creates a new node in the graph. More...
 
virtual EdgenewEdge (Node *source, Node *target, const PropList &style=PropList::EMPTY, const PropList &props=PropList::EMPTY)
 This function creates a new edge between the two given nodes, in the graph. More...
 
virtual void display (void) throw (DisplayException)
 This functions displays the graph. More...
 
PropertygetProp (const AbstractIdentifier *id) const
 Find a property by its identifier. More...
 
void setProp (Property *prop)
 Set the property in the property list removing any double. More...
 
void setProp (const AbstractIdentifier *id)
 
void removeProp (const AbstractIdentifier *id)
 Remove a property matching the given identifier. More...
 
void removeProp (const AbstractIdentifier &id)
 
PropertyextractProp (const AbstractIdentifier *id)
 Remove a property matching the given identifier and return it. More...
 
PropertyextractProp (const AbstractIdentifier &id)
 Remove a property matching the given identifier and return it. More...
 
void addProp (Property *prop)
 Add property to the list without checking of duplication. More...
 
void removeAllProp (const AbstractIdentifier *id)
 Remove all the properties matching the given identifier. More...
 
bool hasProp (const AbstractIdentifier &id) const
 Test if the property list contains a property matching the given identifier. More...
 
void clearProps (void)
 Remove all properties from the list. More...
 
void addProps (const PropList &props)
 Add all properties from the given property list, in a reverse order. More...
 
void print (elm::io::Output &out) const
 Display the current property list. More...
 

Static Public Attributes

static const PropList EMPTY
 This is an empty proplist for convenience. More...
 

Protected Member Functions

virtual void printOthersAttributes (elm::io::Output &out)
 Prints attributes after all the style PropList have been iterated. More...
 
virtual void printGraphData (elm::io::Output &out)
 Prints to the given output all the data DOT needs to create the graph information. More...
 
virtual String getPropertiesString ()
 Makes a string containing the values of all properties in _props separated by newlines. More...
 
virtual String attributes (const PropList &props)
 Prints all attributes (styles) in a string, between brackets. More...
 
virtual bool printAttribute (elm::io::Output &out, const PropList::Iter &prop)
 Process the Property given by the iterator pointing to it. More...
 

Protected Attributes

elm::genstruct::FragTable
< GraphVizNode * > 
_nodes
 list of nodes in the graph More...
 
elm::genstruct::FragTable
< GraphVizEdge * > 
_edges
 list of edges in the graph More...
 
PropList _default_node_style
 default style for the nodes More...
 
PropList _default_edge_style
 default style for the edges More...
 
int _node_count
 node count for giving a different number for each new node More...
 
PropList _props
 Properties of the attached object. More...
 
elm::genstruct::HashTable
< const AbstractIdentifier
*, int > 
_include
 List of properties to print. More...
 
elm::genstruct::HashTable
< const AbstractIdentifier
*, int > 
_exclude
 List of properties to hide. More...
 
bool _defaultInclude
 true if the default is to include all properties More...
 

Detailed Description

Author
G. Cavaignac

This class represents the graph that will be drawn by graphviz

Constructor & Destructor Documentation

otawa::display::GraphVizGraph::GraphVizGraph ( const PropList defaultGraphStyle = PropList::EMPTY,
const PropList defaultNodeStyle = PropList::EMPTY,
const PropList defaultEdgeStyle = PropList::EMPTY 
)

Constructs a new GraphVizGraph.

Parameters
defaultGraphStyledefault properties for the graph Can be changed with the methods inherited from PropList
defaultNodeStyledefault properties for the nodes Can be changed with the methods inherited from PropList
defaultEdgeStyledefault properties for the edges Can be changed with the methods inherited from PropList

References _default_edge_style, _default_node_style, and otawa::PropList::addProps().

Member Function Documentation

String otawa::display::GraphVizItem::attributes ( const PropList style)
protectedvirtualinherited

Prints all attributes (styles) in a string, between brackets.

First iterates on the style PropList, calling printAttribute() for each property, and then, calls printOthersAttributes() to finish. This functions escapes all the newlines that have been appened in the functions printAttribute() and printOthersAttributes()

Parameters
stylestyles to be printed
Returns
String containing the attributes. For example: [color="red"]

References buf, otawa::PropList::Iter::ended(), elm::StringBuffer::length(), otawa::display::GraphVizItem::printAttribute(), otawa::display::GraphVizItem::printOthersAttributes(), otawa::display::quoteNewlines(), and elm::StringBuffer::toString().

String otawa::display::GraphVizGraph::attributes ( void  )
virtual

calls attributes(const PropList& style) with the PropList containing the style of the item.

Generally, the proplist is the object itself, because it inherits from PropList

Implements otawa::display::GraphVizItem.

References otawa::display::GraphVizItem::attributes().

Referenced by printGraphData().

void otawa::PropList::clearProps ( void  )
inherited
Property * otawa::PropList::extractProp ( const AbstractIdentifier id)
inherited

Remove a property matching the given identifier and return it.

Caller is responsible of the management of the obtained property.

Parameters
idIdentifier of the property to extract.

References otawa::Property::_next, and otawa::Property::next().

Referenced by otawa::script::Script::makeConfig().

Property * otawa::PropList::extractProp ( const AbstractIdentifier id)
inlineinherited

Remove a property matching the given identifier and return it.

Caller is responsible of the management of the obtained property.

Parameters
idIdentifier of the property to extract.

References otawa::PropList::extractProp().

Referenced by otawa::PropList::extractProp().

String otawa::display::GraphVizItem::getPropertiesString ( )
protectedvirtualinherited
bool otawa::PropList::hasProp ( const AbstractIdentifier id) const
inlineinherited

Test if the property list contains a property matching the given identifier.

Parameters
idProperty identifier to look for.
Returns
True if the list contains the matching property, false else.

References otawa::PropList::getProp().

Referenced by otawa::ipet::BasicConstraintsBuilder::addEntryConstraint(), otawa::Monitor::configure(), otawa::ImmutableRef< T, I >::exists(), and otawa::Manager::setVerbosity().

Edge * otawa::display::GraphVizGraph::newEdge ( Node source,
Node target,
const PropList style = PropList::EMPTY,
const PropList props = PropList::EMPTY 
)
virtual

This function creates a new edge between the two given nodes, in the graph.

Parameters
sourceSource node of the edge.
targetTarget node of the edge.
styleStyle of the node.
propsProperties to display.

Implements otawa::display::Graph.

References _default_edge_style, _edges, otawa::PropList::addProps(), otawa::cfgio::edge(), otawa::display::GraphVizEdge::setProps(), otawa::cfgio::source(), and otawa::cfgio::target().

Node * otawa::display::GraphVizGraph::newNode ( const PropList style = PropList::EMPTY,
const PropList props = PropList::EMPTY 
)
virtual

This function creates a new node in the graph.

Parameters
styleStyle of the node.
propsProperties to display.

Implements otawa::display::Graph.

References _default_node_style, _node_count, _nodes, otawa::PropList::addProps(), and otawa::display::GraphVizNode::setProps().

void otawa::PropList::print ( elm::io::Output out) const
inherited

Display the current property list.

Parameters
outOutput to use.

Referenced by otawa::operator<<(), and otawa::ContextualProperty::print().

bool otawa::display::GraphVizItem::printAttribute ( elm::io::Output out,
const PropList::Iter prop 
)
protectedvirtualinherited

Process the Property given by the iterator pointing to it.

Prints the value to the given output, or store the property for example (the property can be printed furthermore by printOthersAttributes())

Parameters
outoutput where to print when something have to be printed iterator on properties. Used to compare the identifier and to get the property value
Returns
true if something have been written on the output, false else

Reimplemented in otawa::display::GraphVizEdge, otawa::display::GraphVizNode, and otawa::display::GraphVizGraphElement.

References otawa::display::GraphVizItem::_defaultInclude, otawa::display::GraphVizItem::_exclude, otawa::display::GraphVizItem::_include, otawa::display::BACKGROUND, otawa::display::COLOR, otawa::display::DEFAULT, otawa::display::EXCLUDE, otawa::display::HREF, otawa::display::INCLUDE, and otawa::display::quoteSpecials().

Referenced by otawa::display::GraphVizItem::attributes(), and otawa::display::GraphVizGraphElement::printAttribute().

void otawa::display::GraphVizGraph::printOthersAttributes ( elm::io::Output out)
protectedvirtual

Prints attributes after all the style PropList have been iterated.

One can append endlines to the output

Parameters
outoutput where to print others attributes

Reimplemented from otawa::display::GraphVizItem.

References otawa::display::BODY, and otawa::display::quoteSpecials().

void otawa::PropList::removeAllProp ( const AbstractIdentifier id)
inherited

Remove all the properties matching the given identifier.

Parameters
idIdentifier of properties to remove.

References otawa::Property::_next, and otawa::Property::next().

Referenced by otawa::LoopUnroller::unroll().

void otawa::PropList::removeProp ( const AbstractIdentifier id)
inherited
void otawa::PropList::removeProp ( const AbstractIdentifier id)
inlineinherited
void otawa::PropList::setProp ( Property prop)
inherited

Set the property in the property list removing any double.

Parameters
propProperty to set.

References otawa::Property::_next, otawa::Property::id(), and otawa::Property::next().

void otawa::PropList::setProp ( const AbstractIdentifier id)
inlineinherited
void otawa::display::GraphVizGraph::setProps ( const PropList props)
virtual

Member Data Documentation

PropList otawa::display::GraphVizGraph::_default_edge_style
protected

default style for the edges

Referenced by GraphVizGraph(), and newEdge().

PropList otawa::display::GraphVizGraph::_default_node_style
protected

default style for the nodes

Referenced by GraphVizGraph(), and newNode().

bool otawa::display::GraphVizItem::_defaultInclude
protectedinherited

true if the default is to include all properties

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

elm::genstruct::FragTable<GraphVizEdge*> otawa::display::GraphVizGraph::_edges
protected

list of edges in the graph

Referenced by newEdge(), and printGraphData().

elm::genstruct::HashTable<const AbstractIdentifier*, int> otawa::display::GraphVizItem::_exclude
protectedinherited

List of properties to hide.

If the key exists, exclude the property

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

elm::genstruct::HashTable<const AbstractIdentifier*, int> otawa::display::GraphVizItem::_include
protectedinherited

List of properties to print.

If the key exists, include the property

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

int otawa::display::GraphVizGraph::_node_count
protected

node count for giving a different number for each new node

Referenced by newNode().

elm::genstruct::FragTable<GraphVizNode*> otawa::display::GraphVizGraph::_nodes
protected

list of nodes in the graph

Referenced by newNode(), and printGraphData().

PropList otawa::display::GraphVizItem::_props
protectedinherited
const PropList otawa::PropList::EMPTY
staticinherited

This is an empty proplist for convenience.


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