src/hugo/for_each_macros.h
changeset 722 be8712e1fe07
parent 644 d84f3d42237d
equal deleted inserted replaced
3:afa4e351bfa7 4:6c3d3b561d9f
    17   /// iterators.
    17   /// iterators.
    18   /// \code
    18   /// \code
    19   /// Graph g;
    19   /// Graph g;
    20   /// ...
    20   /// ...
    21   /// Graph::NodeIt n;
    21   /// Graph::NodeIt n;
    22   /// FOR_EACH_GLOB(n, g) {
    22   /// h_for_glob(n, g) {
    23   /// ...
    23   /// ...
    24   /// }
    24   /// }
    25   /// Graph::EdgeIt e;
    25   /// Graph::EdgeIt e;
    26   /// FOR_EACH_GLOB(e, g) {
    26   /// h_for_glob(e, g) {
    27   /// ...
    27   /// ...
    28   /// }
    28   /// }
    29   /// \endcode
    29   /// \endcode
    30   /// Note that the iterated variables \c n and \c e are global ones. 
    30   /// Note that the iterated variables \c n and \c e are global ones. 
       
    31 #define h_for_glob(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
       
    32 
       
    33 /// \deprecated
    31 #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)))
    32 
    35 
    33   /// This macro provides a comfortable interface for iterating with HUGO 
    36   /// This macro provides a comfortable interface for iterating with HUGO 
    34   /// iterators.
    37   /// iterators.
    35   /// \code
    38   /// \code
    36   /// Graph g;
    39   /// Graph g;
    37   /// ...
    40   /// ...
    38   /// Graph::Node v;
    41   /// Graph::Node v;
    39   /// Graph::OutEdgeIt e;
    42   /// Graph::OutEdgeIt e;
    40   /// FOR_EACH_INC_GLOB(e, g, v) {
    43   /// h_for_inc_glob(e, g, v) {
    41   /// ...
    44   /// ...
    42   /// }
    45   /// }
    43   /// typedef BipartiteGraph<Graph> BGraph;
    46   /// typedef BipartiteGraph<Graph> BGraph;
    44   /// BGraph h;
    47   /// BGraph h;
    45   /// ...
    48   /// ...
    46   /// BGraph::ClassNodeIt n;
    49   /// BGraph::ClassNodeIt n;
    47   /// FOR_EACH_INC_GLOB(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
    50   /// h_for_inc_glob(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
    48   /// ...
    51   /// ...
    49   /// }
    52   /// }
    50   /// \endcode
    53   /// \endcode
    51   /// Note that iterated variables \c e and \c n are global ones. 
    54   /// Note that iterated variables \c e and \c n are global ones. 
       
    55 #define h_for_inc_glob(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
       
    56 
       
    57 /// \deprecated
    52 #define FOR_EACH_INC_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
    58 #define FOR_EACH_INC_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
    53   
    59   
    54 /// \deprecated
    60 /// \deprecated
    55 //#define FOR_EACH_EDGE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    61 //#define FOR_EACH_EDGE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    56 /// \deprecated
    62 /// \deprecated
   122   /// This macro provides a comfortable interface for iterating with HUGO 
   128   /// This macro provides a comfortable interface for iterating with HUGO 
   123   /// iterators.
   129   /// iterators.
   124   /// \code
   130   /// \code
   125   /// Graph g;
   131   /// Graph g;
   126   /// ...
   132   /// ...
   127   /// FOR_EACH_LOC(Graph::NodeIt, n, g) {
   133   /// h_for(Graph::NodeIt, n, g) {
   128   /// ...
   134   /// ...
   129   /// }
   135   /// }
   130   /// FOR_EACH_LOC(Graph::EdgeIt, e, g) {
   136   /// h_for(Graph::EdgeIt, e, g) {
   131   /// ...
   137   /// ...
   132   /// }
   138   /// }
   133   /// \endcode
   139   /// \endcode
   134   /// Note that the iterated variables \c n and \c e are local ones. 
   140   /// Note that the iterated variables \c n and \c e are local ones. 
       
   141 #define h_for(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
       
   142   
       
   143 /// \deprecated
   135 #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))
   136   
   145 
   137   /// This macro provides a comfortable interface for iterating with HUGO 
   146   /// This macro provides a comfortable interface for iterating with HUGO 
   138   /// iterators.
   147   /// iterators.
   139   /// \code
   148   /// \code
   140   /// Graph g;
   149   /// Graph g;
   141   /// ...
   150   /// ...
   142   /// Graph::Node v;
   151   /// Graph::Node v;
   143   /// FOR_EACH_INC_LOC(Graph::OutEdgeIt, e, g, v) {
   152   /// h_for_inc(Graph::OutEdgeIt, e, g, v) {
   144   /// ...
   153   /// ...
   145   /// }
   154   /// }
   146   /// typedef BipartiteGraph<Graph> BGraph;
   155   /// typedef BipartiteGraph<Graph> BGraph;
   147   /// BGraph h;
   156   /// BGraph h;
   148   /// ...
   157   /// ...
   149   /// FOR_EACH_INC_LOC(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
   158   /// h_for_inc(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
   150   /// ...
   159   /// ...
   151   /// }
   160   /// }
   152   /// \endcode
   161   /// \endcode
   153   /// Note that the iterated variables \c e and \c n are local ones. 
   162   /// Note that the iterated variables \c e and \c n are local ones. 
       
   163 #define h_for_inc(Ittype, e, g, v) for(Ittype e=loopFirst(Ittype(), (g), (v)); (g).valid(e); (g).next(e))
       
   164   
       
   165 /// \deprecated
   154 #define FOR_EACH_INC_LOC(Ittype, e, g, v) for(Ittype e=loopFirst(Ittype(), (g), (v)); (g).valid(e); (g).next(e))
   166 #define FOR_EACH_INC_LOC(Ittype, e, g, v) for(Ittype e=loopFirst(Ittype(), (g), (v)); (g).valid(e); (g).next(e))
   155   
   167   
   156 // #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)))
   157 // #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)))
   158 // #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)))
   159 // #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)))
   160 
   172 
   161 
       
   162 } //namespace hugo
   173 } //namespace hugo
   163 
   174 
   164 #endif //HUGO_FOR_EACH_MACROS_H
   175 #endif //HUGO_FOR_EACH_MACROS_H