COIN-OR::LEMON - Graph Library

Changeset 627:2313edd0db0b in lemon


Ignore:
Timestamp:
04/14/09 10:34:12 (16 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Standard graph maps are required to be reference maps (#190)

Location:
lemon
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/graph_adaptor_extender.h

    r478 r627  
    2222#include <lemon/core.h>
    2323#include <lemon/error.h>
    24 
    25 #include <lemon/bits/default_map.h>
    2624
    2725namespace lemon {
  • lemon/bits/map_extender.h

    r463 r627  
    4848    typedef typename Parent::Key Key;
    4949    typedef typename Parent::Value Value;
     50    typedef typename Parent::Reference Reference;
     51    typedef typename Parent::ConstReference ConstReference;
    5052
    5153    class MapIt;
     
    188190    typedef typename Parent::Key Key;
    189191    typedef typename Parent::Value Value;
     192    typedef typename Parent::Reference Reference;
     193    typedef typename Parent::ConstReference ConstReference;
    190194
    191195    class MapIt;
  • lemon/concepts/digraph.h

    r576 r627  
    422422      Node oppositeNode(const Node&, const Arc&) const { return INVALID; }
    423423
    424       /// \brief Read write map of the nodes to type \c T.
    425       ///
    426       /// ReadWrite map of the nodes to type \c T.
    427       /// \sa Reference
     424      /// \brief Reference map of the nodes to type \c T.
     425      ///
     426      /// Reference map of the nodes to type \c T.
    428427      template<class T>
    429       class NodeMap : public ReadWriteMap< Node, T > {
     428      class NodeMap : public ReferenceMap<Node, T, T&, const T&> {
    430429      public:
    431430
     
    437436      private:
    438437        ///Copy constructor
    439         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
     438        NodeMap(const NodeMap& nm) :
     439          ReferenceMap<Node, T, T&, const T&>(nm) { }
    440440        ///Assignment operator
    441441        template <typename CMap>
     
    446446      };
    447447
    448       /// \brief Read write map of the arcs to type \c T.
     448      /// \brief Reference map of the arcs to type \c T.
    449449      ///
    450450      /// Reference map of the arcs to type \c T.
    451       /// \sa Reference
    452451      template<class T>
    453       class ArcMap : public ReadWriteMap<Arc,T> {
     452      class ArcMap : public ReferenceMap<Arc, T, T&, const T&> {
    454453      public:
    455454
     
    460459      private:
    461460        ///Copy constructor
    462         ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { }
     461        ArcMap(const ArcMap& em) :
     462          ReferenceMap<Arc, T, T&, const T&>(em) { }
    463463        ///Assignment operator
    464464        template <typename CMap>
     
    472472      struct Constraints {
    473473        void constraints() {
     474          checkConcept<BaseDigraphComponent, _Digraph>();
    474475          checkConcept<IterableDigraphComponent<>, _Digraph>();
    475476          checkConcept<IDableDigraphComponent<>, _Digraph>();
  • lemon/concepts/graph.h

    r606 r627  
    498498      };
    499499
    500       /// \brief Read write map of the nodes to type \c T.
    501       ///
    502       /// ReadWrite map of the nodes to type \c T.
    503       /// \sa Reference
     500      /// \brief Reference map of the nodes to type \c T.
     501      ///
     502      /// Reference map of the nodes to type \c T.
    504503      template<class T>
    505       class NodeMap : public ReadWriteMap< Node, T >
     504      class NodeMap : public ReferenceMap<Node, T, T&, const T&>
    506505      {
    507506      public:
     
    514513      private:
    515514        ///Copy constructor
    516         NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { }
     515        NodeMap(const NodeMap& nm) :
     516          ReferenceMap<Node, T, T&, const T&>(nm) { }
    517517        ///Assignment operator
    518518        template <typename CMap>
     
    523523      };
    524524
    525       /// \brief Read write map of the directed arcs to type \c T.
    526       ///
    527       /// Reference map of the directed arcs to type \c T.
    528       /// \sa Reference
     525      /// \brief Reference map of the arcs to type \c T.
     526      ///
     527      /// Reference map of the arcs to type \c T.
    529528      template<class T>
    530       class ArcMap : public ReadWriteMap<Arc,T>
     529      class ArcMap : public ReferenceMap<Arc, T, T&, const T&>
    531530      {
    532531      public:
     
    538537      private:
    539538        ///Copy constructor
    540         ArcMap(const ArcMap& em) : ReadWriteMap<Arc,T>(em) { }
     539        ArcMap(const ArcMap& em) :
     540          ReferenceMap<Arc, T, T&, const T&>(em) { }
    541541        ///Assignment operator
    542542        template <typename CMap>
     
    547547      };
    548548
    549       /// Read write map of the edges to type \c T.
    550 
    551       /// Reference map of the arcs to type \c T.
    552       /// \sa Reference
     549      /// Reference map of the edges to type \c T.
     550
     551      /// Reference map of the edges to type \c T.
    553552      template<class T>
    554       class EdgeMap : public ReadWriteMap<Edge,T>
     553      class EdgeMap : public ReferenceMap<Edge, T, T&, const T&>
    555554      {
    556555      public:
     
    562561      private:
    563562        ///Copy constructor
    564         EdgeMap(const EdgeMap& em) : ReadWriteMap<Edge,T>(em) {}
     563        EdgeMap(const EdgeMap& em) :
     564          ReferenceMap<Edge, T, T&, const T&>(em) {}
    565565        ///Assignment operator
    566566        template <typename CMap>
     
    749749      struct Constraints {
    750750        void constraints() {
     751          checkConcept<BaseGraphComponent, _Graph>();
    751752          checkConcept<IterableGraphComponent<>, _Graph>();
    752753          checkConcept<IDableGraphComponent<>, _Graph>();
  • lemon/concepts/graph_components.h

    r626 r627  
    989989    /// the \c NodeMap, \c ArcMap and \c EdgeMap subtypes of digraph and
    990990    /// graph types, which can be used for associating data to graph items.
     991    /// The standard graph maps must conform to the ReferenceMap concept.
    991992    template <typename GR, typename K, typename V>
    992     class GraphMap : public ReadWriteMap<K, V> {
     993    class GraphMap : public ReferenceMap<K, V, V&, const V&> {
    993994    public:
    994995
     
    10011002      /// The value type of the map.
    10021003      typedef V Value;
     1004      /// The reference type of the map.
     1005      typedef Value& Reference;
     1006      /// The const reference type of the map.
     1007      typedef const Value& ConstReference;
     1008
     1009      // The reference map tag.
     1010      typedef True ReferenceMapTag;
    10031011
    10041012      /// \brief Construct a new map.
     
    10321040      struct Constraints {
    10331041        void constraints() {
    1034           checkConcept<ReadWriteMap<Key, Value>, _Map >();
     1042          checkConcept
     1043            <ReferenceMap<Key, Value, Value&, const Value&>, _Map>();
    10351044          _Map m1(g);
    10361045          _Map m2(g,t);
     
    10741083      ///
    10751084      /// Standard graph map for the nodes.
     1085      /// It conforms to the ReferenceMap concept.
    10761086      template <typename V>
    10771087      class NodeMap : public GraphMap<MappableDigraphComponent, Node, V> {
     
    11111121      ///
    11121122      /// Standard graph map for the arcs.
     1123      /// It conforms to the ReferenceMap concept.
    11131124      template <typename V>
    11141125      class ArcMap : public GraphMap<MappableDigraphComponent, Arc, V> {
     
    12081219      ///
    12091220      /// Standard graph map for the edges.
     1221      /// It conforms to the ReferenceMap concept.
    12101222      template <typename V>
    12111223      class EdgeMap : public GraphMap<MappableGraphComponent, Edge, V> {
Note: See TracChangeset for help on using the changeset viewer.