COIN-OR::LEMON - Graph Library

Changeset 1999:2ff283124dfc in lemon-0.x for lemon/bits/map_extender.h


Ignore:
Timestamp:
03/06/06 11:28:37 (18 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2609
Message:

Clarifing alteration observing system
It is directly connected now to a container

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/map_extender.h

    r1996 r1999  
    3030
    3131  /// \ingroup graphbits
     32  ///
     33  /// \brief Extender for maps
    3234  template <typename _Map>
    33   class IterableMapExtender : public _Map {
     35  class MapExtender : public _Map {
    3436  public:
    3537
    3638    typedef _Map Parent;
    37     typedef IterableMapExtender Map;
     39    typedef MapExtender Map;
    3840
    3941
     
    5052    friend class ConstMapIt;
    5153
    52   protected:
    53 
    54     using Parent::getGraph;
    55 
    5654  public:
    5755
    58     IterableMapExtender(const Graph& graph) : Parent(graph) {}
     56    MapExtender(const Graph& graph)
     57      : Parent(graph) {}
    5958
    60     IterableMapExtender(const Graph& graph, const Value& value)
     59    MapExtender(const Graph& graph, const Value& value)
    6160      : Parent(graph, value) {}
    6261
    6362
    64     class MapIt : public ItemSetTraits<Graph, Item>::ItemIt {
     63    class MapIt : public Item {
    6564    public:
    6665     
    67       typedef typename ItemSetTraits<Graph, Item>::ItemIt Parent;
    68 
     66      typedef Item Parent;
    6967      typedef typename Map::Value Value;
    7068     
    71       MapIt(Map& _map) : Parent(*_map.getGraph()), map(_map) {}
     69      MapIt() {}
     70
     71      MapIt(Invalid i) : Parent(i) { }
     72
     73      explicit MapIt(Map& _map) : map(_map) {
     74        map.getNotifier()->first(*this);
     75      }
     76
     77      MapIt(const Map& _map, const Item& item)
     78        : Parent(item), map(_map) {}
     79
     80      MapIt& operator++() {
     81        map.getNotifier()->next(*this);
     82        return *this;
     83      }
    7284     
    7385      typename MapTraits<Map>::ConstReturnValue operator*() const {
     
    88100    };
    89101
    90     class ConstMapIt : public ItemSetTraits<Graph, Key>::ItemIt {
     102    class ConstMapIt : public Item {
    91103    public:
    92104
    93       typedef typename ItemSetTraits<Graph, Key>::ItemIt Parent;
     105      typedef Item Parent;
    94106
    95107      typedef typename Map::Value Value;
     108     
     109      ConstMapIt() {}
    96110
    97       ConstMapIt(const Map& _map) : Parent(*_map.getGraph()), map(_map) {}
     111      ConstMapIt(Invalid i) : Parent(i) { }
     112
     113      explicit ConstMapIt(Map& _map) : map(_map) {
     114        map.getNotifier()->first(*this);
     115      }
     116
     117      ConstMapIt(const Map& _map, const Item& item)
     118        : Parent(item), map(_map) {}
     119
     120      ConstMapIt& operator++() {
     121        map.getNotifier()->next(*this);
     122        return *this;
     123      }
    98124
    99125      typename MapTraits<Map>::ConstReturnValue operator*() const {
    100126        return map[*this];
    101127      }
     128
    102129    protected:
    103130      const Map& map;
    104131    };
    105132
    106     class ItemIt : public ItemSetTraits<Graph, Key>::ItemIt {
     133    class ItemIt : Item {
    107134    public:
    108135     
    109       typedef typename ItemSetTraits<Graph, Key>::ItemIt Parent;
     136      typedef Item Parent;
     137     
     138      ItemIt() {}
    110139
    111       ItemIt(Map& _map) : Parent(*_map.getGraph()) {}
     140      ItemIt(Invalid i) : Parent(i) { }
     141
     142      explicit ItemIt(Map& _map) : map(_map) {
     143        map->getNotifier()->first(*this);
     144      }
     145
     146      ItemIt(const Map& _map, const Item& item)
     147        : Parent(item), map(_map) {}
     148
     149      ItemIt& operator++() {
     150        map.getNotifier()->next(*this);
     151        return *this;
     152      }
     153
     154    protected:
     155      const Map& map;
    112156     
    113157    };
Note: See TracChangeset for help on using the changeset viewer.