↑ Collapse diff ↑
Ignore white space 6 line context
... ...
@@ -58,143 +58,145 @@
58 58
    typedef _Item Key;
59 59
    /// The value type of the map.
60 60
    typedef _Value Value;
61 61

	
62 62
    /// The const reference type of the map.
63 63
    typedef const _Value& ConstReference;
64 64
    /// The reference type of the map.
65 65
    typedef _Value& Reference;
66 66

	
67 67
    /// The notifier type.
68 68
    typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
69 69

	
70 70
    /// The MapBase of the Map which imlements the core regisitry function.
71 71
    typedef typename Notifier::ObserverBase Parent;
72 72

	
73 73
  private:
74 74
    typedef std::allocator<Value> Allocator;
75 75

	
76 76
  public:
77 77

	
78 78
    /// \brief Graph initialized map constructor.
79 79
    ///
80 80
    /// Graph initialized map constructor.
81 81
    explicit ArrayMap(const Graph& graph) {
82 82
      Parent::attach(graph.notifier(Item()));
83 83
      allocate_memory();
84 84
      Notifier* nf = Parent::notifier();
85 85
      Item it;
86 86
      for (nf->first(it); it != INVALID; nf->next(it)) {
87 87
        int id = nf->id(it);;
88 88
        allocator.construct(&(values[id]), Value());
89 89
      }
90 90
    }
91 91

	
92 92
    /// \brief Constructor to use default value to initialize the map.
93 93
    ///
94 94
    /// It constructs a map and initialize all of the the map.
95 95
    ArrayMap(const Graph& graph, const Value& value) {
96 96
      Parent::attach(graph.notifier(Item()));
97 97
      allocate_memory();
98 98
      Notifier* nf = Parent::notifier();
99 99
      Item it;
100 100
      for (nf->first(it); it != INVALID; nf->next(it)) {
101 101
        int id = nf->id(it);;
102 102
        allocator.construct(&(values[id]), value);
103 103
      }
104 104
    }
105 105

	
106
  private:
106 107
    /// \brief Constructor to copy a map of the same map type.
107 108
    ///
108 109
    /// Constructor to copy a map of the same map type.
109 110
    ArrayMap(const ArrayMap& copy) : Parent() {
110 111
      if (copy.attached()) {
111 112
        attach(*copy.notifier());
112 113
      }
113 114
      capacity = copy.capacity;
114 115
      if (capacity == 0) return;
115 116
      values = allocator.allocate(capacity);
116 117
      Notifier* nf = Parent::notifier();
117 118
      Item it;
118 119
      for (nf->first(it); it != INVALID; nf->next(it)) {
119 120
        int id = nf->id(it);;
120 121
        allocator.construct(&(values[id]), copy.values[id]);
121 122
      }
122 123
    }
123 124

	
124 125
    /// \brief Assign operator.
125 126
    ///
126 127
    /// This operator assigns for each item in the map the
127 128
    /// value mapped to the same item in the copied map.
128 129
    /// The parameter map should be indiced with the same
129 130
    /// itemset because this assign operator does not change
130 131
    /// the container of the map.
131 132
    ArrayMap& operator=(const ArrayMap& cmap) {
132 133
      return operator=<ArrayMap>(cmap);
133 134
    }
134 135

	
135 136

	
136 137
    /// \brief Template assign operator.
137 138
    ///
138 139
    /// The given parameter should be conform to the ReadMap
139 140
    /// concecpt and could be indiced by the current item set of
140 141
    /// the NodeMap. In this case the value for each item
141 142
    /// is assigned by the value of the given ReadMap.
142 143
    template <typename CMap>
143 144
    ArrayMap& operator=(const CMap& cmap) {
144 145
      checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
145 146
      const typename Parent::Notifier* nf = Parent::notifier();
146 147
      Item it;
147 148
      for (nf->first(it); it != INVALID; nf->next(it)) {
148 149
        set(it, cmap[it]);
149 150
      }
150 151
      return *this;
151 152
    }
152 153

	
154
  public:
153 155
    /// \brief The destructor of the map.
154 156
    ///
155 157
    /// The destructor of the map.
156 158
    virtual ~ArrayMap() {
157 159
      if (attached()) {
158 160
        clear();
159 161
        detach();
160 162
      }
161 163
    }
162 164

	
163 165
  protected:
164 166

	
165 167
    using Parent::attach;
166 168
    using Parent::detach;
167 169
    using Parent::attached;
168 170

	
169 171
  public:
170 172

	
171 173
    /// \brief The subscript operator.
172 174
    ///
173 175
    /// The subscript operator. The map can be subscripted by the
174 176
    /// actual keys of the graph.
175 177
    Value& operator[](const Key& key) {
176 178
      int id = Parent::notifier()->id(key);
177 179
      return values[id];
178 180
    }
179 181

	
180 182
    /// \brief The const subscript operator.
181 183
    ///
182 184
    /// The const subscript operator. The map can be subscripted by the
183 185
    /// actual keys of the graph.
184 186
    const Value& operator[](const Key& key) const {
185 187
      int id = Parent::notifier()->id(key);
186 188
      return values[id];
187 189
    }
188 190

	
189 191
    /// \brief Setter function of the map.
190 192
    ///
191 193
    /// Setter function of the map. Equivalent with map[key] = val.
192 194
    /// This is a compatibility feature with the not dereferable maps.
193 195
    void set(const Key& key, const Value& val) {
194 196
      (*this)[key] = val;
195 197
    }
196 198

	
197 199
  protected:
198 200

	
199 201
    /// \brief Adds a new key to the map.
200 202
    ///
Ignore white space 6 line context
... ...
@@ -182,120 +182,122 @@
182 182
      InArcIt& operator++() {
183 183
        _digraph->nextIn(*this);
184 184
        return *this;
185 185
      }
186 186

	
187 187
    };
188 188

	
189 189
    /// \brief Base node of the iterator
190 190
    ///
191 191
    /// Returns the base node (i.e. the source in this case) of the iterator
192 192
    Node baseNode(const OutArcIt &arc) const {
193 193
      return Parent::source(arc);
194 194
    }
195 195
    /// \brief Running node of the iterator
196 196
    ///
197 197
    /// Returns the running node (i.e. the target in this case) of the
198 198
    /// iterator
199 199
    Node runningNode(const OutArcIt &arc) const {
200 200
      return Parent::target(arc);
201 201
    }
202 202

	
203 203
    /// \brief Base node of the iterator
204 204
    ///
205 205
    /// Returns the base node (i.e. the target in this case) of the iterator
206 206
    Node baseNode(const InArcIt &arc) const {
207 207
      return Parent::target(arc);
208 208
    }
209 209
    /// \brief Running node of the iterator
210 210
    ///
211 211
    /// Returns the running node (i.e. the source in this case) of the
212 212
    /// iterator
213 213
    Node runningNode(const InArcIt &arc) const {
214 214
      return Parent::source(arc);
215 215
    }
216 216

	
217 217

	
218 218
    template <typename _Value>
219 219
    class NodeMap
220 220
      : public MapExtender<DefaultMap<Digraph, Node, _Value> > {
221 221
    public:
222 222
      typedef DigraphExtender Digraph;
223 223
      typedef MapExtender<DefaultMap<Digraph, Node, _Value> > Parent;
224 224

	
225 225
      explicit NodeMap(const Digraph& digraph)
226 226
        : Parent(digraph) {}
227 227
      NodeMap(const Digraph& digraph, const _Value& value)
228 228
        : Parent(digraph, value) {}
229 229

	
230
    private:
230 231
      NodeMap& operator=(const NodeMap& cmap) {
231 232
        return operator=<NodeMap>(cmap);
232 233
      }
233 234

	
234 235
      template <typename CMap>
235 236
      NodeMap& operator=(const CMap& cmap) {
236 237
        Parent::operator=(cmap);
237 238
        return *this;
238 239
      }
239 240

	
240 241
    };
241 242

	
242 243
    template <typename _Value>
243 244
    class ArcMap
244 245
      : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
245 246
    public:
246 247
      typedef DigraphExtender Digraph;
247 248
      typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
248 249

	
249 250
      explicit ArcMap(const Digraph& digraph)
250 251
        : Parent(digraph) {}
251 252
      ArcMap(const Digraph& digraph, const _Value& value)
252 253
        : Parent(digraph, value) {}
253 254

	
255
    private:
254 256
      ArcMap& operator=(const ArcMap& cmap) {
255 257
        return operator=<ArcMap>(cmap);
256 258
      }
257 259

	
258 260
      template <typename CMap>
259 261
      ArcMap& operator=(const CMap& cmap) {
260 262
        Parent::operator=(cmap);
261 263
        return *this;
262 264
      }
263 265
    };
264 266

	
265 267

	
266 268
    Node addNode() {
267 269
      Node node = Parent::addNode();
268 270
      notifier(Node()).add(node);
269 271
      return node;
270 272
    }
271 273

	
272 274
    Arc addArc(const Node& from, const Node& to) {
273 275
      Arc arc = Parent::addArc(from, to);
274 276
      notifier(Arc()).add(arc);
275 277
      return arc;
276 278
    }
277 279

	
278 280
    void clear() {
279 281
      notifier(Arc()).clear();
280 282
      notifier(Node()).clear();
281 283
      Parent::clear();
282 284
    }
283 285

	
284 286
    template <typename Digraph, typename NodeRefMap, typename ArcRefMap>
285 287
    void build(const Digraph& digraph, NodeRefMap& nodeRef, ArcRefMap& arcRef) {
286 288
      Parent::build(digraph, nodeRef, arcRef);
287 289
      notifier(Node()).build();
288 290
      notifier(Arc()).build();
289 291
    }
290 292

	
291 293
    void erase(const Node& node) {
292 294
      Arc arc;
293 295
      Parent::firstOut(arc, node);
294 296
      while (arc != INVALID ) {
295 297
        erase(arc);
296 298
        Parent::firstOut(arc, node);
297 299
      }
298 300

	
299 301
      Parent::firstIn(arc, node);
300 302
      while (arc != INVALID ) {
301 303
        erase(arc);
... ...
@@ -563,145 +565,148 @@
563 565
    ///
564 566
    /// Returns the running node (ie. the target in this case) of the
565 567
    /// iterator
566 568
    Node runningNode(const OutArcIt &arc) const {
567 569
      return Parent::target(static_cast<const Arc&>(arc));
568 570
    }
569 571

	
570 572
    /// \brief Base node of the iterator
571 573
    ///
572 574
    /// Returns the base node (ie. the target in this case) of the iterator
573 575
    Node baseNode(const InArcIt &arc) const {
574 576
      return Parent::target(static_cast<const Arc&>(arc));
575 577
    }
576 578
    /// \brief Running node of the iterator
577 579
    ///
578 580
    /// Returns the running node (ie. the source in this case) of the
579 581
    /// iterator
580 582
    Node runningNode(const InArcIt &arc) const {
581 583
      return Parent::source(static_cast<const Arc&>(arc));
582 584
    }
583 585

	
584 586
    /// Base node of the iterator
585 587
    ///
586 588
    /// Returns the base node of the iterator
587 589
    Node baseNode(const IncEdgeIt &edge) const {
588 590
      return edge._direction ? u(edge) : v(edge);
589 591
    }
590 592
    /// Running node of the iterator
591 593
    ///
592 594
    /// Returns the running node of the iterator
593 595
    Node runningNode(const IncEdgeIt &edge) const {
594 596
      return edge._direction ? v(edge) : u(edge);
595 597
    }
596 598

	
597 599
    // Mappable extension
598 600

	
599 601
    template <typename _Value>
600 602
    class NodeMap
601 603
      : public MapExtender<DefaultMap<Graph, Node, _Value> > {
602 604
    public:
603 605
      typedef GraphExtender Graph;
604 606
      typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent;
605 607

	
606 608
      NodeMap(const Graph& graph)
607 609
        : Parent(graph) {}
608 610
      NodeMap(const Graph& graph, const _Value& value)
609 611
        : Parent(graph, value) {}
610 612

	
613
    private:
611 614
      NodeMap& operator=(const NodeMap& cmap) {
612 615
        return operator=<NodeMap>(cmap);
613 616
      }
614 617

	
615 618
      template <typename CMap>
616 619
      NodeMap& operator=(const CMap& cmap) {
617 620
        Parent::operator=(cmap);
618 621
        return *this;
619 622
      }
620 623

	
621 624
    };
622 625

	
623 626
    template <typename _Value>
624 627
    class ArcMap
625 628
      : public MapExtender<DefaultMap<Graph, Arc, _Value> > {
626 629
    public:
627 630
      typedef GraphExtender Graph;
628 631
      typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent;
629 632

	
630 633
      ArcMap(const Graph& graph)
631 634
        : Parent(graph) {}
632 635
      ArcMap(const Graph& graph, const _Value& value)
633 636
        : Parent(graph, value) {}
634 637

	
638
    private:
635 639
      ArcMap& operator=(const ArcMap& cmap) {
636 640
        return operator=<ArcMap>(cmap);
637 641
      }
638 642

	
639 643
      template <typename CMap>
640 644
      ArcMap& operator=(const CMap& cmap) {
641 645
        Parent::operator=(cmap);
642 646
        return *this;
643 647
      }
644 648
    };
645 649

	
646 650

	
647 651
    template <typename _Value>
648 652
    class EdgeMap
649 653
      : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
650 654
    public:
651 655
      typedef GraphExtender Graph;
652 656
      typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
653 657

	
654 658
      EdgeMap(const Graph& graph)
655 659
        : Parent(graph) {}
656 660

	
657 661
      EdgeMap(const Graph& graph, const _Value& value)
658 662
        : Parent(graph, value) {}
659 663

	
664
    private:
660 665
      EdgeMap& operator=(const EdgeMap& cmap) {
661 666
        return operator=<EdgeMap>(cmap);
662 667
      }
663 668

	
664 669
      template <typename CMap>
665 670
      EdgeMap& operator=(const CMap& cmap) {
666 671
        Parent::operator=(cmap);
667 672
        return *this;
668 673
      }
669 674

	
670 675
    };
671 676

	
672 677
    // Alteration extension
673 678

	
674 679
    Node addNode() {
675 680
      Node node = Parent::addNode();
676 681
      notifier(Node()).add(node);
677 682
      return node;
678 683
    }
679 684

	
680 685
    Edge addEdge(const Node& from, const Node& to) {
681 686
      Edge edge = Parent::addEdge(from, to);
682 687
      notifier(Edge()).add(edge);
683 688
      std::vector<Arc> ev;
684 689
      ev.push_back(Parent::direct(edge, true));
685 690
      ev.push_back(Parent::direct(edge, false));
686 691
      notifier(Arc()).add(ev);
687 692
      return edge;
688 693
    }
689 694

	
690 695
    void clear() {
691 696
      notifier(Arc()).clear();
692 697
      notifier(Edge()).clear();
693 698
      notifier(Node()).clear();
694 699
      Parent::clear();
695 700
    }
696 701

	
697 702
    template <typename Graph, typename NodeRefMap, typename EdgeRefMap>
698 703
    void build(const Graph& graph, NodeRefMap& nodeRef,
699 704
               EdgeRefMap& edgeRef) {
700 705
      Parent::build(graph, nodeRef, edgeRef);
701 706
      notifier(Node()).build();
702 707
      notifier(Edge()).build();
703 708
      notifier(Arc()).build();
704 709
    }
705 710

	
706 711
    void erase(const Node& node) {
707 712
      Arc arc;
Ignore white space 96 line context
... ...
@@ -17,106 +17,108 @@
17 17
 */
18 18

	
19 19
#ifndef LEMON_BITS_MAP_EXTENDER_H
20 20
#define LEMON_BITS_MAP_EXTENDER_H
21 21

	
22 22
#include <iterator>
23 23

	
24 24
#include <lemon/bits/traits.h>
25 25

	
26 26
#include <lemon/concept_check.h>
27 27
#include <lemon/concepts/maps.h>
28 28

	
29 29
///\file
30 30
///\brief Extenders for iterable maps.
31 31

	
32 32
namespace lemon {
33 33

	
34 34
  /// \ingroup graphbits
35 35
  ///
36 36
  /// \brief Extender for maps
37 37
  template <typename _Map>
38 38
  class MapExtender : public _Map {
39 39
  public:
40 40

	
41 41
    typedef _Map Parent;
42 42
    typedef MapExtender Map;
43 43

	
44 44

	
45 45
    typedef typename Parent::Graph Graph;
46 46
    typedef typename Parent::Key Item;
47 47

	
48 48
    typedef typename Parent::Key Key;
49 49
    typedef typename Parent::Value Value;
50 50

	
51 51
    class MapIt;
52 52
    class ConstMapIt;
53 53

	
54 54
    friend class MapIt;
55 55
    friend class ConstMapIt;
56 56

	
57 57
  public:
58 58

	
59 59
    MapExtender(const Graph& graph)
60 60
      : Parent(graph) {}
61 61

	
62 62
    MapExtender(const Graph& graph, const Value& value)
63 63
      : Parent(graph, value) {}
64 64

	
65
  private:
65 66
    MapExtender& operator=(const MapExtender& cmap) {
66 67
      return operator=<MapExtender>(cmap);
67 68
    }
68 69

	
69 70
    template <typename CMap>
70 71
    MapExtender& operator=(const CMap& cmap) {
71 72
      Parent::operator=(cmap);
72 73
      return *this;
73 74
    }
74 75

	
76
  public:
75 77
    class MapIt : public Item {
76 78
    public:
77 79

	
78 80
      typedef Item Parent;
79 81
      typedef typename Map::Value Value;
80 82

	
81 83
      MapIt() {}
82 84

	
83 85
      MapIt(Invalid i) : Parent(i) { }
84 86

	
85 87
      explicit MapIt(Map& _map) : map(_map) {
86 88
        map.notifier()->first(*this);
87 89
      }
88 90

	
89 91
      MapIt(const Map& _map, const Item& item)
90 92
        : Parent(item), map(_map) {}
91 93

	
92 94
      MapIt& operator++() {
93 95
        map.notifier()->next(*this);
94 96
        return *this;
95 97
      }
96 98

	
97 99
      typename MapTraits<Map>::ConstReturnValue operator*() const {
98 100
        return map[*this];
99 101
      }
100 102

	
101 103
      typename MapTraits<Map>::ReturnValue operator*() {
102 104
        return map[*this];
103 105
      }
104 106

	
105 107
      void set(const Value& value) {
106 108
        map.set(*this, value);
107 109
      }
108 110

	
109 111
    protected:
110 112
      Map& map;
111 113

	
112 114
    };
113 115

	
114 116
    class ConstMapIt : public Item {
115 117
    public:
116 118

	
117 119
      typedef Item Parent;
118 120

	
119 121
      typedef typename Map::Value Value;
120 122

	
121 123
      ConstMapIt() {}
122 124

	
... ...
@@ -155,110 +157,112 @@
155 157
        map.notifier()->first(*this);
156 158
      }
157 159

	
158 160
      ItemIt(const Map& _map, const Item& item)
159 161
        : Parent(item), map(_map) {}
160 162

	
161 163
      ItemIt& operator++() {
162 164
        map.notifier()->next(*this);
163 165
        return *this;
164 166
      }
165 167

	
166 168
    protected:
167 169
      const Map& map;
168 170

	
169 171
    };
170 172
  };
171 173

	
172 174
  /// \ingroup graphbits
173 175
  ///
174 176
  /// \brief Extender for maps which use a subset of the items.
175 177
  template <typename _Graph, typename _Map>
176 178
  class SubMapExtender : public _Map {
177 179
  public:
178 180

	
179 181
    typedef _Map Parent;
180 182
    typedef SubMapExtender Map;
181 183

	
182 184
    typedef _Graph Graph;
183 185

	
184 186
    typedef typename Parent::Key Item;
185 187

	
186 188
    typedef typename Parent::Key Key;
187 189
    typedef typename Parent::Value Value;
188 190

	
189 191
    class MapIt;
190 192
    class ConstMapIt;
191 193

	
192 194
    friend class MapIt;
193 195
    friend class ConstMapIt;
194 196

	
195 197
  public:
196 198

	
197 199
    SubMapExtender(const Graph& _graph)
198 200
      : Parent(_graph), graph(_graph) {}
199 201

	
200 202
    SubMapExtender(const Graph& _graph, const Value& _value)
201 203
      : Parent(_graph, _value), graph(_graph) {}
202 204

	
205
  private:
203 206
    SubMapExtender& operator=(const SubMapExtender& cmap) {
204 207
      return operator=<MapExtender>(cmap);
205 208
    }
206 209

	
207 210
    template <typename CMap>
208 211
    SubMapExtender& operator=(const CMap& cmap) {
209 212
      checkConcept<concepts::ReadMap<Key, Value>, CMap>();
210 213
      Item it;
211 214
      for (graph.first(it); it != INVALID; graph.next(it)) {
212 215
        Parent::set(it, cmap[it]);
213 216
      }
214 217
      return *this;
215 218
    }
216 219

	
220
  public:
217 221
    class MapIt : public Item {
218 222
    public:
219 223

	
220 224
      typedef Item Parent;
221 225
      typedef typename Map::Value Value;
222 226

	
223 227
      MapIt() {}
224 228

	
225 229
      MapIt(Invalid i) : Parent(i) { }
226 230

	
227 231
      explicit MapIt(Map& _map) : map(_map) {
228 232
        map.graph.first(*this);
229 233
      }
230 234

	
231 235
      MapIt(const Map& _map, const Item& item)
232 236
        : Parent(item), map(_map) {}
233 237

	
234 238
      MapIt& operator++() {
235 239
        map.graph.next(*this);
236 240
        return *this;
237 241
      }
238 242

	
239 243
      typename MapTraits<Map>::ConstReturnValue operator*() const {
240 244
        return map[*this];
241 245
      }
242 246

	
243 247
      typename MapTraits<Map>::ReturnValue operator*() {
244 248
        return map[*this];
245 249
      }
246 250

	
247 251
      void set(const Value& value) {
248 252
        map.set(*this, value);
249 253
      }
250 254

	
251 255
    protected:
252 256
      Map& map;
253 257

	
254 258
    };
255 259

	
256 260
    class ConstMapIt : public Item {
257 261
    public:
258 262

	
259 263
      typedef Item Parent;
260 264

	
261 265
      typedef typename Map::Value Value;
262 266

	
263 267
      ConstMapIt() {}
264 268

	
Ignore white space 6 line context
... ...
@@ -55,96 +55,97 @@
55 55
    typedef std::vector<_Value> Container;
56 56

	
57 57
  public:
58 58

	
59 59
    /// The graph type of the map.
60 60
    typedef _Graph Graph;
61 61
    /// The item type of the map.
62 62
    typedef _Item Item;
63 63
    /// The reference map tag.
64 64
    typedef True ReferenceMapTag;
65 65

	
66 66
    /// The key type of the map.
67 67
    typedef _Item Key;
68 68
    /// The value type of the map.
69 69
    typedef _Value Value;
70 70

	
71 71
    /// The notifier type.
72 72
    typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
73 73

	
74 74
    /// The map type.
75 75
    typedef VectorMap Map;
76 76
    /// The base class of the map.
77 77
    typedef typename Notifier::ObserverBase Parent;
78 78

	
79 79
    /// The reference type of the map;
80 80
    typedef typename Container::reference Reference;
81 81
    /// The const reference type of the map;
82 82
    typedef typename Container::const_reference ConstReference;
83 83

	
84 84

	
85 85
    /// \brief Constructor to attach the new map into the notifier.
86 86
    ///
87 87
    /// It constructs a map and attachs it into the notifier.
88 88
    /// It adds all the items of the graph to the map.
89 89
    VectorMap(const Graph& graph) {
90 90
      Parent::attach(graph.notifier(Item()));
91 91
      container.resize(Parent::notifier()->maxId() + 1);
92 92
    }
93 93

	
94 94
    /// \brief Constructor uses given value to initialize the map.
95 95
    ///
96 96
    /// It constructs a map uses a given value to initialize the map.
97 97
    /// It adds all the items of the graph to the map.
98 98
    VectorMap(const Graph& graph, const Value& value) {
99 99
      Parent::attach(graph.notifier(Item()));
100 100
      container.resize(Parent::notifier()->maxId() + 1, value);
101 101
    }
102 102

	
103
  private:
103 104
    /// \brief Copy constructor
104 105
    ///
105 106
    /// Copy constructor.
106 107
    VectorMap(const VectorMap& _copy) : Parent() {
107 108
      if (_copy.attached()) {
108 109
        Parent::attach(*_copy.notifier());
109 110
        container = _copy.container;
110 111
      }
111 112
    }
112 113

	
113 114
    /// \brief Assign operator.
114 115
    ///
115 116
    /// This operator assigns for each item in the map the
116 117
    /// value mapped to the same item in the copied map.
117 118
    /// The parameter map should be indiced with the same
118 119
    /// itemset because this assign operator does not change
119 120
    /// the container of the map.
120 121
    VectorMap& operator=(const VectorMap& cmap) {
121 122
      return operator=<VectorMap>(cmap);
122 123
    }
123 124

	
124 125

	
125 126
    /// \brief Template assign operator.
126 127
    ///
127 128
    /// The given parameter should be conform to the ReadMap
128 129
    /// concecpt and could be indiced by the current item set of
129 130
    /// the NodeMap. In this case the value for each item
130 131
    /// is assigned by the value of the given ReadMap.
131 132
    template <typename CMap>
132 133
    VectorMap& operator=(const CMap& cmap) {
133 134
      checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
134 135
      const typename Parent::Notifier* nf = Parent::notifier();
135 136
      Item it;
136 137
      for (nf->first(it); it != INVALID; nf->next(it)) {
137 138
        set(it, cmap[it]);
138 139
      }
139 140
      return *this;
140 141
    }
141 142

	
142 143
  public:
143 144

	
144 145
    /// \brief The subcript operator.
145 146
    ///
146 147
    /// The subscript operator. The map can be subscripted by the
147 148
    /// actual items of the graph.
148 149
    Reference operator[](const Key& key) {
149 150
      return container[Parent::notifier()->id(key)];
150 151
    }
Ignore white space 6 line context
... ...
@@ -389,97 +389,99 @@
389 389

	
390 390
      // Dummy parameter.
391 391
      int maxId(Node) const { return -1; }
392 392
      // Dummy parameter.
393 393
      int maxId(Arc) const { return -1; }
394 394

	
395 395
      /// \brief The base node of the iterator.
396 396
      ///
397 397
      /// Gives back the base node of the iterator.
398 398
      /// It is always the target of the pointed arc.
399 399
      Node baseNode(const InArcIt&) const { return INVALID; }
400 400

	
401 401
      /// \brief The running node of the iterator.
402 402
      ///
403 403
      /// Gives back the running node of the iterator.
404 404
      /// It is always the source of the pointed arc.
405 405
      Node runningNode(const InArcIt&) const { return INVALID; }
406 406

	
407 407
      /// \brief The base node of the iterator.
408 408
      ///
409 409
      /// Gives back the base node of the iterator.
410 410
      /// It is always the source of the pointed arc.
411 411
      Node baseNode(const OutArcIt&) const { return INVALID; }
412 412

	
413 413
      /// \brief The running node of the iterator.
414 414
      ///
415 415
      /// Gives back the running node of the iterator.
416 416
      /// It is always the target of the pointed arc.
417 417
      Node runningNode(const OutArcIt&) const { return INVALID; }
418 418

	
419 419
      /// \brief The opposite node on the given arc.
420 420
      ///
421 421
      /// Gives back the opposite node on the given arc.
422 422
      Node oppositeNode(const Node&, const Arc&) const { return INVALID; }
423 423

	
424 424
      /// \brief Read write map of the nodes to type \c T.
425 425
      ///
426 426
      /// ReadWrite map of the nodes to type \c T.
427 427
      /// \sa Reference
428 428
      template<class T>
429 429
      class NodeMap : public ReadWriteMap< Node, T > {
430 430
      public:
431 431

	
432 432
        ///\e
433 433
        NodeMap(const Digraph&) { }
434 434
        ///\e
435 435
        NodeMap(const Digraph&, T) { }
436 436

	
437
      private:
437 438
        ///Copy constructor
438 439
        NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
439 440
        ///Assignment operator
440 441
        template <typename CMap>
441 442
        NodeMap& operator=(const CMap&) {
442 443
          checkConcept<ReadMap<Node, T>, CMap>();
443 444
          return *this;
444 445
        }
445 446
      };
446 447

	
447 448
      /// \brief Read write map of the arcs to type \c T.
448 449
      ///
449 450
      /// Reference map of the arcs to type \c T.
450 451
      /// \sa Reference
451 452
      template<class T>
452 453
      class ArcMap : public ReadWriteMap<Arc,T> {
453 454
      public:
454 455

	
455 456
        ///\e
456 457
        ArcMap(const Digraph&) { }
457 458
        ///\e
458 459
        ArcMap(const Digraph&, T) { }
460
      private:
459 461
        ///Copy constructor
460 462
        ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { }
461 463
        ///Assignment operator
462 464
        template <typename CMap>
463 465
        ArcMap& operator=(const CMap&) {
464 466
          checkConcept<ReadMap<Arc, T>, CMap>();
465 467
          return *this;
466 468
        }
467 469
      };
468 470

	
469 471
      template <typename _Digraph>
470 472
      struct Constraints {
471 473
        void constraints() {
472 474
          checkConcept<IterableDigraphComponent<>, _Digraph>();
473 475
          checkConcept<IDableDigraphComponent<>, _Digraph>();
474 476
          checkConcept<MappableDigraphComponent<>, _Digraph>();
475 477
        }
476 478
      };
477 479

	
478 480
    };
479 481

	
480 482
  } //namespace concepts
481 483
} //namespace lemon
482 484

	
483 485

	
484 486

	
485 487
#endif // LEMON_CONCEPT_DIGRAPH_H
Ignore white space 6 line context
... ...
@@ -467,142 +467,145 @@
467 467
        InArcIt() { }
468 468
        /// Copy constructor.
469 469

	
470 470
        /// Copy constructor.
471 471
        ///
472 472
        InArcIt(const InArcIt& e) : Arc(e) { }
473 473
        /// Initialize the iterator to be invalid.
474 474

	
475 475
        /// Initialize the iterator to be invalid.
476 476
        ///
477 477
        InArcIt(Invalid) { }
478 478
        /// This constructor sets the iterator to first incoming arc.
479 479

	
480 480
        /// This constructor set the iterator to the first incoming arc of
481 481
        /// the node.
482 482
        ///@param n the node
483 483
        ///@param g the graph
484 484
        InArcIt(const Graph& g, const Node& n) {
485 485
          ignore_unused_variable_warning(n);
486 486
          ignore_unused_variable_warning(g);
487 487
        }
488 488
        /// Arc -> InArcIt conversion
489 489

	
490 490
        /// Sets the iterator to the value of the trivial iterator \c e.
491 491
        /// This feature necessitates that each time we
492 492
        /// iterate the arc-set, the iteration order is the same.
493 493
        InArcIt(const Graph&, const Arc&) { }
494 494
        /// Next incoming arc
495 495

	
496 496
        /// Assign the iterator to the next inarc of the corresponding node.
497 497
        ///
498 498
        InArcIt& operator++() { return *this; }
499 499
      };
500 500

	
501 501
      /// \brief Read write map of the nodes to type \c T.
502 502
      ///
503 503
      /// ReadWrite map of the nodes to type \c T.
504 504
      /// \sa Reference
505 505
      template<class T>
506 506
      class NodeMap : public ReadWriteMap< Node, T >
507 507
      {
508 508
      public:
509 509

	
510 510
        ///\e
511 511
        NodeMap(const Graph&) { }
512 512
        ///\e
513 513
        NodeMap(const Graph&, T) { }
514 514

	
515
      private:
515 516
        ///Copy constructor
516 517
        NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
517 518
        ///Assignment operator
518 519
        template <typename CMap>
519 520
        NodeMap& operator=(const CMap&) {
520 521
          checkConcept<ReadMap<Node, T>, CMap>();
521 522
          return *this;
522 523
        }
523 524
      };
524 525

	
525 526
      /// \brief Read write map of the directed arcs to type \c T.
526 527
      ///
527 528
      /// Reference map of the directed arcs to type \c T.
528 529
      /// \sa Reference
529 530
      template<class T>
530 531
      class ArcMap : public ReadWriteMap<Arc,T>
531 532
      {
532 533
      public:
533 534

	
534 535
        ///\e
535 536
        ArcMap(const Graph&) { }
536 537
        ///\e
537 538
        ArcMap(const Graph&, T) { }
539
      private:
538 540
        ///Copy constructor
539 541
        ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { }
540 542
        ///Assignment operator
541 543
        template <typename CMap>
542 544
        ArcMap& operator=(const CMap&) {
543 545
          checkConcept<ReadMap<Arc, T>, CMap>();
544 546
          return *this;
545 547
        }
546 548
      };
547 549

	
548 550
      /// Read write map of the edges to type \c T.
549 551

	
550 552
      /// Reference map of the arcs to type \c T.
551 553
      /// \sa Reference
552 554
      template<class T>
553 555
      class EdgeMap : public ReadWriteMap<Edge,T>
554 556
      {
555 557
      public:
556 558

	
557 559
        ///\e
558 560
        EdgeMap(const Graph&) { }
559 561
        ///\e
560 562
        EdgeMap(const Graph&, T) { }
563
      private:
561 564
        ///Copy constructor
562 565
        EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) {}
563 566
        ///Assignment operator
564 567
        template <typename CMap>
565 568
        EdgeMap& operator=(const CMap&) {
566 569
          checkConcept<ReadMap<Edge, T>, CMap>();
567 570
          return *this;
568 571
        }
569 572
      };
570 573

	
571 574
      /// \brief Direct the given edge.
572 575
      ///
573 576
      /// Direct the given edge. The returned arc source
574 577
      /// will be the given node.
575 578
      Arc direct(const Edge&, const Node&) const {
576 579
        return INVALID;
577 580
      }
578 581

	
579 582
      /// \brief Direct the given edge.
580 583
      ///
581 584
      /// Direct the given edge. The returned arc
582 585
      /// represents the given edge and the direction comes
583 586
      /// from the bool parameter. The source of the edge and
584 587
      /// the directed arc is the same when the given bool is true.
585 588
      Arc direct(const Edge&, bool) const {
586 589
        return INVALID;
587 590
      }
588 591

	
589 592
      /// \brief Returns true if the arc has default orientation.
590 593
      ///
591 594
      /// Returns whether the given directed arc is same orientation as
592 595
      /// the corresponding edge's default orientation.
593 596
      bool direction(Arc) const { return true; }
594 597

	
595 598
      /// \brief Returns the opposite directed arc.
596 599
      ///
597 600
      /// Returns the opposite directed arc.
598 601
      Arc oppositeArc(Arc) const { return INVALID; }
599 602

	
600 603
      /// \brief Opposite node on an arc
601 604
      ///
602 605
      /// \return the opposite of the given Node on the given Edge
603 606
      Node oppositeNode(Node, Edge) const { return INVALID; }
604 607

	
605 608
      /// \brief First node of the edge.
606 609
      ///
607 610
      /// \return the first node of the given Edge.
608 611
      ///
Ignore white space 6 line context
... ...
@@ -960,306 +960,313 @@
960 960
      /// \brief Gives back the arc alteration notifier.
961 961
      ///
962 962
      /// Gives back the arc alteration notifier.
963 963
      EdgeNotifier& notifier(Edge) const {
964 964
        return EdgeNotifier();
965 965
      }
966 966

	
967 967
      template <typename _Graph>
968 968
      struct Constraints {
969 969
        void constraints() {
970 970
          checkConcept<AlterableGraphComponent<Base>, _Graph>();
971 971
          typename _Graph::EdgeNotifier& uen
972 972
            = graph.notifier(typename _Graph::Edge());
973 973
          ignore_unused_variable_warning(uen);
974 974
        }
975 975

	
976 976
        const _Graph& graph;
977 977

	
978 978
      };
979 979

	
980 980
    };
981 981

	
982 982
    /// \brief Class describing the concept of graph maps
983 983
    ///
984 984
    /// This class describes the common interface of the graph maps
985 985
    /// (NodeMap, ArcMap), that is \ref maps-page "maps" which can be used to
986 986
    /// associate data to graph descriptors (nodes or arcs).
987 987
    template <typename _Graph, typename _Item, typename _Value>
988 988
    class GraphMap : public ReadWriteMap<_Item, _Value> {
989 989
    public:
990 990

	
991 991
      typedef ReadWriteMap<_Item, _Value> Parent;
992 992

	
993 993
      /// The graph type of the map.
994 994
      typedef _Graph Graph;
995 995
      /// The key type of the map.
996 996
      typedef _Item Key;
997 997
      /// The value type of the map.
998 998
      typedef _Value Value;
999 999

	
1000 1000
      /// \brief Construct a new map.
1001 1001
      ///
1002 1002
      /// Construct a new map for the graph.
1003 1003
      explicit GraphMap(const Graph&) {}
1004 1004
      /// \brief Construct a new map with default value.
1005 1005
      ///
1006 1006
      /// Construct a new map for the graph and initalise the values.
1007 1007
      GraphMap(const Graph&, const Value&) {}
1008

	
1009
    private:
1008 1010
      /// \brief Copy constructor.
1009 1011
      ///
1010 1012
      /// Copy Constructor.
1011 1013
      GraphMap(const GraphMap&) : Parent() {}
1012 1014

	
1013 1015
      /// \brief Assign operator.
1014 1016
      ///
1015 1017
      /// Assign operator. It does not mofify the underlying graph,
1016 1018
      /// it just iterates on the current item set and set the  map
1017 1019
      /// with the value returned by the assigned map.
1018 1020
      template <typename CMap>
1019 1021
      GraphMap& operator=(const CMap&) {
1020 1022
        checkConcept<ReadMap<Key, Value>, CMap>();
1021 1023
        return *this;
1022 1024
      }
1023 1025

	
1026
    public:
1024 1027
      template<typename _Map>
1025 1028
      struct Constraints {
1026 1029
        void constraints() {
1027 1030
          checkConcept<ReadWriteMap<Key, Value>, _Map >();
1028 1031
          // Construction with a graph parameter
1029 1032
          _Map a(g);
1030 1033
          // Constructor with a graph and a default value parameter
1031 1034
          _Map a2(g,t);
1032 1035
          // Copy constructor.
1033
          _Map b(c);
1036
          // _Map b(c);
1034 1037

	
1035
          ReadMap<Key, Value> cmap;
1036
          b = cmap;
1038
          // ReadMap<Key, Value> cmap;
1039
          // b = cmap;
1037 1040

	
1041
          ignore_unused_variable_warning(a);
1038 1042
          ignore_unused_variable_warning(a2);
1039
          ignore_unused_variable_warning(b);
1043
          // ignore_unused_variable_warning(b);
1040 1044
        }
1041 1045

	
1042 1046
        const _Map &c;
1043 1047
        const Graph &g;
1044 1048
        const typename GraphMap::Value &t;
1045 1049
      };
1046 1050

	
1047 1051
    };
1048 1052

	
1049 1053
    /// \brief An empty mappable digraph class.
1050 1054
    ///
1051 1055
    /// This class provides beside the core digraph features
1052 1056
    /// map interface for the digraph structure.
1053 1057
    /// This concept is part of the Digraph concept.
1054 1058
    template <typename _Base = BaseDigraphComponent>
1055 1059
    class MappableDigraphComponent : public _Base  {
1056 1060
    public:
1057 1061

	
1058 1062
      typedef _Base Base;
1059 1063
      typedef typename Base::Node Node;
1060 1064
      typedef typename Base::Arc Arc;
1061 1065

	
1062 1066
      typedef MappableDigraphComponent Digraph;
1063 1067

	
1064 1068
      /// \brief ReadWrite map of the nodes.
1065 1069
      ///
1066 1070
      /// ReadWrite map of the nodes.
1067 1071
      ///
1068 1072
      template <typename _Value>
1069 1073
      class NodeMap : public GraphMap<Digraph, Node, _Value> {
1070 1074
      public:
1071 1075
        typedef GraphMap<MappableDigraphComponent, Node, _Value> Parent;
1072 1076

	
1073 1077
        /// \brief Construct a new map.
1074 1078
        ///
1075 1079
        /// Construct a new map for the digraph.
1076 1080
        explicit NodeMap(const MappableDigraphComponent& digraph)
1077 1081
          : Parent(digraph) {}
1078 1082

	
1079 1083
        /// \brief Construct a new map with default value.
1080 1084
        ///
1081 1085
        /// Construct a new map for the digraph and initalise the values.
1082 1086
        NodeMap(const MappableDigraphComponent& digraph, const _Value& value)
1083 1087
          : Parent(digraph, value) {}
1084 1088

	
1089
      private:
1085 1090
        /// \brief Copy constructor.
1086 1091
        ///
1087 1092
        /// Copy Constructor.
1088 1093
        NodeMap(const NodeMap& nm) : Parent(nm) {}
1089 1094

	
1090 1095
        /// \brief Assign operator.
1091 1096
        ///
1092 1097
        /// Assign operator.
1093 1098
        template <typename CMap>
1094 1099
        NodeMap& operator=(const CMap&) {
1095 1100
          checkConcept<ReadMap<Node, _Value>, CMap>();
1096 1101
          return *this;
1097 1102
        }
1098 1103

	
1099 1104
      };
1100 1105

	
1101 1106
      /// \brief ReadWrite map of the arcs.
1102 1107
      ///
1103 1108
      /// ReadWrite map of the arcs.
1104 1109
      ///
1105 1110
      template <typename _Value>
1106 1111
      class ArcMap : public GraphMap<Digraph, Arc, _Value> {
1107 1112
      public:
1108 1113
        typedef GraphMap<MappableDigraphComponent, Arc, _Value> Parent;
1109 1114

	
1110 1115
        /// \brief Construct a new map.
1111 1116
        ///
1112 1117
        /// Construct a new map for the digraph.
1113 1118
        explicit ArcMap(const MappableDigraphComponent& digraph)
1114 1119
          : Parent(digraph) {}
1115 1120

	
1116 1121
        /// \brief Construct a new map with default value.
1117 1122
        ///
1118 1123
        /// Construct a new map for the digraph and initalise the values.
1119 1124
        ArcMap(const MappableDigraphComponent& digraph, const _Value& value)
1120 1125
          : Parent(digraph, value) {}
1121 1126

	
1127
      private:
1122 1128
        /// \brief Copy constructor.
1123 1129
        ///
1124 1130
        /// Copy Constructor.
1125 1131
        ArcMap(const ArcMap& nm) : Parent(nm) {}
1126 1132

	
1127 1133
        /// \brief Assign operator.
1128 1134
        ///
1129 1135
        /// Assign operator.
1130 1136
        template <typename CMap>
1131 1137
        ArcMap& operator=(const CMap&) {
1132 1138
          checkConcept<ReadMap<Arc, _Value>, CMap>();
1133 1139
          return *this;
1134 1140
        }
1135 1141

	
1136 1142
      };
1137 1143

	
1138 1144

	
1139 1145
      template <typename _Digraph>
1140 1146
      struct Constraints {
1141 1147

	
1142 1148
        struct Dummy {
1143 1149
          int value;
1144 1150
          Dummy() : value(0) {}
1145 1151
          Dummy(int _v) : value(_v) {}
1146 1152
        };
1147 1153

	
1148 1154
        void constraints() {
1149 1155
          checkConcept<Base, _Digraph>();
1150 1156
          { // int map test
1151 1157
            typedef typename _Digraph::template NodeMap<int> IntNodeMap;
1152 1158
            checkConcept<GraphMap<_Digraph, typename _Digraph::Node, int>,
1153 1159
              IntNodeMap >();
1154 1160
          } { // bool map test
1155 1161
            typedef typename _Digraph::template NodeMap<bool> BoolNodeMap;
1156 1162
            checkConcept<GraphMap<_Digraph, typename _Digraph::Node, bool>,
1157 1163
              BoolNodeMap >();
1158 1164
          } { // Dummy map test
1159 1165
            typedef typename _Digraph::template NodeMap<Dummy> DummyNodeMap;
1160 1166
            checkConcept<GraphMap<_Digraph, typename _Digraph::Node, Dummy>,
1161 1167
              DummyNodeMap >();
1162 1168
          }
1163 1169

	
1164 1170
          { // int map test
1165 1171
            typedef typename _Digraph::template ArcMap<int> IntArcMap;
1166 1172
            checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, int>,
1167 1173
              IntArcMap >();
1168 1174
          } { // bool map test
1169 1175
            typedef typename _Digraph::template ArcMap<bool> BoolArcMap;
1170 1176
            checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, bool>,
1171 1177
              BoolArcMap >();
1172 1178
          } { // Dummy map test
1173 1179
            typedef typename _Digraph::template ArcMap<Dummy> DummyArcMap;
1174 1180
            checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, Dummy>,
1175 1181
              DummyArcMap >();
1176 1182
          }
1177 1183
        }
1178 1184

	
1179 1185
        _Digraph& digraph;
1180 1186
      };
1181 1187
    };
1182 1188

	
1183 1189
    /// \brief An empty mappable base bipartite graph class.
1184 1190
    ///
1185 1191
    /// This class provides beside the core graph features
1186 1192
    /// map interface for the graph structure.
1187 1193
    /// This concept is part of the Graph concept.
1188 1194
    template <typename _Base = BaseGraphComponent>
1189 1195
    class MappableGraphComponent : public MappableDigraphComponent<_Base>  {
1190 1196
    public:
1191 1197

	
1192 1198
      typedef _Base Base;
1193 1199
      typedef typename Base::Edge Edge;
1194 1200

	
1195 1201
      typedef MappableGraphComponent Graph;
1196 1202

	
1197 1203
      /// \brief ReadWrite map of the edges.
1198 1204
      ///
1199 1205
      /// ReadWrite map of the edges.
1200 1206
      ///
1201 1207
      template <typename _Value>
1202 1208
      class EdgeMap : public GraphMap<Graph, Edge, _Value> {
1203 1209
      public:
1204 1210
        typedef GraphMap<MappableGraphComponent, Edge, _Value> Parent;
1205 1211

	
1206 1212
        /// \brief Construct a new map.
1207 1213
        ///
1208 1214
        /// Construct a new map for the graph.
1209 1215
        explicit EdgeMap(const MappableGraphComponent& graph)
1210 1216
          : Parent(graph) {}
1211 1217

	
1212 1218
        /// \brief Construct a new map with default value.
1213 1219
        ///
1214 1220
        /// Construct a new map for the graph and initalise the values.
1215 1221
        EdgeMap(const MappableGraphComponent& graph, const _Value& value)
1216 1222
          : Parent(graph, value) {}
1217 1223

	
1224
      private:
1218 1225
        /// \brief Copy constructor.
1219 1226
        ///
1220 1227
        /// Copy Constructor.
1221 1228
        EdgeMap(const EdgeMap& nm) : Parent(nm) {}
1222 1229

	
1223 1230
        /// \brief Assign operator.
1224 1231
        ///
1225 1232
        /// Assign operator.
1226 1233
        template <typename CMap>
1227 1234
        EdgeMap& operator=(const CMap&) {
1228 1235
          checkConcept<ReadMap<Edge, _Value>, CMap>();
1229 1236
          return *this;
1230 1237
        }
1231 1238

	
1232 1239
      };
1233 1240

	
1234 1241

	
1235 1242
      template <typename _Graph>
1236 1243
      struct Constraints {
1237 1244

	
1238 1245
        struct Dummy {
1239 1246
          int value;
1240 1247
          Dummy() : value(0) {}
1241 1248
          Dummy(int _v) : value(_v) {}
1242 1249
        };
1243 1250

	
1244 1251
        void constraints() {
1245 1252
          checkConcept<MappableGraphComponent<Base>, _Graph>();
1246 1253

	
1247 1254
          { // int map test
1248 1255
            typedef typename _Graph::template EdgeMap<int> IntEdgeMap;
1249 1256
            checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>,
1250 1257
              IntEdgeMap >();
1251 1258
          } { // bool map test
1252 1259
            typedef typename _Graph::template EdgeMap<bool> BoolEdgeMap;
1253 1260
            checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>,
1254 1261
              BoolEdgeMap >();
1255 1262
          } { // Dummy map test
1256 1263
            typedef typename _Graph::template EdgeMap<Dummy> DummyEdgeMap;
1257 1264
            checkConcept<GraphMap<_Graph, typename _Graph::Edge, Dummy>,
1258 1265
              DummyEdgeMap >();
1259 1266
          }
1260 1267
        }
1261 1268

	
1262 1269
        _Graph& graph;
1263 1270
      };
1264 1271
    };
1265 1272

	
Ignore white space 6 line context
... ...
@@ -167,118 +167,118 @@
167 167
  }
168 168

	
169 169
  template <typename Graph>
170 170
  void checkArcIds(const Graph& G) {
171 171
    std::set<int> values;
172 172
    for (typename Graph::ArcIt a(G); a != INVALID; ++a) {
173 173
      check(G.arcFromId(G.id(a)) == a, "Wrong id");
174 174
      check(values.find(G.id(a)) == values.end(), "Wrong id");
175 175
      check(G.id(a) <= G.maxArcId(), "Wrong maximum id");
176 176
      values.insert(G.id(a));
177 177
    }
178 178
  }
179 179

	
180 180
  template <typename Graph>
181 181
  void checkEdgeIds(const Graph& G) {
182 182
    std::set<int> values;
183 183
    for (typename Graph::EdgeIt e(G); e != INVALID; ++e) {
184 184
      check(G.edgeFromId(G.id(e)) == e, "Wrong id");
185 185
      check(values.find(G.id(e)) == values.end(), "Wrong id");
186 186
      check(G.id(e) <= G.maxEdgeId(), "Wrong maximum id");
187 187
      values.insert(G.id(e));
188 188
    }
189 189
  }
190 190

	
191 191
  template <typename Graph>
192 192
  void checkGraphNodeMap(const Graph& G) {
193 193
    typedef typename Graph::Node Node;
194 194
    typedef typename Graph::NodeIt NodeIt;
195 195

	
196 196
    typedef typename Graph::template NodeMap<int> IntNodeMap;
197 197
    IntNodeMap map(G, 42);
198 198
    for (NodeIt it(G); it != INVALID; ++it) {
199 199
      check(map[it] == 42, "Wrong map constructor.");
200 200
    }
201 201
    int s = 0;
202 202
    for (NodeIt it(G); it != INVALID; ++it) {
203 203
      map[it] = 0;
204 204
      check(map[it] == 0, "Wrong operator[].");
205 205
      map.set(it, s);
206 206
      check(map[it] == s, "Wrong set.");
207 207
      ++s;
208 208
    }
209 209
    s = s * (s - 1) / 2;
210 210
    for (NodeIt it(G); it != INVALID; ++it) {
211 211
      s -= map[it];
212 212
    }
213 213
    check(s == 0, "Wrong sum.");
214 214

	
215
    map = constMap<Node>(12);
216
    for (NodeIt it(G); it != INVALID; ++it) {
217
      check(map[it] == 12, "Wrong operator[].");
218
    }
215
    // map = constMap<Node>(12);
216
    // for (NodeIt it(G); it != INVALID; ++it) {
217
    //   check(map[it] == 12, "Wrong operator[].");
218
    // }
219 219
  }
220 220

	
221 221
  template <typename Graph>
222 222
  void checkGraphArcMap(const Graph& G) {
223 223
    typedef typename Graph::Arc Arc;
224 224
    typedef typename Graph::ArcIt ArcIt;
225 225

	
226 226
    typedef typename Graph::template ArcMap<int> IntArcMap;
227 227
    IntArcMap map(G, 42);
228 228
    for (ArcIt it(G); it != INVALID; ++it) {
229 229
      check(map[it] == 42, "Wrong map constructor.");
230 230
    }
231 231
    int s = 0;
232 232
    for (ArcIt it(G); it != INVALID; ++it) {
233 233
      map[it] = 0;
234 234
      check(map[it] == 0, "Wrong operator[].");
235 235
      map.set(it, s);
236 236
      check(map[it] == s, "Wrong set.");
237 237
      ++s;
238 238
    }
239 239
    s = s * (s - 1) / 2;
240 240
    for (ArcIt it(G); it != INVALID; ++it) {
241 241
      s -= map[it];
242 242
    }
243 243
    check(s == 0, "Wrong sum.");
244 244

	
245
    map = constMap<Arc>(12);
246
    for (ArcIt it(G); it != INVALID; ++it) {
247
      check(map[it] == 12, "Wrong operator[].");
248
    }
245
    // map = constMap<Arc>(12);
246
    // for (ArcIt it(G); it != INVALID; ++it) {
247
    //   check(map[it] == 12, "Wrong operator[].");
248
    // }
249 249
  }
250 250

	
251 251
  template <typename Graph>
252 252
  void checkGraphEdgeMap(const Graph& G) {
253 253
    typedef typename Graph::Edge Edge;
254 254
    typedef typename Graph::EdgeIt EdgeIt;
255 255

	
256 256
    typedef typename Graph::template EdgeMap<int> IntEdgeMap;
257 257
    IntEdgeMap map(G, 42);
258 258
    for (EdgeIt it(G); it != INVALID; ++it) {
259 259
      check(map[it] == 42, "Wrong map constructor.");
260 260
    }
261 261
    int s = 0;
262 262
    for (EdgeIt it(G); it != INVALID; ++it) {
263 263
      map[it] = 0;
264 264
      check(map[it] == 0, "Wrong operator[].");
265 265
      map.set(it, s);
266 266
      check(map[it] == s, "Wrong set.");
267 267
      ++s;
268 268
    }
269 269
    s = s * (s - 1) / 2;
270 270
    for (EdgeIt it(G); it != INVALID; ++it) {
271 271
      s -= map[it];
272 272
    }
273 273
    check(s == 0, "Wrong sum.");
274 274

	
275
    map = constMap<Edge>(12);
276
    for (EdgeIt it(G); it != INVALID; ++it) {
277
      check(map[it] == 12, "Wrong operator[].");
278
    }
275
    // map = constMap<Edge>(12);
276
    // for (EdgeIt it(G); it != INVALID; ++it) {
277
    //   check(map[it] == 12, "Wrong operator[].");
278
    // }
279 279
  }
280 280

	
281 281

	
282 282
} //namespace lemon
283 283

	
284 284
#endif
0 comments (0 inline)