Changeset 636:e59b0c363a9e in lemon0.x for src/work/marci
 Timestamp:
 05/14/04 16:41:30 (20 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@834
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/marci/for_each_macros.h
r409 r636 3 3 #define FOR_EACH_MACROS_H 4 4 5 // /// \ingroup gwrappers 6 /// \file 7 /// \brief Iteraton macros. 8 /// 9 /// This file contains several macros which make easier writting 10 /// for cycles in HUGO, using HUGO iterators. 11 /// 12 /// \author Marton Makai 13 5 14 namespace hugo { 6 15 16 /// The iteration with HUGO iterators i.e. for cycles can be 17 /// written very comfortable with this macro. 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 /// In the above cycle, the iterator variable \c n and \c e are global ones. 29 /// \endcode 7 30 #define FOR_EACH_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e))) 31 32 /// The iteration with HUGO iterators i.e. for cycles can be 33 /// written very comfortable with this macro. 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 /// In the above cycle, the iterator variable \c e and \c n are global ones. 48 /// \endcode 8 49 #define FOR_EACH_INC_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e))) 9 50 51 /// \deprecated 10 52 #define FOR_EACH_EDGE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e))) 53 /// \deprecated 11 54 #define FOR_EACH_NODE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e))) 55 /// \deprecated 12 56 #define FOR_EACH_INEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e))) 57 /// \deprecated 13 58 #define FOR_EACH_OUTEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e))) 14 59 … … 72 117 // } 73 118 119 /// The iteration with HUGO iterators i.e. for cycles can be 120 /// written very comfortable with this macro. 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 /// In the above cycle, the iterator variable \c n and \c e are local ones. 130 /// \endcode 74 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 be 134 /// written very comfortable with this macro. 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 /// In the above cycle, the iterator variable \c e and \c n are local ones. 147 /// \endcode 75 148 #define FOR_EACH_INC_LOC(Ittype, e, g, v) for(Ittype e=loopFirst(Ittype(), (g), (v)); (g).valid(e); (g).next(e)) 76 149
Note: See TracChangeset
for help on using the changeset viewer.