398 /// |
399 /// |
399 /// \param _Graph The graph type. |
400 /// \param _Graph The graph type. |
400 /// \param _Item One of the graph's item type, the key of the map. |
401 /// \param _Item One of the graph's item type, the key of the map. |
401 template <typename _Graph, typename _Item> |
402 template <typename _Graph, typename _Item> |
402 class IterableIntMap |
403 class IterableIntMap |
403 : protected DefaultMap<_Graph, _Item, _iterable_maps_bits:: |
404 : protected MapExtender<DefaultMap<_Graph, _Item, _iterable_maps_bits:: |
404 IterableIntMapNode<_Item> > { |
405 IterableIntMapNode<_Item> > >{ |
405 public: |
406 public: |
406 typedef DefaultMap<_Graph, _Item, _iterable_maps_bits:: |
407 typedef MapExtender<DefaultMap<_Graph, _Item, _iterable_maps_bits:: |
407 IterableIntMapNode<_Item> > |
408 IterableIntMapNode<_Item> > > Parent; |
408 Parent; |
|
409 |
409 |
410 /// The key type |
410 /// The key type |
411 typedef _Item Key; |
411 typedef _Item Key; |
412 /// The value type |
412 /// The value type |
413 typedef int Value; |
413 typedef int Value; |
687 /// \param _Graph The graph type. |
687 /// \param _Graph The graph type. |
688 /// \param _Item One of the graph's item type, the key of the map. |
688 /// \param _Item One of the graph's item type, the key of the map. |
689 /// \param _Value Any comparable value type. |
689 /// \param _Value Any comparable value type. |
690 template <typename _Graph, typename _Item, typename _Value> |
690 template <typename _Graph, typename _Item, typename _Value> |
691 class IterableValueMap |
691 class IterableValueMap |
692 : protected DefaultMap<_Graph, _Item, _iterable_maps_bits:: |
692 : protected MapExtender<DefaultMap<_Graph, _Item, _iterable_maps_bits:: |
693 IterableValueMapNode<_Item, _Value> > { |
693 IterableValueMapNode<_Item, _Value> > >{ |
694 public: |
694 public: |
695 typedef DefaultMap<_Graph, _Item, _iterable_maps_bits:: |
695 typedef MapExtender<DefaultMap<_Graph, _Item, _iterable_maps_bits:: |
696 IterableValueMapNode<_Item, _Value> > Parent; |
696 IterableValueMapNode<_Item, _Value> > > |
|
697 Parent; |
697 |
698 |
698 /// The key type |
699 /// The key type |
699 typedef _Item Key; |
700 typedef _Item Key; |
700 /// The value type |
701 /// The value type |
701 typedef _Value Value; |
702 typedef _Value Value; |
702 /// The graph type |
703 /// The graph type |
703 typedef _Graph Graph; |
704 typedef _Graph Graph; |
704 |
705 |
705 protected: |
|
706 |
|
707 typedef typename ItemSetTraits<_Graph, Key>::ItemIt KeyIt; |
|
708 |
|
709 public: |
706 public: |
710 |
707 |
711 /// \brief Constructor of the Map with a given value. |
708 /// \brief Constructor of the Map with a given value. |
712 /// |
709 /// |
713 /// Constructor of the Map with a given value. |
710 /// Constructor of the Map with a given value. |
714 explicit IterableValueMap(const Graph& graph, |
711 explicit IterableValueMap(const Graph& graph, |
715 const Value& value = Value()) |
712 const Value& value = Value()) |
716 : Parent(graph, _iterable_maps_bits:: |
713 : Parent(graph, _iterable_maps_bits:: |
717 IterableValueMapNode<_Item, _Value>(value)) { |
714 IterableValueMapNode<_Item, _Value>(value)) { |
718 for (KeyIt it(*Parent::getGraph()); it != INVALID; ++it) { |
715 for (typename Parent::ItemIt it(*this); it != INVALID; ++it) { |
719 lace(it); |
716 lace(it); |
720 } |
717 } |
721 } |
718 } |
722 |
719 |
723 protected: |
720 protected: |