marci@330
|
1 |
// -*- c++ -*-
|
marci@330
|
2 |
#ifndef FOR_EACH_MACROS_H
|
marci@330
|
3 |
#define FOR_EACH_MACROS_H
|
marci@330
|
4 |
|
marci@330
|
5 |
namespace hugo {
|
marci@330
|
6 |
|
marci@330
|
7 |
#define FOR_EACH(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
|
marci@330
|
8 |
#define FOR_EACH_INC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
|
marci@330
|
9 |
|
marci@330
|
10 |
#define FOR_EACH_EDGE(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
|
marci@330
|
11 |
#define FOR_EACH_NODE(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
|
marci@330
|
12 |
#define FOR_EACH_INEDGE(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
|
marci@330
|
13 |
#define FOR_EACH_OUTEDGE(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
|
marci@330
|
14 |
|
marci@330
|
15 |
// template<typename It, typename Graph>
|
marci@330
|
16 |
// It loopFirst(const Graph& g) const {
|
marci@330
|
17 |
// It e; g.first(e); return e;
|
marci@330
|
18 |
// }
|
marci@330
|
19 |
|
marci@330
|
20 |
// template<typename It, typename Graph>
|
marci@330
|
21 |
// It loopFirst(const Graph& g, const Node& v) const {
|
marci@330
|
22 |
// It e; g.first(e, v); return e;
|
marci@330
|
23 |
// }
|
marci@330
|
24 |
|
marci@330
|
25 |
// template<typename Graph>
|
marci@330
|
26 |
// typename Graph::NodeIt loopFirstNode(const Graph& g) const {
|
marci@330
|
27 |
// typename Graph::NodeIt e; g.first(e); return e;
|
marci@330
|
28 |
// }
|
marci@330
|
29 |
// template<typename Graph>
|
marci@330
|
30 |
// typename Graph::EdgeIt loopFirstEdge(const Graph& g) const {
|
marci@330
|
31 |
// typename Graph::EdgeIt e; g.first(e); return e;
|
marci@330
|
32 |
// }
|
marci@330
|
33 |
// template<typename Graph>
|
marci@330
|
34 |
// typename Graph::OutEdgeIt
|
marci@330
|
35 |
// loopFirstOutEdge(const Graph& g, const Node& n) const {
|
marci@330
|
36 |
// typename Graph::OutEdgeIt e; g.first(e, n); return e;
|
marci@330
|
37 |
// }
|
marci@330
|
38 |
// template<typename Graph>
|
marci@330
|
39 |
// typename Graph::InEdgeIt
|
marci@330
|
40 |
// loopFirstIn Edge(const Graph& g, const Node& n) const {
|
marci@330
|
41 |
// typename Graph::InEdgeIt e; g.first(e, n); return e;
|
marci@330
|
42 |
// }
|
marci@330
|
43 |
|
marci@330
|
44 |
//FIXME ezt hogy a gorcsbe birja levezetni. Csak ugy leveszi a const-ot??
|
marci@330
|
45 |
template<typename It, typename Graph>
|
marci@333
|
46 |
It loopFirst(const It&, const Graph& g) {
|
marci@333
|
47 |
It e; g.first(e); return e;
|
marci@330
|
48 |
}
|
marci@330
|
49 |
|
marci@330
|
50 |
template<typename It, typename Graph, typename Node>
|
marci@333
|
51 |
It loopFirst(const It&, const Graph& g, const Node& v) {
|
marci@333
|
52 |
It e; g.first(e, v); return e;
|
marci@330
|
53 |
}
|
marci@330
|
54 |
|
marci@330
|
55 |
// template<typename Graph>
|
marci@330
|
56 |
// typename Graph::NodeIt loopFirstNode(const Graph& g) const {
|
marci@330
|
57 |
// typename Graph::NodeIt e; g.first(e); return e;
|
marci@330
|
58 |
// }
|
marci@330
|
59 |
// template<typename Graph>
|
marci@330
|
60 |
// typename Graph::EdgeIt loopFirstEdge(const Graph& g) const {
|
marci@330
|
61 |
// typename Graph::EdgeIt e; g.first(e); return e;
|
marci@330
|
62 |
// }
|
marci@330
|
63 |
// template<typename Graph>
|
marci@330
|
64 |
// typename Graph::OutEdgeIt
|
marci@330
|
65 |
// loopFirstOutEdge(const Graph& g, const Node& n) const {
|
marci@330
|
66 |
// typename Graph::OutEdgeIt e; g.first(e, n); return e;
|
marci@330
|
67 |
// }
|
marci@330
|
68 |
// template<typename Graph>
|
marci@330
|
69 |
// typename Graph::InEdgeIt
|
marci@330
|
70 |
// loopFirstIn Edge(const Graph& g, const Node& n) const {
|
marci@330
|
71 |
// typename Graph::InEdgeIt e; g.first(e, n); return e;
|
marci@330
|
72 |
// }
|
marci@330
|
73 |
|
marci@333
|
74 |
#define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
|
marci@333
|
75 |
#define FOR_EACH_INC_LOC(Ittype, e, g, v) for(Ittype e=loopFirst(Ittype(), (g), (v)); (g).valid(e); (g).next(e))
|
marci@330
|
76 |
|
marci@333
|
77 |
// #define FOR_EACH_EDGE_LOC(e, g) ezt nem tom hogy kell for((g).first((e)); (g).valid((e)); (g).next((e)))
|
marci@330
|
78 |
// #define FOR_EACH_NODE_LOC(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
|
marci@330
|
79 |
// #define FOR_EACH_INEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
|
marci@330
|
80 |
// #define FOR_EACH_OUTEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
|
marci@330
|
81 |
|
marci@330
|
82 |
|
marci@330
|
83 |
} //namespace hugo
|
marci@330
|
84 |
|
marci@330
|
85 |
#endif //FOR_EACH_MACROS_H
|