Changeset 980:0f1044b7a3af in lemon0.x for src/lemon/concept
 Timestamp:
 11/11/04 10:31:55 (17 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1368
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/lemon/concept/graph_component.h
r964 r980 162 162 163 163 164 /// Assign operator for nodes. 165 166 /// The nodes are assignable. 167 /// 164 168 Node& operator=(const Node&) { return *this;} 165 169 … … 211 215 Edge(Invalid) {} 212 216 213 217 /// Assign operator for edges. 218 219 /// The edges are assignable. 220 /// 214 221 Edge& operator=(const Edge&) { return *this;} 215 222 … … 430 437 /// Gives back an integer greater or equal to the maximum Node id. 431 438 /// 432 int max EdgeId() const { return 1;}439 int maxId(Node = INVALID) const { return 1;} 433 440 434 441 /// Gives back an integer greater or equal to the maximum Edge id. … … 436 443 /// Gives back an integer greater or equal to the maximum Edge id. 437 444 /// 438 int max NodeId() const { return 1;}445 int maxId(Edge = INVALID) const { return 1;} 439 446 }; 440 447 … … 448 455 void constraints() { 449 456 function_requires< BaseGraphComponentConcept<Graph> >(); 450 int nid = graph.max EdgeId();457 int nid = graph.maxId(typename Graph::Node()); 451 458 ignore_unused_variable_warning(nid); 452 int eid = graph.max NodeId();459 int eid = graph.maxId(typename Graph::Edge()); 453 460 ignore_unused_variable_warning(eid); 454 461 } … … 663 670 664 671 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 711 672 class MappableGraphComponent : virtual public BaseGraphComponent { 712 673 public:
Note: See TracChangeset
for help on using the changeset viewer.