22 #ifndef OTAWA_GRAPH_GEN_GRAPH_H
23 #define OTAWA_GRAPH_GEN_GRAPH_H
24 #include <elm/PreIterator.h>
28 #if defined(__GNUC__) && __GNUC__ <= 4 && __GNUC_MINOR__ <= 0
29 # define OTAWA_GCAST(t, e) ((t)(e))
31 # define OTAWA_GCAST(t, e) static_cast<t>(e)
37 template <
class N,
class E>
72 inline int count(
void)
const {
return Graph::count(); }
73 inline bool contains(N *item)
const {
return Graph::contains(item); }
74 inline bool isEmpty(
void)
const {
return Graph::isEmpty(); }
75 inline operator bool(
void)
const {
return !
isEmpty(); }
91 template <
template <
class _>
class C>
void addAll(
const C<N *> &items)
94 template <
template <
class _>
class C>
void removeAll(
const C<N *> &items)
99 inline N *
sinkOf(E *
edge)
const {
return Graph::sinkOf(edge); }
100 inline int outDegree(N *vertex)
const {
return Graph::outDegree(vertex); }
101 inline bool isSuccessorOf(N *succ, N *ref)
const {
return Graph::isSuccessorOf(succ, ref); }
117 inline int inDegree(N *vertex)
const {
return Graph::inDegree(vertex); }
118 inline bool isPredecessorOf(N *succ, N *ref)
const {
return Graph::isPredecessorOf(succ, ref); }
133 inline int indexOf(N *vertex)
const {
return Graph::indexOf(vertex); }
136 inline static const graph::Node *
_(
const GenNode *node) {
return node; };
146 #endif // OTAWA_UTIL_GRAPH_GRAPH_H
Graph::InIterator iter
Definition: GenGraph.h:129
A simple iterator on the nodes contained in a graph.
Definition: Graph.h:138
Definition: GenGraph.h:38
N * source(void) const
Definition: GenGraph.h:67
Definition: GenGraph.h:78
static graph::Edge * _(Edge *edge)
Definition: GenGraph.h:140
OutIterator(const GenGraph< N, E > &graph, const N *node)
Definition: GenGraph.h:107
GenEdge(GenNode *source, GenNode *target)
Definition: GenGraph.h:66
dtd::Element edge(dtd::make("edge", _EDGE).attr(source).attr(target).attr(called))
bool hasSucc(void) const
Definition: GenGraph.h:52
bool isSuccOf(const Node *node)
Test if the current node is a successor of the given one.
Definition: Graph.h:214
Definition: GenGraph.h:44
static const graph::Edge * _(const GenEdge *edge)
Definition: GenGraph.h:137
const graph::Graph * _(void) const
Definition: GenGraph.h:138
E * item(void) const
Definition: GenGraph.h:127
#define OTAWA_GCAST(t, e)
Definition: GenGraph.h:31
int countSucc(void) const
Definition: GenGraph.h:54
bool ended(void) const
Definition: GenGraph.h:125
E * Edge
Definition: GenGraph.h:41
int index(void) const
Get the index of the node in the graph.
Definition: Graph.h:76
bool contains(N *item) const
Definition: GenGraph.h:73
void removeAll(const C< Node * > &items)
Definition: Graph.h:152
bool isSuccOf(const GenNode *node)
Definition: GenGraph.h:57
int inDegree(N *vertex) const
Definition: GenGraph.h:117
OutIterator(const N *node)
Definition: GenGraph.h:106
int indexOf(N *vertex) const
Definition: GenGraph.h:133
This class represents a full graph with nodes and edges.
Definition: Graph.h:122
This class represents a directed edge between two nodes.
Definition: Graph.h:97
int count(void) const
Definition: GenGraph.h:72
void next(void)
Definition: GenGraph.h:85
static graph::Node * _(GenNode *node)
Definition: GenGraph.h:139
GenNode(graph::Graph *graph=0)
Definition: GenGraph.h:47
N * item(void) const
Definition: GenGraph.h:84
void addAll(const C< N * > &items)
Definition: GenGraph.h:91
graph::Graph * _(void)
Definition: GenGraph.h:141
Graph * graph(void) const
Get the container graph if any.
Definition: Graph.h:75
graph::Graph::Iterator iter
Definition: GenGraph.h:79
void addAll(const C< Node * > &items)
Definition: Graph.h:149
void remove(graph::Edge *edge)
Destroy an edge.
Definition: util_Graph.cpp:120
int countPred(void) const
Definition: GenGraph.h:55
bool isPredecessorOf(N *succ, N *ref) const
Definition: GenGraph.h:118
InIterator(const GenGraph< N, E > &graph, const N *node)
Definition: GenGraph.h:124
int outDegree(N *vertex) const
Definition: GenGraph.h:100
Node * source(void) const
Get the source node.
Definition: Graph.h:116
E * item(void) const
Definition: GenGraph.h:110
void add(GenNode *node)
Definition: GenGraph.h:90
void clear(void)
Definition: util_Graph.cpp:66
N * sourceOf(E *edge) const
Definition: GenGraph.h:116
bool isSuccessorOf(N *succ, N *ref) const
Definition: GenGraph.h:101
Iterator(const GenGraph< N, E > *graph)
Definition: GenGraph.h:81
void next(void)
Definition: GenGraph.h:109
int countSucc(void) const
Count the successors of the current node.
Definition: Graph.h:79
Node * target(void) const
Get the target node.
Definition: Graph.h:117
Iterator(const GenGraph< N, E >::Iterator &iterator)
Definition: GenGraph.h:82
static const graph::Node * _(const GenNode *node)
Definition: GenGraph.h:136
void clear(void)
Definition: GenGraph.h:89
bool isEmpty(void) const
Definition: GenGraph.h:74
virtual ~GenEdge(void)
Definition: GenGraph.h:64
InIterator(const N *node)
Definition: GenGraph.h:123
bool hasPred(void) const
Test if the node has predecessors.
Definition: Graph.h:78
int index(void) const
Definition: GenGraph.h:51
Definition: GenGraph.h:104
The node from a directed graph.
Definition: Graph.h:40
N * target(void) const
Definition: GenGraph.h:68
Definition: GenGraph.h:121
Graph::OutIterator iter
Definition: GenGraph.h:112
const T & item(void) const
void removeAll(const C< N * > &items)
Definition: GenGraph.h:94
N * sinkOf(E *edge) const
Definition: GenGraph.h:99
bool ended(void) const
Definition: GenGraph.h:83
void add(Node *node)
Add new node.
Definition: util_Graph.cpp:90
bool ended(void) const
Definition: GenGraph.h:108
Node(Graph *graph=0)
Build a new node.
Definition: Graph.h:201
bool hasPred(void) const
Definition: GenGraph.h:53
bool hasSucc(void) const
Test if the node has successors.
Definition: Graph.h:77
Definition: GenGraph.h:61
virtual ~GenNode(void)
Definition: GenGraph.h:48
N * Vertex
Definition: GenGraph.h:40
int countPred(void) const
Count the predecessors of the current node.
Definition: Graph.h:85
bool isPredOf(const GenNode *node)
Definition: GenGraph.h:56
void next(void)
Definition: GenGraph.h:126