1.1 --- a/lemon/bits/default_map.h Wed Nov 30 17:49:01 2005 +0000
1.2 +++ b/lemon/bits/default_map.h Thu Dec 01 15:08:46 2005 +0000
1.3 @@ -225,6 +225,47 @@
1.4
1.5 /// \e
1.6 template <typename _Base>
1.7 + class MappableEdgeSetExtender : public _Base {
1.8 + public:
1.9 +
1.10 + typedef MappableEdgeSetExtender<_Base> Graph;
1.11 + typedef _Base Parent;
1.12 +
1.13 + typedef typename Parent::Edge Edge;
1.14 + typedef typename Parent::EdgeIt EdgeIt;
1.15 +
1.16 + template <typename _Value>
1.17 + class EdgeMap
1.18 + : public IterableMapExtender<DefaultMap<Graph, Edge, _Value> > {
1.19 + public:
1.20 + typedef MappableEdgeSetExtender Graph;
1.21 + typedef IterableMapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
1.22 +
1.23 + EdgeMap(const Graph& _g)
1.24 + : Parent(_g) {}
1.25 + EdgeMap(const Graph& _g, const _Value& _v)
1.26 + : Parent(_g, _v) {}
1.27 +
1.28 + EdgeMap& operator=(const EdgeMap& cmap) {
1.29 + return operator=<EdgeMap>(cmap);
1.30 + }
1.31 +
1.32 + template <typename CMap>
1.33 + EdgeMap& operator=(const CMap& cmap) {
1.34 + checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
1.35 + const typename Parent::Graph* graph = Parent::getGraph();
1.36 + Edge it;
1.37 + for (graph->first(it); it != INVALID; graph->next(it)) {
1.38 + Parent::set(it, cmap[it]);
1.39 + }
1.40 + return *this;
1.41 + }
1.42 + };
1.43 +
1.44 + };
1.45 +
1.46 + /// \e
1.47 + template <typename _Base>
1.48 class MappableUndirGraphExtender :
1.49 public MappableGraphExtender<_Base> {
1.50 public:
1.51 @@ -266,6 +307,49 @@
1.52
1.53 };
1.54
1.55 + /// \e
1.56 + template <typename _Base>
1.57 + class MappableUndirEdgeSetExtender :
1.58 + public MappableEdgeSetExtender<_Base> {
1.59 + public:
1.60 +
1.61 + typedef MappableUndirEdgeSetExtender Graph;
1.62 + typedef MappableEdgeSetExtender<_Base> Parent;
1.63 +
1.64 + typedef typename Parent::UndirEdge UndirEdge;
1.65 +
1.66 + template <typename _Value>
1.67 + class UndirEdgeMap
1.68 + : public IterableMapExtender<DefaultMap<Graph, UndirEdge, _Value> > {
1.69 + public:
1.70 + typedef MappableUndirEdgeSetExtender Graph;
1.71 + typedef IterableMapExtender<
1.72 + DefaultMap<Graph, UndirEdge, _Value> > Parent;
1.73 +
1.74 + UndirEdgeMap(const Graph& _g)
1.75 + : Parent(_g) {}
1.76 + UndirEdgeMap(const Graph& _g, const _Value& _v)
1.77 + : Parent(_g, _v) {}
1.78 +
1.79 + UndirEdgeMap& operator=(const UndirEdgeMap& cmap) {
1.80 + return operator=<UndirEdgeMap>(cmap);
1.81 + }
1.82 +
1.83 + template <typename CMap>
1.84 + UndirEdgeMap& operator=(const CMap& cmap) {
1.85 + checkConcept<concept::ReadMap<UndirEdge, _Value>, CMap>();
1.86 + const typename Parent::Graph* graph = Parent::getGraph();
1.87 + UndirEdge it;
1.88 + for (graph->first(it); it != INVALID; graph->next(it)) {
1.89 + Parent::set(it, cmap[it]);
1.90 + }
1.91 + return *this;
1.92 + }
1.93 + };
1.94 +
1.95 +
1.96 + };
1.97 +
1.98
1.99 template <typename _Base>
1.100 class MappableUndirBipartiteGraphExtender : public _Base {