for_each_macros.h in include
authormarci
Fri, 14 May 2004 14:42:58 +0000
changeset 63775ad3e24425e
parent 636 e59b0c363a9e
child 638 2153dd45937a
for_each_macros.h in include
src/hugo/for_each_macros.h
src/work/Doxyfile
src/work/marci/for_each_macros.h
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/hugo/for_each_macros.h	Fri May 14 14:42:58 2004 +0000
     1.3 @@ -0,0 +1,158 @@
     1.4 +// -*- c++ -*-
     1.5 +#ifndef FOR_EACH_MACROS_H
     1.6 +#define FOR_EACH_MACROS_H
     1.7 +
     1.8 +// /// \ingroup gwrappers
     1.9 +/// \file
    1.10 +/// \brief Iteraton macros.
    1.11 +///
    1.12 +/// This file contains several macros which make easier writting 
    1.13 +/// for cycles in HUGO, using HUGO iterators.
    1.14 +///
    1.15 +/// \author Marton Makai
    1.16 +
    1.17 +namespace hugo {
    1.18 +
    1.19 +/// The iteration with HUGO iterators i.e. for cycles can be 
    1.20 +/// written very comfortable with this macro.
    1.21 +/// \code
    1.22 +/// Graph g;
    1.23 +/// Graph::NodeIt n;
    1.24 +/// FOR_EACH_GLOB(n, g) {
    1.25 +/// ...
    1.26 +/// }
    1.27 +/// Graph::EdgeIt e;
    1.28 +/// FOR_EACH_GLOB(e, g) {
    1.29 +/// ...
    1.30 +/// }
    1.31 +/// In the above cycle, the iterator variable \c n and \c e are global ones. 
    1.32 +/// \endcode
    1.33 +#define FOR_EACH_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    1.34 +
    1.35 +/// The iteration with HUGO iterators i.e. for cycles can be 
    1.36 +/// written very comfortable with this macro.
    1.37 +/// \code
    1.38 +/// Graph g;
    1.39 +/// Graph::Node v;
    1.40 +/// Graph::OutEdgeIt e;
    1.41 +/// FOR_EACH_INC_GLOB(e, g, v) {
    1.42 +/// ...
    1.43 +/// }
    1.44 +/// typedef BipartiteGraph<Graph> BGraph;
    1.45 +/// BGraph h;
    1.46 +/// BGraph::ClassNodeIt n;
    1.47 +/// FOR_EACH_INC_GLOB(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
    1.48 +/// ...
    1.49 +/// }
    1.50 +/// In the above cycle, the iterator variable \c e and \c n are global ones. 
    1.51 +/// \endcode
    1.52 +#define FOR_EACH_INC_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
    1.53 +
    1.54 +/// \deprecated
    1.55 +#define FOR_EACH_EDGE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    1.56 +/// \deprecated
    1.57 +#define FOR_EACH_NODE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    1.58 +/// \deprecated
    1.59 +#define FOR_EACH_INEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
    1.60 +/// \deprecated
    1.61 +#define FOR_EACH_OUTEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
    1.62 +
    1.63 +//   template<typename It, typename Graph> 
    1.64 +//   It loopFirst(const Graph& g) const {
    1.65 +//     It e; g.first(e); return e; 
    1.66 +//   }
    1.67 +
    1.68 +//   template<typename It, typename Graph> 
    1.69 +//   It loopFirst(const Graph& g, const Node& v) const {
    1.70 +//     It e; g.first(e, v); return e; 
    1.71 +//   }
    1.72 +
    1.73 +//   template<typename Graph> 
    1.74 +//   typename Graph::NodeIt loopFirstNode(const Graph& g) const {
    1.75 +//     typename Graph::NodeIt e; g.first(e); return e; 
    1.76 +//   }
    1.77 +//   template<typename Graph> 
    1.78 +//   typename Graph::EdgeIt loopFirstEdge(const Graph& g) const {
    1.79 +//     typename Graph::EdgeIt e; g.first(e); return e; 
    1.80 +//   }
    1.81 +//   template<typename Graph> 
    1.82 +//   typename Graph::OutEdgeIt 
    1.83 +//   loopFirstOutEdge(const Graph& g, const Node& n) const {
    1.84 +//     typename Graph::OutEdgeIt e; g.first(e, n); return e; 
    1.85 +//   }
    1.86 +//   template<typename Graph> 
    1.87 +//   typename Graph::InEdgeIt 
    1.88 +//   loopFirstIn Edge(const Graph& g, const Node& n) const {
    1.89 +//     typename Graph::InEdgeIt e; g.first(e, n); return e; 
    1.90 +//   }
    1.91 +
    1.92 +//FIXME ezt hogy a gorcsbe birja levezetni. Csak ugy leveszi a const-ot??
    1.93 +  template<typename It, typename Graph> 
    1.94 +  It loopFirst(const It&, const Graph& g) {
    1.95 +    It e; g.first(e); return e; 
    1.96 +  }
    1.97 +
    1.98 +  template<typename It, typename Graph, typename Node> 
    1.99 +  It loopFirst(const It&, const Graph& g, const Node& v) {
   1.100 +    It e; g.first(e, v); return e; 
   1.101 +  }
   1.102 +
   1.103 +//   template<typename Graph> 
   1.104 +//   typename Graph::NodeIt loopFirstNode(const Graph& g) const {
   1.105 +//     typename Graph::NodeIt e; g.first(e); return e; 
   1.106 +//   }
   1.107 +//   template<typename Graph> 
   1.108 +//   typename Graph::EdgeIt loopFirstEdge(const Graph& g) const {
   1.109 +//     typename Graph::EdgeIt e; g.first(e); return e; 
   1.110 +//   }
   1.111 +//   template<typename Graph> 
   1.112 +//   typename Graph::OutEdgeIt 
   1.113 +//   loopFirstOutEdge(const Graph& g, const Node& n) const {
   1.114 +//     typename Graph::OutEdgeIt e; g.first(e, n); return e; 
   1.115 +//   }
   1.116 +//   template<typename Graph> 
   1.117 +//   typename Graph::InEdgeIt 
   1.118 +//   loopFirstIn Edge(const Graph& g, const Node& n) const {
   1.119 +//     typename Graph::InEdgeIt e; g.first(e, n); return e; 
   1.120 +//   }
   1.121 +
   1.122 +/// The iteration with HUGO iterators i.e. for cycles can be 
   1.123 +/// written very comfortable with this macro.
   1.124 +/// \code
   1.125 +/// Graph g;
   1.126 +/// FOR_EACH_LOC(Graph::NodeIt, n, g) {
   1.127 +/// ...
   1.128 +/// }
   1.129 +/// FOR_EACH_LOC(Graph::EdgeIt, e, g) {
   1.130 +/// ...
   1.131 +/// }
   1.132 +/// In the above cycle, the iterator variable \c n and \c e are local ones. 
   1.133 +/// \endcode
   1.134 +#define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
   1.135 +
   1.136 +/// The iteration with HUGO iterators i.e. for cycles can be 
   1.137 +/// written very comfortable with this macro.
   1.138 +/// \code
   1.139 +/// Graph g;
   1.140 +/// Graph::Node v;
   1.141 +/// FOR_EACH_INC_LOC(Graph::OutEdgeIt, e, g, v) {
   1.142 +/// ...
   1.143 +/// }
   1.144 +/// typedef BipartiteGraph<Graph> BGraph;
   1.145 +/// BGraph h;
   1.146 +/// FOR_EACH_INC_LOC(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
   1.147 +/// ...
   1.148 +/// }
   1.149 +/// In the above cycle, the iterator variable \c e and \c n are local ones. 
   1.150 +/// \endcode
   1.151 +#define FOR_EACH_INC_LOC(Ittype, e, g, v) for(Ittype e=loopFirst(Ittype(), (g), (v)); (g).valid(e); (g).next(e))
   1.152 +
   1.153 +// #define FOR_EACH_EDGE_LOC(e, g) ezt nem tom hogy kell for((g).first((e)); (g).valid((e)); (g).next((e)))
   1.154 +// #define FOR_EACH_NODE_LOC(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
   1.155 +// #define FOR_EACH_INEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
   1.156 +// #define FOR_EACH_OUTEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
   1.157 +
   1.158 +
   1.159 +} //namespace hugo
   1.160 +
   1.161 +#endif //FOR_EACH_MACROS_H
     2.1 --- a/src/work/Doxyfile	Fri May 14 14:41:30 2004 +0000
     2.2 +++ b/src/work/Doxyfile	Fri May 14 14:42:58 2004 +0000
     2.3 @@ -400,7 +400,8 @@
     2.4  			 marci/bfs_dfs.h \
     2.5  	  		 marci/bfs_dfs_misc.h \
     2.6  			 jacint/graph_gen.h \
     2.7 -			 marci/max_bipartite_matching.h
     2.8 +			 marci/max_bipartite_matching.h \
     2.9 +			 marci/bipartite_graph_wrapper.h
    2.10  
    2.11  # If the value of the INPUT tag contains directories, you can use the 
    2.12  # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
     3.1 --- a/src/work/marci/for_each_macros.h	Fri May 14 14:41:30 2004 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,158 +0,0 @@
     3.4 -// -*- c++ -*-
     3.5 -#ifndef FOR_EACH_MACROS_H
     3.6 -#define FOR_EACH_MACROS_H
     3.7 -
     3.8 -// /// \ingroup gwrappers
     3.9 -/// \file
    3.10 -/// \brief Iteraton macros.
    3.11 -///
    3.12 -/// This file contains several macros which make easier writting 
    3.13 -/// for cycles in HUGO, using HUGO iterators.
    3.14 -///
    3.15 -/// \author Marton Makai
    3.16 -
    3.17 -namespace hugo {
    3.18 -
    3.19 -/// The iteration with HUGO iterators i.e. for cycles can be 
    3.20 -/// written very comfortable with this macro.
    3.21 -/// \code
    3.22 -/// Graph g;
    3.23 -/// Graph::NodeIt n;
    3.24 -/// FOR_EACH_GLOB(n, g) {
    3.25 -/// ...
    3.26 -/// }
    3.27 -/// Graph::EdgeIt e;
    3.28 -/// FOR_EACH_GLOB(e, g) {
    3.29 -/// ...
    3.30 -/// }
    3.31 -/// In the above cycle, the iterator variable \c n and \c e are global ones. 
    3.32 -/// \endcode
    3.33 -#define FOR_EACH_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    3.34 -
    3.35 -/// The iteration with HUGO iterators i.e. for cycles can be 
    3.36 -/// written very comfortable with this macro.
    3.37 -/// \code
    3.38 -/// Graph g;
    3.39 -/// Graph::Node v;
    3.40 -/// Graph::OutEdgeIt e;
    3.41 -/// FOR_EACH_INC_GLOB(e, g, v) {
    3.42 -/// ...
    3.43 -/// }
    3.44 -/// typedef BipartiteGraph<Graph> BGraph;
    3.45 -/// BGraph h;
    3.46 -/// BGraph::ClassNodeIt n;
    3.47 -/// FOR_EACH_INC_GLOB(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
    3.48 -/// ...
    3.49 -/// }
    3.50 -/// In the above cycle, the iterator variable \c e and \c n are global ones. 
    3.51 -/// \endcode
    3.52 -#define FOR_EACH_INC_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
    3.53 -
    3.54 -/// \deprecated
    3.55 -#define FOR_EACH_EDGE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    3.56 -/// \deprecated
    3.57 -#define FOR_EACH_NODE_GLOB(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
    3.58 -/// \deprecated
    3.59 -#define FOR_EACH_INEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
    3.60 -/// \deprecated
    3.61 -#define FOR_EACH_OUTEDGE_GLOB(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
    3.62 -
    3.63 -//   template<typename It, typename Graph> 
    3.64 -//   It loopFirst(const Graph& g) const {
    3.65 -//     It e; g.first(e); return e; 
    3.66 -//   }
    3.67 -
    3.68 -//   template<typename It, typename Graph> 
    3.69 -//   It loopFirst(const Graph& g, const Node& v) const {
    3.70 -//     It e; g.first(e, v); return e; 
    3.71 -//   }
    3.72 -
    3.73 -//   template<typename Graph> 
    3.74 -//   typename Graph::NodeIt loopFirstNode(const Graph& g) const {
    3.75 -//     typename Graph::NodeIt e; g.first(e); return e; 
    3.76 -//   }
    3.77 -//   template<typename Graph> 
    3.78 -//   typename Graph::EdgeIt loopFirstEdge(const Graph& g) const {
    3.79 -//     typename Graph::EdgeIt e; g.first(e); return e; 
    3.80 -//   }
    3.81 -//   template<typename Graph> 
    3.82 -//   typename Graph::OutEdgeIt 
    3.83 -//   loopFirstOutEdge(const Graph& g, const Node& n) const {
    3.84 -//     typename Graph::OutEdgeIt e; g.first(e, n); return e; 
    3.85 -//   }
    3.86 -//   template<typename Graph> 
    3.87 -//   typename Graph::InEdgeIt 
    3.88 -//   loopFirstIn Edge(const Graph& g, const Node& n) const {
    3.89 -//     typename Graph::InEdgeIt e; g.first(e, n); return e; 
    3.90 -//   }
    3.91 -
    3.92 -//FIXME ezt hogy a gorcsbe birja levezetni. Csak ugy leveszi a const-ot??
    3.93 -  template<typename It, typename Graph> 
    3.94 -  It loopFirst(const It&, const Graph& g) {
    3.95 -    It e; g.first(e); return e; 
    3.96 -  }
    3.97 -
    3.98 -  template<typename It, typename Graph, typename Node> 
    3.99 -  It loopFirst(const It&, const Graph& g, const Node& v) {
   3.100 -    It e; g.first(e, v); return e; 
   3.101 -  }
   3.102 -
   3.103 -//   template<typename Graph> 
   3.104 -//   typename Graph::NodeIt loopFirstNode(const Graph& g) const {
   3.105 -//     typename Graph::NodeIt e; g.first(e); return e; 
   3.106 -//   }
   3.107 -//   template<typename Graph> 
   3.108 -//   typename Graph::EdgeIt loopFirstEdge(const Graph& g) const {
   3.109 -//     typename Graph::EdgeIt e; g.first(e); return e; 
   3.110 -//   }
   3.111 -//   template<typename Graph> 
   3.112 -//   typename Graph::OutEdgeIt 
   3.113 -//   loopFirstOutEdge(const Graph& g, const Node& n) const {
   3.114 -//     typename Graph::OutEdgeIt e; g.first(e, n); return e; 
   3.115 -//   }
   3.116 -//   template<typename Graph> 
   3.117 -//   typename Graph::InEdgeIt 
   3.118 -//   loopFirstIn Edge(const Graph& g, const Node& n) const {
   3.119 -//     typename Graph::InEdgeIt e; g.first(e, n); return e; 
   3.120 -//   }
   3.121 -
   3.122 -/// The iteration with HUGO iterators i.e. for cycles can be 
   3.123 -/// written very comfortable with this macro.
   3.124 -/// \code
   3.125 -/// Graph g;
   3.126 -/// FOR_EACH_LOC(Graph::NodeIt, n, g) {
   3.127 -/// ...
   3.128 -/// }
   3.129 -/// FOR_EACH_LOC(Graph::EdgeIt, e, g) {
   3.130 -/// ...
   3.131 -/// }
   3.132 -/// In the above cycle, the iterator variable \c n and \c e are local ones. 
   3.133 -/// \endcode
   3.134 -#define FOR_EACH_LOC(Ittype, e, g) for(Ittype e=loopFirst(Ittype(), (g)); (g).valid(e); (g).next(e))
   3.135 -
   3.136 -/// The iteration with HUGO iterators i.e. for cycles can be 
   3.137 -/// written very comfortable with this macro.
   3.138 -/// \code
   3.139 -/// Graph g;
   3.140 -/// Graph::Node v;
   3.141 -/// FOR_EACH_INC_LOC(Graph::OutEdgeIt, e, g, v) {
   3.142 -/// ...
   3.143 -/// }
   3.144 -/// typedef BipartiteGraph<Graph> BGraph;
   3.145 -/// BGraph h;
   3.146 -/// FOR_EACH_INC_LOC(BGraph::ClassNodeIt, n, h, h.S_CLASS) {
   3.147 -/// ...
   3.148 -/// }
   3.149 -/// In the above cycle, the iterator variable \c e and \c n are local ones. 
   3.150 -/// \endcode
   3.151 -#define FOR_EACH_INC_LOC(Ittype, e, g, v) for(Ittype e=loopFirst(Ittype(), (g), (v)); (g).valid(e); (g).next(e))
   3.152 -
   3.153 -// #define FOR_EACH_EDGE_LOC(e, g) ezt nem tom hogy kell for((g).first((e)); (g).valid((e)); (g).next((e)))
   3.154 -// #define FOR_EACH_NODE_LOC(e, g) for((g).first((e)); (g).valid((e)); (g).next((e)))
   3.155 -// #define FOR_EACH_INEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
   3.156 -// #define FOR_EACH_OUTEDGE_LOC(e, g, v) for((g).first((e), (v)); (g).valid((e)); (g).next((e)))
   3.157 -
   3.158 -
   3.159 -} //namespace hugo
   3.160 -
   3.161 -#endif //FOR_EACH_MACROS_H