COIN-OR::LEMON - Graph Library

Changeset 980:0f1044b7a3af in lemon-0.x for src/lemon/concept


Ignore:
Timestamp:
11/11/04 10:31:55 (19 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1368
Message:

maxNodeId() and maxEdgeId() changed to maxId(Node) and maxId(Edge)
getNodeObserverRegistry() and getEdgeObserverRegistry() changed to
getObserverRegistry(Node) and getObserverRegistry(Edge)

IdMappableGraphExtender? erased

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/concept/graph_component.h

    r964 r980  
    162162
    163163
     164        /// Assign operator for nodes.
     165
     166        /// The nodes are assignable.
     167        ///
    164168        Node& operator=(const Node&) { return *this;}
    165169
     
    211215        Edge(Invalid) {}
    212216
    213 
     217        /// Assign operator for edges.
     218
     219        /// The edges are assignable.
     220        ///
    214221        Edge& operator=(const Edge&) { return *this;}
    215222
     
    430437      /// Gives back an integer greater or equal to the maximum Node id.
    431438      ///
    432       int maxEdgeId() const { return -1;}
     439      int maxId(Node = INVALID) const { return -1;}
    433440
    434441      /// Gives back an integer greater or equal to the maximum Edge id.
     
    436443      /// Gives back an integer greater or equal to the maximum Edge id.
    437444      ///
    438       int maxNodeId() const { return -1;}
     445      int maxId(Edge = INVALID) const { return -1;}
    439446    };
    440447
     
    448455      void constraints() {
    449456        function_requires< BaseGraphComponentConcept<Graph> >();
    450         int nid = graph.maxEdgeId();
     457        int nid = graph.maxId(typename Graph::Node());
    451458        ignore_unused_variable_warning(nid);
    452         int eid = graph.maxNodeId();
     459        int eid = graph.maxId(typename Graph::Edge());
    453460        ignore_unused_variable_warning(eid);
    454461      }
     
    663670
    664671
    665     class IdMappableGraphComponent : virtual public BaseGraphComponent {
    666 
    667       typedef IdMappableGraphComponent Graph;
    668 
    669     public:
    670 
    671       typedef BaseGraphComponent::Node Node;
    672       typedef BaseGraphComponent::Edge Edge;
    673 
    674       class NodeIdMap : public ReadMap<Node, int> {
    675       public:
    676         NodeIdMap(const Graph&) {}
    677         int maxId() const { return -1;}
    678       };
    679 
    680       class EdgeIdMap : public ReadMap<Edge, int> {
    681       public:
    682         EdgeIdMap(const Graph&) {}
    683         int maxId() const { return -1;}
    684       };
    685 
    686     };
    687    
    688     template <typename Graph>
    689     struct IdMappableGraphComponentConcept {
    690       void constraints() {     
    691         function_requires< BaseGraphComponentConcept<Graph> >();
    692         {
    693           typedef typename Graph::EdgeIdMap EdgeIdMap;
    694           function_requires<ReadMapConcept<EdgeIdMap> >();
    695           EdgeIdMap edge_map(graph);
    696           int n = edge_map.maxId();
    697           ignore_unused_variable_warning(n);
    698         }
    699         {
    700           typedef typename Graph::NodeIdMap NodeIdMap;
    701           function_requires<ReadMapConcept<NodeIdMap> >();
    702           NodeIdMap node_map(graph);
    703           int n = node_map.maxId();
    704           ignore_unused_variable_warning(n);
    705         }
    706       }
    707       Graph& graph;
    708     };
    709 
    710 
    711672    class MappableGraphComponent : virtual public BaseGraphComponent {
    712673    public:
Note: See TracChangeset for help on using the changeset viewer.