src/lemon/concept/graph_component.h
changeset 980 0f1044b7a3af
parent 964 2c0c20e90116
child 986 e997802b855c
     1.1 --- a/src/lemon/concept/graph_component.h	Wed Nov 10 21:59:59 2004 +0000
     1.2 +++ b/src/lemon/concept/graph_component.h	Thu Nov 11 09:31:55 2004 +0000
     1.3 @@ -161,6 +161,10 @@
     1.4  	Node(Invalid) {}
     1.5  
     1.6  
     1.7 +	/// Assign operator for nodes.
     1.8 +
     1.9 +	/// The nodes are assignable. 
    1.10 +	///
    1.11  	Node& operator=(const Node&) { return *this;}
    1.12  
    1.13  	/// Equality operator.
    1.14 @@ -210,7 +214,10 @@
    1.15  	/// \sa Invalid for more details.
    1.16  	Edge(Invalid) {}
    1.17  
    1.18 +	/// Assign operator for edges.
    1.19  
    1.20 +	/// The edges are assignable. 
    1.21 +	///
    1.22  	Edge& operator=(const Edge&) { return *this;}
    1.23  
    1.24  	/// Equality operator.
    1.25 @@ -429,13 +436,13 @@
    1.26  
    1.27        /// Gives back an integer greater or equal to the maximum Node id. 
    1.28        ///
    1.29 -      int maxEdgeId() const { return -1;}
    1.30 +      int maxId(Node = INVALID) const { return -1;}
    1.31  
    1.32        /// Gives back an integer greater or equal to the maximum Edge id. 
    1.33  
    1.34        /// Gives back an integer greater or equal to the maximum Edge id. 
    1.35        ///
    1.36 -      int maxNodeId() const { return -1;}
    1.37 +      int maxId(Edge = INVALID) const { return -1;}
    1.38      };
    1.39  
    1.40      /// Concept check structure for MaxIdableBaseGraph.
    1.41 @@ -447,9 +454,9 @@
    1.42  
    1.43        void constraints() {
    1.44  	function_requires< BaseGraphComponentConcept<Graph> >();
    1.45 -	int nid = graph.maxEdgeId();
    1.46 +	int nid = graph.maxId(typename Graph::Node());
    1.47  	ignore_unused_variable_warning(nid);
    1.48 -	int eid = graph.maxNodeId();
    1.49 +	int eid = graph.maxId(typename Graph::Edge());
    1.50  	ignore_unused_variable_warning(eid);
    1.51        }
    1.52  
    1.53 @@ -662,52 +669,6 @@
    1.54      };
    1.55  
    1.56  
    1.57 -    class IdMappableGraphComponent : virtual public BaseGraphComponent {
    1.58 -
    1.59 -      typedef IdMappableGraphComponent Graph;
    1.60 -
    1.61 -    public:
    1.62 -
    1.63 -      typedef BaseGraphComponent::Node Node;
    1.64 -      typedef BaseGraphComponent::Edge Edge;
    1.65 -
    1.66 -      class NodeIdMap : public ReadMap<Node, int> {
    1.67 -      public:
    1.68 -	NodeIdMap(const Graph&) {}
    1.69 -	int maxId() const { return -1;}
    1.70 -      };
    1.71 -
    1.72 -      class EdgeIdMap : public ReadMap<Edge, int> {
    1.73 -      public:
    1.74 -	EdgeIdMap(const Graph&) {}
    1.75 -	int maxId() const { return -1;}
    1.76 -      };
    1.77 -
    1.78 -    };
    1.79 -    
    1.80 -    template <typename Graph>
    1.81 -    struct IdMappableGraphComponentConcept {
    1.82 -      void constraints() {	
    1.83 -	function_requires< BaseGraphComponentConcept<Graph> >();
    1.84 -	{
    1.85 -	  typedef typename Graph::EdgeIdMap EdgeIdMap;
    1.86 -	  function_requires<ReadMapConcept<EdgeIdMap> >();
    1.87 -	  EdgeIdMap edge_map(graph);
    1.88 -	  int n = edge_map.maxId();
    1.89 -	  ignore_unused_variable_warning(n);
    1.90 -	}
    1.91 -	{
    1.92 -	  typedef typename Graph::NodeIdMap NodeIdMap;
    1.93 -	  function_requires<ReadMapConcept<NodeIdMap> >();
    1.94 -	  NodeIdMap node_map(graph);
    1.95 -	  int n = node_map.maxId();
    1.96 -	  ignore_unused_variable_warning(n);
    1.97 -	}
    1.98 -      }
    1.99 -      Graph& graph;
   1.100 -    };
   1.101 -
   1.102 -
   1.103      class MappableGraphComponent : virtual public BaseGraphComponent {
   1.104      public:
   1.105