The new for macros are: h_for, h_for_inc, h_for_glob, h_for_inc_glob.
authormarci
Fri, 21 May 2004 10:18:30 +0000
changeset 6548fd893331298
parent 653 c3ad7c661a49
child 655 a9878222d5c8
The new for macros are: h_for, h_for_inc, h_for_glob, h_for_inc_glob.
src/hugo/for_each_macros.h
src/work/marci/makefile
     1.1 --- a/src/hugo/for_each_macros.h	Fri May 21 08:15:45 2004 +0000
     1.2 +++ b/src/hugo/for_each_macros.h	Fri May 21 10:18:30 2004 +0000
     1.3 @@ -19,15 +19,18 @@
     1.4    /// Graph g;
     1.5    /// ...
     1.6    /// Graph::NodeIt n;
     1.7 -  /// FOR_EACH_GLOB(n, g) {
     1.8 +  /// h_for_glob(n, g) {
     1.9    /// ...
    1.10    /// }
    1.11    /// Graph::EdgeIt e;
    1.12 -  /// FOR_EACH_GLOB(e, g) {
    1.13 +  /// h_for_glob(e, g) {
    1.14    /// ...
    1.15    /// }
    1.16    /// \endcode
    1.17    /// Note that the iterated variables \c n and \c e are global ones. 
    1.18 +#define h_for_glob(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    1.19 +
    1.20 +/// \deprecated
    1.21  #define FOR_EACH_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    1.22  
    1.23    /// This macro provides a comfortable interface for iterating with HUGO 
    1.24 @@ -37,18 +40,21 @@
    1.25    /// ...
    1.26    /// Graph::Node v;
    1.27    /// Graph::OutEdgeIt e;
    1.28 -  /// FOR_EACH_INC_GLOB(e, g, v) {
    1.29 +  /// h_for_inc_glob(e, g, v) {
    1.30    /// ...
    1.31    /// }
    1.32    /// typedef BipartiteGraph<Graph> BGraph;
    1.33    /// BGraph h;
    1.34    /// ...
    1.35    /// BGraph::ClassNodeIt n;
    1.36 -  /// FOR_EACH_INC_GLOB(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
    1.37 +  /// h_for_inc_glob(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
    1.38    /// ...
    1.39    /// }
    1.40    /// \endcode
    1.41    /// Note that iterated variables \c e and \c n are global ones. 
    1.42 +#define h_for_inc_glob(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
    1.43 +
    1.44 +/// \deprecated
    1.45  #define FOR_EACH_INC_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
    1.46    
    1.47  /// \deprecated
    1.48 @@ -124,33 +130,39 @@
    1.49    /// \code
    1.50    /// Graph g;
    1.51    /// ...
    1.52 -  /// FOR_EACH_LOC(Graph::NodeIt, n, g) {
    1.53 +  /// h_for(Graph::NodeIt, n, g) {
    1.54    /// ...
    1.55    /// }
    1.56 -  /// FOR_EACH_LOC(Graph::EdgeIt, e, g) {
    1.57 +  /// h_for(Graph::EdgeIt, e, g) {
    1.58    /// ...
    1.59    /// }
    1.60    /// \endcode
    1.61    /// Note that the iterated variables \c n and \c e are local ones. 
    1.62 +#define h_for(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
    1.63 +  
    1.64 +/// \deprecated
    1.65  #define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
    1.66 -  
    1.67 +
    1.68    /// This macro provides a comfortable interface for iterating with HUGO 
    1.69    /// iterators.
    1.70    /// \code
    1.71    /// Graph g;
    1.72    /// ...
    1.73    /// Graph::Node v;
    1.74 -  /// FOR_EACH_INC_LOC(Graph::OutEdgeIt, e, g, v) {
    1.75 +  /// h_for_inc(Graph::OutEdgeIt, e, g, v) {
    1.76    /// ...
    1.77    /// }
    1.78    /// typedef BipartiteGraph<Graph> BGraph;
    1.79    /// BGraph h;
    1.80    /// ...
    1.81 -  /// FOR_EACH_INC_LOC(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
    1.82 +  /// h_for_inc(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
    1.83    /// ...
    1.84    /// }
    1.85    /// \endcode
    1.86    /// Note that the iterated variables \c e and \c n are local ones. 
    1.87 +#define h_for_inc(Ittype, e, g, v) for(Ittype e=loopFirst(Ittype(), (g), (v)); (g).valid(e); (g).next(e))
    1.88 +  
    1.89 +/// \deprecated
    1.90  #define FOR_EACH_INC_LOC(Ittype, e, g, v) for(Ittype e=loopFirst(Ittype(), (g), (v)); (g).valid(e); (g).next(e))
    1.91    
    1.92  // #define FOR_EACH_EDGE_LOC(e, g) ezt nem tom hogy kell for((g).first((e)); (g).valid((e)); (g).next((e)))
    1.93 @@ -158,7 +170,6 @@
    1.94  // #define FOR_EACH_INEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
    1.95  // #define FOR_EACH_OUTEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
    1.96  
    1.97 -
    1.98  } //namespace hugo
    1.99  
   1.100  #endif //HUGO_FOR_EACH_MACROS_H
     2.1 --- a/src/work/marci/makefile	Fri May 21 08:15:45 2004 +0000
     2.2 +++ b/src/work/marci/makefile	Fri May 21 10:18:30 2004 +0000
     2.3 @@ -4,7 +4,7 @@
     2.4  INCLUDEDIRS ?= -I../.. -I.. -I../{marci,jacint,alpar,klao,akos,athos} -I$(BOOSTROOT)
     2.5  
     2.6  LEDABINARIES = leda_graph_demo leda_bfs_dfs max_bipartite_matching_demo
     2.7 -BINARIES = proba6 max_flow_demo iterator_bfs_demo macro_test lg_vs_sg_vs_sg bfsit_vs_byhand bipartite_graph_wrapper_test bipartite_matching_try bipartite_matching_try_3 top_sort_test max_flow_1
     2.8 +BINARIES = max_flow_demo iterator_bfs_demo macro_test lg_vs_sg_vs_sg bfsit_vs_byhand bipartite_graph_wrapper_test bipartite_matching_try bipartite_matching_try_3 top_sort_test max_flow_1
     2.9  #gw_vs_not preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar preflow_demo_leda
    2.10  
    2.11  include ../makefile