Fix maps in the GraphWrappers.
authordeba
Fri, 17 Sep 2004 07:02:16 +0000
changeset 87766dd225ca128
parent 876 26c573ca6a99
child 878 86b42ec55f3e
Fix maps in the GraphWrappers.
src/hugo/graph_wrapper.h
src/hugo/list_graph.h
src/hugo/map_defines.h
     1.1 --- a/src/hugo/graph_wrapper.h	Thu Sep 16 20:55:01 2004 +0000
     1.2 +++ b/src/hugo/graph_wrapper.h	Fri Sep 17 07:02:16 2004 +0000
     1.3 @@ -224,25 +224,11 @@
     1.4      
     1.5      Edge opposite(const Edge& e) const { return Edge(graph->opposite(e)); }
     1.6  
     1.7 -    template<typename T> class NodeMap : public Graph::template NodeMap<T> { 
     1.8 -      typedef typename Graph::template NodeMap<T> Parent;
     1.9 -    public:
    1.10 -      NodeMap(const GraphWrapper<Graph>& gw) :  Parent(*(gw.graph)) { }
    1.11 -      NodeMap(const GraphWrapper<Graph>& gw, T a) : Parent(*(gw.graph), a) { }
    1.12 -//       NodeMap(const NodeMap<T>& map) : Parent(map) { }
    1.13 -//       template<typename Map>
    1.14 -//       NodeMap(const Map& map) :  Parent(map) { }
    1.15 -    };
    1.16  
    1.17 -    template<typename T> class EdgeMap : public Graph::template EdgeMap<T> { 
    1.18 -      typedef typename Graph::template EdgeMap<T> Parent;
    1.19 -    public:
    1.20 -      EdgeMap(const GraphWrapper<Graph>& gw) : Parent(*(gw.graph)) { }
    1.21 -      EdgeMap(const GraphWrapper<Graph>& gw, T a) : Parent(*(gw.graph), a) { }
    1.22 -//       EdgeMap(const EdgeMap<T>& map) : Parent(map) { }
    1.23 -//       template<typename Map>
    1.24 -//       EdgeMap(const Map& map) :  Parent(map) { }
    1.25 -    };
    1.26 +    IMPORT_NODE_MAP(Graph, *(gw.graph), GraphWrapper, gw);    
    1.27 +    IMPORT_EDGE_MAP(Graph, *(gw.graph), GraphWrapper, gw);
    1.28 +    
    1.29 +
    1.30    };
    1.31  
    1.32  
    1.33 @@ -330,6 +316,8 @@
    1.34      Node head(const Edge& e) const { 
    1.35        return GraphWrapper<Graph>::tail(e); }
    1.36  
    1.37 +    KEEP_MAPS(Parent, RevGraphWrapper);
    1.38 +
    1.39    };
    1.40  
    1.41  
    1.42 @@ -569,6 +557,7 @@
    1.43        return i; 
    1.44      }
    1.45  
    1.46 +    KEEP_MAPS(Parent, SubGraphWrapper);
    1.47    };
    1.48  
    1.49  
    1.50 @@ -659,6 +648,9 @@
    1.51      Node bNode(const OutEdgeIt& e) const { 
    1.52        if (e.out_or_in) return this->graph->head(e); else 
    1.53  	return this->graph->tail(e); }
    1.54 +
    1.55 +    KEEP_MAPS(Parent, UndirGraphWrapper);
    1.56 +
    1.57    };
    1.58    
    1.59    /// \brief An undirected graph template.
    1.60 @@ -676,6 +668,8 @@
    1.61      UndirGraph() : UndirGraphWrapper<Graph>() { 
    1.62        Parent::setGraph(gr); 
    1.63      }
    1.64 +
    1.65 +    KEEP_MAPS(Parent, UndirGraph);
    1.66    };
    1.67  
    1.68  
    1.69 @@ -1108,6 +1102,10 @@
    1.70  // 	  return backward_map.get(e.in); 
    1.71  //       }
    1.72      };
    1.73 +
    1.74 +
    1.75 +    KEEP_NODE_MAP(Parent, SubBidirGraphWrapper);
    1.76 +
    1.77    };
    1.78  
    1.79  
    1.80 @@ -1145,6 +1143,7 @@
    1.81      int edgeNum() const { 
    1.82        return 2*this->graph->edgeNum();
    1.83      }
    1.84 +    KEEP_MAPS(Parent, BidirGraphWrapper);
    1.85    };
    1.86  
    1.87  
    1.88 @@ -1167,6 +1166,7 @@
    1.89      BidirGraph() : BidirGraphWrapper<Graph>() { 
    1.90        Parent::setGraph(gr); 
    1.91      }
    1.92 +    KEEP_MAPS(Parent, BidirGraph);
    1.93    };
    1.94  
    1.95  
    1.96 @@ -1307,6 +1307,7 @@
    1.97        void update() { }
    1.98      };
    1.99  
   1.100 +    KEEP_MAPS(Parent, ResGraphWrapper);
   1.101    };
   1.102  
   1.103  
   1.104 @@ -1418,6 +1419,8 @@
   1.105        ++f;
   1.106        first_out_edges->set(n, f);
   1.107      }
   1.108 +
   1.109 +    KEEP_MAPS(Parent, ErasingFirstGraphWrapper);
   1.110    };
   1.111  
   1.112    ///@}
     2.1 --- a/src/hugo/list_graph.h	Thu Sep 16 20:55:01 2004 +0000
     2.2 +++ b/src/hugo/list_graph.h	Fri Sep 17 07:02:16 2004 +0000
     2.3 @@ -882,12 +882,12 @@
     2.4      class InEdgeIt;
     2.5  
     2.6  
     2.7 -    /// Creating edge map registry.
     2.8 +    /// Creates edge map registry.
     2.9      CREATE_EDGE_MAP_REGISTRY;
    2.10 -    /// Creating edge maps.
    2.11 +    /// Creates edge maps.
    2.12      CREATE_EDGE_MAP(DefaultMap);
    2.13  
    2.14 -    /// Importing node maps from the NodeGraphType.
    2.15 +    /// Imports node maps from the NodeGraphType.
    2.16      IMPORT_NODE_MAP(NodeGraphType, graph.G, EdgeSet, graph);
    2.17      
    2.18      
     3.1 --- a/src/hugo/map_defines.h	Thu Sep 16 20:55:01 2004 +0000
     3.2 +++ b/src/hugo/map_defines.h	Fri Sep 17 07:02:16 2004 +0000
     3.3 @@ -205,12 +205,19 @@
     3.4     } \
     3.5  };
     3.6  
     3.7 +#define KEEP_EDGE_MAP(From, To) \
     3.8 +IMPORT_EDGE_MAP(From, graph, To, graph)
     3.9 +
    3.10 +
    3.11 +#define KEEP_NODE_MAP(From, To) \
    3.12 +IMPORT_NODE_MAP(From, graph, To, graph)
    3.13  
    3.14  /** This is a macro to keep the node and edge maps for a graph class.
    3.15   */
    3.16  #define KEEP_MAPS(From, To) \
    3.17 -IMPORT_EDGE_MAP(From, graph, To, graph) \
    3.18 -IMPORT_NODE_MAP(From, graph, To, graph)
    3.19 +KEEP_EDGE_MAP(From, To) \
    3.20 +KEEP_NODE_MAP(From, To)
    3.21 +
    3.22    
    3.23  /// @}
    3.24