src/work/marci/for_each_macros.h
changeset 1330 52ef02524468
parent 725 9fa4045571cd
equal deleted inserted replaced
4:b24f6eb44aba 5:8af25367a3e0
     1 // -*- c++ -*-
     1 // -*- c++ -*-
     2 #ifndef HUGO_FOR_EACH_MACROS_H
     2 #ifndef LEMON_FOR_EACH_MACROS_H
     3 #define HUGO_FOR_EACH_MACROS_H
     3 #define LEMON_FOR_EACH_MACROS_H
     4 
     4 
     5 // /// \ingroup gwrappers
     5 // /// \ingroup gwrappers
     6 /// \file
     6 /// \file
     7 /// \brief Iteration macros.
     7 /// \brief Iteration macros.
     8 ///
     8 ///
     9 /// This file contains several macros which make easier writting 
     9 /// This file contains several macros which make easier writting 
    10 /// for cycles in HUGO using HUGO iterators.
    10 /// for cycles in LEMON using LEMON iterators.
    11 ///
    11 ///
    12 /// \author Marton Makai
    12 /// \author Marton Makai
    13 
    13 
    14 namespace hugo {
    14 namespace lemon {
    15 
    15 
    16   /// This macro provides a comfortable interface for iterating with HUGO 
    16   /// This macro provides a comfortable interface for iterating with LEMON 
    17   /// iterators.
    17   /// iterators.
    18   /// \code
    18   /// \code
    19   /// Graph g;
    19   /// Graph g;
    20   /// ...
    20   /// ...
    21   /// Graph::NodeIt n;
    21   /// Graph::NodeIt n;
    31 #define h_for_glob(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    31 #define h_for_glob(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    32 
    32 
    33 /// \deprecated
    33 /// \deprecated
    34 #define FOR_EACH_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    34 #define FOR_EACH_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    35 
    35 
    36   /// This macro provides a comfortable interface for iterating with HUGO 
    36   /// This macro provides a comfortable interface for iterating with LEMON 
    37   /// iterators.
    37   /// iterators.
    38   /// \code
    38   /// \code
    39   /// Graph g;
    39   /// Graph g;
    40   /// ...
    40   /// ...
    41   /// Graph::Node v;
    41   /// Graph::Node v;
   123 //   typename Graph::InEdgeIt 
   123 //   typename Graph::InEdgeIt 
   124 //   loopFirstIn Edge(const Graph& g, const Node& n) const {
   124 //   loopFirstIn Edge(const Graph& g, const Node& n) const {
   125 //     typename Graph::InEdgeIt e; g.first(e, n); return e; 
   125 //     typename Graph::InEdgeIt e; g.first(e, n); return e; 
   126 //   }
   126 //   }
   127 
   127 
   128   /// This macro provides a comfortable interface for iterating with HUGO 
   128   /// This macro provides a comfortable interface for iterating with LEMON 
   129   /// iterators.
   129   /// iterators.
   130   /// \code
   130   /// \code
   131   /// Graph g;
   131   /// Graph g;
   132   /// ...
   132   /// ...
   133   /// h_for(Graph::NodeIt, n, g) {
   133   /// h_for(Graph::NodeIt, n, g) {
   141 #define h_for(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
   141 #define h_for(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
   142   
   142   
   143 /// \deprecated
   143 /// \deprecated
   144 #define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
   144 #define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
   145 
   145 
   146   /// This macro provides a comfortable interface for iterating with HUGO 
   146   /// This macro provides a comfortable interface for iterating with LEMON 
   147   /// iterators.
   147   /// iterators.
   148   /// \code
   148   /// \code
   149   /// Graph g;
   149   /// Graph g;
   150   /// ...
   150   /// ...
   151   /// Graph::Node v;
   151   /// Graph::Node v;
   168 // #define FOR_EACH_EDGE_LOC(e, g) ezt nem tom hogy kell for((g).first((e)); (g).valid((e)); (g).next((e)))
   168 // #define FOR_EACH_EDGE_LOC(e, g) ezt nem tom hogy kell for((g).first((e)); (g).valid((e)); (g).next((e)))
   169 // #define FOR_EACH_NODE_LOC(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
   169 // #define FOR_EACH_NODE_LOC(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
   170 // #define FOR_EACH_INEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
   170 // #define FOR_EACH_INEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
   171 // #define FOR_EACH_OUTEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
   171 // #define FOR_EACH_OUTEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
   172 
   172 
   173 } //namespace hugo
   173 } //namespace lemon
   174 
   174 
   175 #endif //HUGO_FOR_EACH_MACROS_H
   175 #endif //LEMON_FOR_EACH_MACROS_H