Changeset 1990:15fb7a4ea6be in lemon-0.x
- Timestamp:
- 03/01/06 11:17:25 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2592
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/edge_set.h
r1979 r1990 21 21 22 22 23 #include <lemon/bits/default_map.h> 23 24 #include <lemon/bits/edge_set_extender.h> 24 25 … … 46 47 }; 47 48 48 typedef typename Graph::template NodeMap<NodeT> NodesImplBase;49 typedef DefaultMap<Graph, Node, NodeT> NodesImplBase; 49 50 50 51 NodesImplBase* nodes; … … 197 198 Node target(const Edge& edge) const { return edges[edge.id].target;} 198 199 200 typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier; 201 202 NodeNotifier& getNotifier(Node) const { 203 return graph->getNotifier(Node()); 204 } 205 199 206 template <typename _Value> 200 207 class NodeMap : public Graph::template NodeMap<_Value> { … … 405 412 }; 406 413 407 typedef typename Graph::template NodeMap<NodeT> NodesImplBase;414 typedef DefaultMap<Graph, Node, NodeT> NodesImplBase; 408 415 409 416 NodesImplBase* nodes; … … 506 513 Node target(const Edge& edge) const { return edges[edge.id].target;} 507 514 515 typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier; 516 517 NodeNotifier& getNotifier(Node) const { 518 return graph->getNotifier(Node()); 519 } 520 508 521 template <typename _Value> 509 522 class NodeMap : public Graph::template NodeMap<_Value> { -
lemon/graph_utils.h
r1981 r1990 29 29 #include <lemon/maps.h> 30 30 #include <lemon/traits.h> 31 31 32 #include <lemon/bits/alteration_notifier.h> 33 #include <lemon/bits/default_map.h> 32 34 33 35 ///\ingroup gutils … … 901 903 /// \param _Map A ReadWriteMap mapping from the item type to integer. 902 904 template < 903 typename _Graph, typename _Item, typename _Value, typename _Map904 = typename ItemSetTraits<_Graph, _Item>::template Map<_Value>::Parent905 typename _Graph, typename _Item, typename _Value, 906 typename _Map = DefaultMap<_Graph, _Item, _Value> 905 907 > 906 908 #else … … 1106 1108 /// \param _Map A ReadWriteMap mapping from the item type to integer. 1107 1109 template < 1108 typename _Graph, typename _Item, typename _Map1109 = typename ItemSetTraits<_Graph, _Item>::template Map<int>::Parent1110 typename _Graph, typename _Item, 1111 typename _Map = DefaultMap<_Graph, _Item, int> 1110 1112 > 1111 1113 #else … … 1506 1508 private: 1507 1509 1508 class AutoNodeMap : public Graph::template NodeMap<int> {1510 class AutoNodeMap : public DefaultMap<_Graph, Key, int> { 1509 1511 public: 1510 1512 1511 typedef typename Graph::template NodeMap<int> Parent; 1512 1513 typedef typename Parent::Key Key; 1514 typedef typename Parent::Value Value; 1515 1513 typedef DefaultMap<_Graph, Key, int> Parent; 1514 1516 1515 AutoNodeMap(const Graph& graph) : Parent(graph, 0) {} 1517 1516 … … 1623 1622 private: 1624 1623 1625 class AutoNodeMap : public Graph::template NodeMap<int> {1624 class AutoNodeMap : public DefaultMap<_Graph, Key, int> { 1626 1625 public: 1627 1626 1628 typedef typename Graph::template NodeMap<int> Parent; 1629 1630 typedef typename Parent::Key Key; 1631 typedef typename Parent::Value Value; 1632 1627 typedef DefaultMap<_Graph, Key, int> Parent; 1628 1633 1629 AutoNodeMap(const Graph& graph) : Parent(graph, 0) {} 1634 1630 … … 1664 1660 } 1665 1661 1666 /// Gives back the in-degree of a Node.1662 /// Gives back the out-degree of a Node. 1667 1663 int operator[](const Key& key) const { 1668 1664 return deg[key]; -
lemon/iterable_maps.h
r1956 r1990 20 20 #include <lemon/invalid.h> 21 21 22 #include <lemon/bits/default_map.h> 23 22 24 #include <vector> 23 25 #include <map> … … 48 50 /// \param _Item One of the graph's item type, the key of the map. 49 51 template <typename _Graph, typename _Item> 50 class IterableBoolMap 51 : protected ItemSetTraits<_Graph, _Item>::template Map<int>::Parent { 52 class IterableBoolMap : protected DefaultMap<_Graph, _Item, int> { 52 53 private: 53 54 typedef _Graph Graph; 54 55 55 56 typedef typename ItemSetTraits<Graph, _Item>::ItemIt KeyIt; 56 typedef typename ItemSetTraits<Graph, _Item> 57 ::template Map<int>::Parent Parent; 57 typedef DefaultMap<_Graph, _Item, int> Parent; 58 58 59 59 std::vector<_Item> array; … … 400 400 /// \param _Item One of the graph's item type, the key of the map. 401 401 template <typename _Graph, typename _Item> 402 class IterableIntMap : protected ItemSetTraits<_Graph, _Item> 403 ::template Map<_iterable_maps_bits::IterableIntMapNode<_Item> >::Parent { 402 class IterableIntMap 403 : protected DefaultMap<_Graph, _Item, _iterable_maps_bits:: 404 IterableIntMapNode<_Item> > { 404 405 public: 405 typedef typename ItemSetTraits<_Graph, _Item>406 ::template Map<_iterable_maps_bits::IterableIntMapNode<_Item> >407 ::ParentParent;406 typedef DefaultMap<_Graph, _Item, _iterable_maps_bits:: 407 IterableIntMapNode<_Item> > 408 Parent; 408 409 409 410 /// The key type … … 688 689 /// \param _Value Any comparable value type. 689 690 template <typename _Graph, typename _Item, typename _Value> 690 class IterableValueMap : protected ItemSetTraits<_Graph, _Item>691 ::template Map<_iterable_maps_bits::IterableValueMapNode<_Item, _Value> >692 ::Parent{691 class IterableValueMap 692 : protected DefaultMap<_Graph, _Item, _iterable_maps_bits:: 693 IterableValueMapNode<_Item, _Value> > { 693 694 public: 694 typedef typename ItemSetTraits<_Graph, _Item> 695 ::template Map<_iterable_maps_bits::IterableValueMapNode<_Item, _Value> > 696 ::Parent Parent; 695 typedef DefaultMap<_Graph, _Item, _iterable_maps_bits:: 696 IterableValueMapNode<_Item, _Value> > Parent; 697 697 698 698 /// The key type … … 703 703 typedef _Graph Graph; 704 704 705 protected: 706 707 typedef typename ItemSetTraits<_Graph, Key>::ItemIt KeyIt; 708 709 public: 710 705 711 /// \brief Constructor of the Map with a given value. 706 712 /// … … 708 714 explicit IterableValueMap(const Graph& graph, 709 715 const Value& value = Value()) 710 : Parent(graph, _iterable_maps_bits:: IterableValueMapNode<_Item,711 _Value>(value)) {712 for ( typename Parent::ItemIt it(*this); it != INVALID; ++it) {716 : Parent(graph, _iterable_maps_bits:: 717 IterableValueMapNode<_Item, _Value>(value)) { 718 for (KeyIt it(*Parent::getGraph()); it != INVALID; ++it) { 713 719 lace(it); 714 720 } 715 721 } 716 722 717 pr ivate:723 protected: 718 724 719 725 void unlace(const Key& key) { … … 872 878 protected: 873 879 880 virtual void add(const Key& key) { 881 Parent::add(key); 882 unlace(key); 883 } 884 885 virtual void add(const std::vector<Key>& keys) { 886 Parent::add(keys); 887 for (int i = 0; i < (int)keys.size(); ++i) { 888 lace(keys[i]); 889 } 890 } 891 874 892 virtual void erase(const Key& key) { 875 893 unlace(key); … … 884 902 } 885 903 904 virtual void build() { 905 Parent::build(); 906 for (KeyIt it(*Parent::getGraph()); it != INVALID; ++it) { 907 lace(it); 908 } 909 } 910 886 911 virtual void clear() { 887 912 first.clear(); -
lemon/sub_graph.h
r1979 r1990 21 21 22 22 #include <lemon/graph_adaptor.h> 23 #include <lemon/bits/graph_adaptor_extender.h> 24 #include <lemon/bits/default_map.h> 23 25 24 26 namespace lemon { … … 243 245 Edge firstIn, firstOut; 244 246 }; 245 class NodesImpl : public Graph::template NodeMap<NodeT> {247 class NodesImpl : public DefaultMap<Graph, Node, NodeT> { 246 248 friend class SubGraphBase; 247 249 public: 248 typedef typename Graph::template NodeMap<NodeT> Parent;250 typedef DefaultMap<Graph, Node, NodeT> Parent; 249 251 250 252 NodesImpl(SubGraph& _adaptor, const Graph& _graph) … … 306 308 Edge prevIn, nextIn; 307 309 }; 308 class EdgesImpl : public Graph::template EdgeMap<EdgeT> {310 class EdgesImpl : public DefaultMap<Graph, Edge, EdgeT> { 309 311 friend class SubGraphBase; 310 312 public: 311 typedef typename Graph::template EdgeMap<EdgeT> Parent;313 typedef DefaultMap<Graph, Edge, EdgeT> Parent; 312 314 313 315 EdgesImpl(SubGraph& _adaptor, const Graph& _graph) … … 561 563 Edge firstIn, firstOut; 562 564 }; 563 class NodesImpl : public Graph::template NodeMap<NodeT> {565 class NodesImpl : public DefaultMap<Graph, Node, NodeT> { 564 566 friend class EdgeSubGraphBase; 565 567 public: 566 typedef typename Graph::template NodeMap<NodeT> Parent;568 typedef DefaultMap<Graph, Node, NodeT> Parent; 567 569 568 570 NodesImpl(SubGraph& _adaptor, const Graph& _graph) … … 604 606 Edge prevIn, nextIn; 605 607 }; 606 class EdgesImpl : public Graph::template EdgeMap<EdgeT> {608 class EdgesImpl : public DefaultMap<Graph, Edge, EdgeT> { 607 609 friend class EdgeSubGraphBase; 608 610 public: 609 typedef typename Graph::template EdgeMap<EdgeT> Parent;611 typedef DefaultMap<Graph, Edge, EdgeT> Parent; 610 612 611 613 EdgesImpl(SubGraph& _adaptor, const Graph& _graph) -
test/edge_set_test.cc
r1962 r1990 18 18 using namespace lemon::concept; 19 19 20 typedef S taticGraph Graph;20 typedef SmartGraph Graph; 21 21 22 22 int main() {
Note: See TracChangeset
for help on using the changeset viewer.