COIN-OR::LEMON - Graph Library

Changeset 1842:8abf74160dc4 in lemon-0.x for lemon/bits/default_map.h


Ignore:
Timestamp:
12/01/05 16:08:46 (14 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2396
Message:

NewEdgeSetAdaptor? -> ListEdgeSet?
and moved to edge_set.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/default_map.h

    r1820 r1842  
    226226  /// \e
    227227  template <typename _Base>
     228  class MappableEdgeSetExtender : public _Base {
     229  public:
     230
     231    typedef MappableEdgeSetExtender<_Base> Graph;
     232    typedef _Base Parent;
     233
     234    typedef typename Parent::Edge Edge;
     235    typedef typename Parent::EdgeIt EdgeIt;
     236
     237    template <typename _Value>
     238    class EdgeMap
     239      : public IterableMapExtender<DefaultMap<Graph, Edge, _Value> > {
     240    public:
     241      typedef MappableEdgeSetExtender Graph;
     242      typedef IterableMapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
     243
     244      EdgeMap(const Graph& _g)
     245        : Parent(_g) {}
     246      EdgeMap(const Graph& _g, const _Value& _v)
     247        : Parent(_g, _v) {}
     248
     249      EdgeMap& operator=(const EdgeMap& cmap) {
     250        return operator=<EdgeMap>(cmap);
     251      }
     252
     253      template <typename CMap>
     254      EdgeMap& operator=(const CMap& cmap) {
     255        checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
     256        const typename Parent::Graph* graph = Parent::getGraph();
     257        Edge it;
     258        for (graph->first(it); it != INVALID; graph->next(it)) {
     259          Parent::set(it, cmap[it]);
     260        }
     261        return *this;
     262      }
     263    };
     264   
     265  };
     266
     267  /// \e
     268  template <typename _Base>
    228269  class MappableUndirGraphExtender :
    229270    public MappableGraphExtender<_Base> {
     
    240281    public:
    241282      typedef MappableUndirGraphExtender Graph;
     283      typedef IterableMapExtender<
     284        DefaultMap<Graph, UndirEdge, _Value> > Parent;
     285
     286      UndirEdgeMap(const Graph& _g)
     287        : Parent(_g) {}
     288      UndirEdgeMap(const Graph& _g, const _Value& _v)
     289        : Parent(_g, _v) {}
     290
     291      UndirEdgeMap& operator=(const UndirEdgeMap& cmap) {
     292        return operator=<UndirEdgeMap>(cmap);
     293      }
     294
     295      template <typename CMap>
     296      UndirEdgeMap& operator=(const CMap& cmap) {
     297        checkConcept<concept::ReadMap<UndirEdge, _Value>, CMap>();
     298        const typename Parent::Graph* graph = Parent::getGraph();
     299        UndirEdge it;
     300        for (graph->first(it); it != INVALID; graph->next(it)) {
     301          Parent::set(it, cmap[it]);
     302        }
     303        return *this;
     304      }
     305    };
     306
     307
     308  };
     309
     310  /// \e
     311  template <typename _Base>
     312  class MappableUndirEdgeSetExtender :
     313    public MappableEdgeSetExtender<_Base> {
     314  public:
     315
     316    typedef MappableUndirEdgeSetExtender Graph;
     317    typedef MappableEdgeSetExtender<_Base> Parent;
     318
     319    typedef typename Parent::UndirEdge UndirEdge;
     320
     321    template <typename _Value>
     322    class UndirEdgeMap
     323      : public IterableMapExtender<DefaultMap<Graph, UndirEdge, _Value> > {
     324    public:
     325      typedef MappableUndirEdgeSetExtender Graph;
    242326      typedef IterableMapExtender<
    243327        DefaultMap<Graph, UndirEdge, _Value> > Parent;
Note: See TracChangeset for help on using the changeset viewer.