Changeset 638:2153dd45937a in lemon0.x for src/hugo/for_each_macros.h
 Timestamp:
 05/14/04 17:01:21 (20 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@836
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/hugo/for_each_macros.h
r637 r638 5 5 // /// \ingroup gwrappers 6 6 /// \file 7 /// \brief Iterat on macros.7 /// \brief Iteration macros. 8 8 /// 9 9 /// This file contains several macros which make easier writting 10 /// for cycles in HUGO ,using HUGO iterators.10 /// for cycles in HUGO using HUGO iterators. 11 11 /// 12 12 /// \author Marton Makai … … 14 14 namespace hugo { 15 15 16 /// The iteration with HUGO iterators i.e. for cycles can be17 /// written very comfortable with this macro.18 /// \code19 /// Graph g;20 /// Graph::NodeIt n;21 /// FOR_EACH_GLOB(n, g) {22 /// ...23 /// }24 /// Graph::EdgeIt e;25 /// FOR_EACH_GLOB(e, g) {26 /// ...27 /// }28 /// In the above cycle, the iterator variable \c n and \c e are global ones. 29 /// \endcode 16 /// This macro provides a comfortable interface for iterating with HUGO 17 /// iterators. 18 /// \code 19 /// Graph g; 20 /// Graph::NodeIt n; 21 /// FOR_EACH_GLOB(n, g) { 22 /// ... 23 /// } 24 /// Graph::EdgeIt e; 25 /// FOR_EACH_GLOB(e, g) { 26 /// ... 27 /// } 28 /// \endcode 29 /// Note that the iterated variables \c n and \c e are global ones. 30 30 #define FOR_EACH_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e))) 31 31 32 /// The iteration with HUGO iterators i.e. for cycles can be33 /// written very comfortable with this macro.34 /// \code35 /// Graph g;36 /// Graph::Node v;37 /// Graph::OutEdgeIt e;38 /// FOR_EACH_INC_GLOB(e, g, v) {39 /// ...40 /// }41 /// typedef BipartiteGraph<Graph> BGraph;42 /// BGraph h;43 /// BGraph::ClassNodeIt n;44 /// FOR_EACH_INC_GLOB(BGraph::ClassNodeIt, n, h, h.S_CLASS) {45 /// ...46 /// }47 /// In the above cycle, the iterator variable \c e and \c n are global ones. 48 /// \endcode 32 /// This macro provides a comfortable interface for iterating with HUGO 33 /// iterators. 34 /// \code 35 /// Graph g; 36 /// Graph::Node v; 37 /// Graph::OutEdgeIt e; 38 /// FOR_EACH_INC_GLOB(e, g, v) { 39 /// ... 40 /// } 41 /// typedef BipartiteGraph<Graph> BGraph; 42 /// BGraph h; 43 /// BGraph::ClassNodeIt n; 44 /// FOR_EACH_INC_GLOB(BGraph::ClassNodeIt, n, h, h.S_CLASS) { 45 /// ... 46 /// } 47 /// \endcode 48 /// Note that iterated variables \c e and \c n are global ones. 49 49 #define FOR_EACH_INC_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e))) 50 50 51 51 /// \deprecated 52 #define FOR_EACH_EDGE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))52 //#define FOR_EACH_EDGE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e))) 53 53 /// \deprecated 54 #define FOR_EACH_NODE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))54 //#define FOR_EACH_NODE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e))) 55 55 /// \deprecated 56 #define FOR_EACH_INEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))56 //#define FOR_EACH_INEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e))) 57 57 /// \deprecated 58 #define FOR_EACH_OUTEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))58 //#define FOR_EACH_OUTEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e))) 59 59 60 60 // template<typename It, typename Graph> … … 117 117 // } 118 118 119 /// The iteration with HUGO iterators i.e. for cycles can be120 /// written very comfortable with this macro.121 /// \code122 /// Graph g;123 /// FOR_EACH_LOC(Graph::NodeIt, n, g) {124 /// ...125 /// }126 /// FOR_EACH_LOC(Graph::EdgeIt, e, g) {127 /// ...128 /// }129 /// In the above cycle, the iterator variable \c n and \c e are local ones. 130 /// \endcode 119 /// This macro provides a comfortable interface for iterating with HUGO 120 /// iterators. 121 /// \code 122 /// Graph g; 123 /// FOR_EACH_LOC(Graph::NodeIt, n, g) { 124 /// ... 125 /// } 126 /// FOR_EACH_LOC(Graph::EdgeIt, e, g) { 127 /// ... 128 /// } 129 /// \endcode 130 /// Note that the iterated variables \c n and \c e are local ones. 131 131 #define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e)) 132 133 /// The iteration with HUGO iterators i.e. for cycles can be134 /// written very comfortable with this macro.135 /// \code136 /// Graph g;137 /// Graph::Node v;138 /// FOR_EACH_INC_LOC(Graph::OutEdgeIt, e, g, v) {139 /// ...140 /// }141 /// typedef BipartiteGraph<Graph> BGraph;142 /// BGraph h;143 /// FOR_EACH_INC_LOC(BGraph::ClassNodeIt, n, h, h.S_CLASS) {144 /// ...145 /// }146 /// In the above cycle, the iterator variable \c e and \c n are local ones. 147 /// \endcode 132 133 /// This macro provides a comfortable interface for iterating with HUGO 134 /// iterators. 135 /// \code 136 /// Graph g; 137 /// Graph::Node v; 138 /// FOR_EACH_INC_LOC(Graph::OutEdgeIt, e, g, v) { 139 /// ... 140 /// } 141 /// typedef BipartiteGraph<Graph> BGraph; 142 /// BGraph h; 143 /// FOR_EACH_INC_LOC(BGraph::ClassNodeIt, n, h, h.S_CLASS) { 144 /// ... 145 /// } 146 /// \endcode 147 /// Note that the iterated variables \c e and \c n are local ones. 148 148 #define FOR_EACH_INC_LOC(Ittype, e, g, v) for(Ittype e=loopFirst(Ittype(), (g), (v)); (g).valid(e); (g).next(e)) 149 149 150 150 // #define FOR_EACH_EDGE_LOC(e, g) ezt nem tom hogy kell for((g).first((e)); (g).valid((e)); (g).next((e))) 151 151 // #define FOR_EACH_NODE_LOC(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
Note: See TracChangeset
for help on using the changeset viewer.