1.1 --- a/src/work/marci/for_each_macros.h Thu May 13 17:42:23 2004 +0000
1.2 +++ b/src/work/marci/for_each_macros.h Fri May 14 14:41:30 2004 +0000
1.3 @@ -2,14 +2,59 @@
1.4 #ifndef FOR_EACH_MACROS_H
1.5 #define FOR_EACH_MACROS_H
1.6
1.7 +// /// \ingroup gwrappers
1.8 +/// \file
1.9 +/// \brief Iteraton macros.
1.10 +///
1.11 +/// This file contains several macros which make easier writting
1.12 +/// for cycles in HUGO, using HUGO iterators.
1.13 +///
1.14 +/// \author Marton Makai
1.15 +
1.16 namespace hugo {
1.17
1.18 +/// The iteration with HUGO iterators i.e. for cycles can be
1.19 +/// written very comfortable with this macro.
1.20 +/// \code
1.21 +/// Graph g;
1.22 +/// Graph::NodeIt n;
1.23 +/// FOR_EACH_GLOB(n, g) {
1.24 +/// ...
1.25 +/// }
1.26 +/// Graph::EdgeIt e;
1.27 +/// FOR_EACH_GLOB(e, g) {
1.28 +/// ...
1.29 +/// }
1.30 +/// In the above cycle, the iterator variable \c n and \c e are global ones.
1.31 +/// \endcode
1.32 #define FOR_EACH_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
1.33 +
1.34 +/// The iteration with HUGO iterators i.e. for cycles can be
1.35 +/// written very comfortable with this macro.
1.36 +/// \code
1.37 +/// Graph g;
1.38 +/// Graph::Node v;
1.39 +/// Graph::OutEdgeIt e;
1.40 +/// FOR_EACH_INC_GLOB(e, g, v) {
1.41 +/// ...
1.42 +/// }
1.43 +/// typedef BipartiteGraph<Graph> BGraph;
1.44 +/// BGraph h;
1.45 +/// BGraph::ClassNodeIt n;
1.46 +/// FOR_EACH_INC_GLOB(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
1.47 +/// ...
1.48 +/// }
1.49 +/// In the above cycle, the iterator variable \c e and \c n are global ones.
1.50 +/// \endcode
1.51 #define FOR_EACH_INC_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
1.52
1.53 +/// \deprecated
1.54 #define FOR_EACH_EDGE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
1.55 +/// \deprecated
1.56 #define FOR_EACH_NODE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
1.57 +/// \deprecated
1.58 #define FOR_EACH_INEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
1.59 +/// \deprecated
1.60 #define FOR_EACH_OUTEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
1.61
1.62 // template<typename It, typename Graph>
1.63 @@ -71,7 +116,35 @@
1.64 // typename Graph::InEdgeIt e; g.first(e, n); return e;
1.65 // }
1.66
1.67 +/// The iteration with HUGO iterators i.e. for cycles can be
1.68 +/// written very comfortable with this macro.
1.69 +/// \code
1.70 +/// Graph g;
1.71 +/// FOR_EACH_LOC(Graph::NodeIt, n, g) {
1.72 +/// ...
1.73 +/// }
1.74 +/// FOR_EACH_LOC(Graph::EdgeIt, e, g) {
1.75 +/// ...
1.76 +/// }
1.77 +/// In the above cycle, the iterator variable \c n and \c e are local ones.
1.78 +/// \endcode
1.79 #define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
1.80 +
1.81 +/// The iteration with HUGO iterators i.e. for cycles can be
1.82 +/// written very comfortable with this macro.
1.83 +/// \code
1.84 +/// Graph g;
1.85 +/// Graph::Node v;
1.86 +/// FOR_EACH_INC_LOC(Graph::OutEdgeIt, e, g, v) {
1.87 +/// ...
1.88 +/// }
1.89 +/// typedef BipartiteGraph<Graph> BGraph;
1.90 +/// BGraph h;
1.91 +/// FOR_EACH_INC_LOC(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
1.92 +/// ...
1.93 +/// }
1.94 +/// In the above cycle, the iterator variable \c e and \c n are local ones.
1.95 +/// \endcode
1.96 #define FOR_EACH_INC_LOC(Ittype, e, g, v) for(Ittype e=loopFirst(Ittype(), (g), (v)); (g).valid(e); (g).next(e))
1.97
1.98 // #define FOR_EACH_EDGE_LOC(e, g) ezt nem tom hogy kell for((g).first((e)); (g).valid((e)); (g).next((e)))