Changeset 617:4137ef9aacc6 in lemon-1.2 for lemon/bits
- Timestamp:
- 04/24/09 11:54:48 (15 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- lemon/bits
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/array_map.h
r492 r617 48 48 public: 49 49 // The graph type. 50 typedef _Graph Graph ;50 typedef _Graph GraphType; 51 51 // The item type. 52 52 typedef _Item Item; … … 64 64 typedef _Value& Reference; 65 65 66 // The map type. 67 typedef ArrayMap Map; 68 66 69 // The notifier type. 67 70 typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier; 68 71 72 private: 73 69 74 // The MapBase of the Map which imlements the core regisitry function. 70 75 typedef typename Notifier::ObserverBase Parent; 71 76 72 private:73 77 typedef std::allocator<Value> Allocator; 74 78 … … 78 82 // 79 83 // Graph initialized map constructor. 80 explicit ArrayMap(const Graph & graph) {84 explicit ArrayMap(const GraphType& graph) { 81 85 Parent::attach(graph.notifier(Item())); 82 86 allocate_memory(); … … 92 96 // 93 97 // It constructs a map and initialize all of the the map. 94 ArrayMap(const Graph & graph, const Value& value) {98 ArrayMap(const GraphType& graph, const Value& value) { 95 99 Parent::attach(graph.notifier(Item())); 96 100 allocate_memory(); -
lemon/bits/base_extender.h
r440 r617 39 39 template <typename Base> 40 40 class UndirDigraphExtender : public Base { 41 typedef Base Parent; 41 42 42 43 public: 43 44 44 typedef Base Parent;45 45 typedef typename Parent::Arc Edge; 46 46 typedef typename Parent::Node Node; … … 281 281 template <typename Base> 282 282 class BidirBpGraphExtender : public Base { 283 typedef Base Parent; 284 283 285 public: 284 typedef Base Parent;285 286 typedef BidirBpGraphExtender Digraph; 286 287 -
lemon/bits/default_map.h
r535 r617 154 154 class DefaultMap 155 155 : public DefaultMapSelector<_Graph, _Item, _Value>::Map { 156 typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent; 157 156 158 public: 157 typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent;158 159 typedef DefaultMap<_Graph, _Item, _Value> Map; 159 160 typedef typename Parent::Graph Graph;160 161 typedef typename Parent::GraphType GraphType; 161 162 typedef typename Parent::Value Value; 162 163 163 explicit DefaultMap(const Graph & graph) : Parent(graph) {}164 DefaultMap(const Graph & graph, const Value& value)164 explicit DefaultMap(const GraphType& graph) : Parent(graph) {} 165 DefaultMap(const GraphType& graph, const Value& value) 165 166 : Parent(graph, value) {} 166 167 -
lemon/bits/edge_set_extender.h
r559 r617 35 35 template <typename Base> 36 36 class ArcSetExtender : public Base { 37 typedef Base Parent; 38 37 39 public: 38 40 39 typedef Base Parent;40 41 typedef ArcSetExtender Digraph; 41 42 … … 219 220 class ArcMap 220 221 : public MapExtender<DefaultMap<Digraph, Arc, _Value> > { 221 public:222 typedef ArcSetExtender Digraph;223 222 typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent; 224 223 224 public: 225 225 explicit ArcMap(const Digraph& _g) 226 226 : Parent(_g) {} … … 275 275 template <typename Base> 276 276 class EdgeSetExtender : public Base { 277 typedef Base Parent; 277 278 278 279 public: 279 280 280 typedef Base Parent; 281 typedef EdgeSetExtender Digraph; 281 typedef EdgeSetExtender Graph; 282 282 283 283 typedef typename Parent::Node Node; 284 284 typedef typename Parent::Arc Arc; 285 285 typedef typename Parent::Edge Edge; 286 287 286 288 287 int maxId(Node) const { … … 351 350 352 351 class NodeIt : public Node { 353 const Digraph* digraph;352 const Graph* graph; 354 353 public: 355 354 … … 358 357 NodeIt(Invalid i) : Node(i) { } 359 358 360 explicit NodeIt(const Digraph& _graph) : digraph(&_graph) {359 explicit NodeIt(const Graph& _graph) : graph(&_graph) { 361 360 _graph.first(static_cast<Node&>(*this)); 362 361 } 363 362 364 NodeIt(const Digraph& _graph, const Node& node)365 : Node(node), digraph(&_graph) {}363 NodeIt(const Graph& _graph, const Node& node) 364 : Node(node), graph(&_graph) {} 366 365 367 366 NodeIt& operator++() { 368 digraph->next(*this);367 graph->next(*this); 369 368 return *this; 370 369 } … … 374 373 375 374 class ArcIt : public Arc { 376 const Digraph* digraph;375 const Graph* graph; 377 376 public: 378 377 … … 381 380 ArcIt(Invalid i) : Arc(i) { } 382 381 383 explicit ArcIt(const Digraph& _graph) : digraph(&_graph) {382 explicit ArcIt(const Graph& _graph) : graph(&_graph) { 384 383 _graph.first(static_cast<Arc&>(*this)); 385 384 } 386 385 387 ArcIt(const Digraph& _graph, const Arc& e) :388 Arc(e), digraph(&_graph) { }386 ArcIt(const Graph& _graph, const Arc& e) : 387 Arc(e), graph(&_graph) { } 389 388 390 389 ArcIt& operator++() { 391 digraph->next(*this);390 graph->next(*this); 392 391 return *this; 393 392 } … … 397 396 398 397 class OutArcIt : public Arc { 399 const Digraph* digraph;398 const Graph* graph; 400 399 public: 401 400 … … 404 403 OutArcIt(Invalid i) : Arc(i) { } 405 404 406 OutArcIt(const Digraph& _graph, const Node& node)407 : digraph(&_graph) {405 OutArcIt(const Graph& _graph, const Node& node) 406 : graph(&_graph) { 408 407 _graph.firstOut(*this, node); 409 408 } 410 409 411 OutArcIt(const Digraph& _graph, const Arc& arc)412 : Arc(arc), digraph(&_graph) {}410 OutArcIt(const Graph& _graph, const Arc& arc) 411 : Arc(arc), graph(&_graph) {} 413 412 414 413 OutArcIt& operator++() { 415 digraph->nextOut(*this);414 graph->nextOut(*this); 416 415 return *this; 417 416 } … … 421 420 422 421 class InArcIt : public Arc { 423 const Digraph* digraph;422 const Graph* graph; 424 423 public: 425 424 … … 428 427 InArcIt(Invalid i) : Arc(i) { } 429 428 430 InArcIt(const Digraph& _graph, const Node& node)431 : digraph(&_graph) {429 InArcIt(const Graph& _graph, const Node& node) 430 : graph(&_graph) { 432 431 _graph.firstIn(*this, node); 433 432 } 434 433 435 InArcIt(const Digraph& _graph, const Arc& arc) :436 Arc(arc), digraph(&_graph) {}434 InArcIt(const Graph& _graph, const Arc& arc) : 435 Arc(arc), graph(&_graph) {} 437 436 438 437 InArcIt& operator++() { 439 digraph->nextIn(*this);438 graph->nextIn(*this); 440 439 return *this; 441 440 } … … 445 444 446 445 class EdgeIt : public Parent::Edge { 447 const Digraph* digraph;446 const Graph* graph; 448 447 public: 449 448 … … 452 451 EdgeIt(Invalid i) : Edge(i) { } 453 452 454 explicit EdgeIt(const Digraph& _graph) : digraph(&_graph) {453 explicit EdgeIt(const Graph& _graph) : graph(&_graph) { 455 454 _graph.first(static_cast<Edge&>(*this)); 456 455 } 457 456 458 EdgeIt(const Digraph& _graph, const Edge& e) :459 Edge(e), digraph(&_graph) { }457 EdgeIt(const Graph& _graph, const Edge& e) : 458 Edge(e), graph(&_graph) { } 460 459 461 460 EdgeIt& operator++() { 462 digraph->next(*this);461 graph->next(*this); 463 462 return *this; 464 463 } … … 468 467 class IncEdgeIt : public Parent::Edge { 469 468 friend class EdgeSetExtender; 470 const Digraph* digraph;469 const Graph* graph; 471 470 bool direction; 472 471 public: … … 476 475 IncEdgeIt(Invalid i) : Edge(i), direction(false) { } 477 476 478 IncEdgeIt(const Digraph& _graph, const Node &n) : digraph(&_graph) {477 IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) { 479 478 _graph.firstInc(*this, direction, n); 480 479 } 481 480 482 IncEdgeIt(const Digraph& _graph, const Edge &ue, const Node &n)483 : digraph(&_graph), Edge(ue) {481 IncEdgeIt(const Graph& _graph, const Edge &ue, const Node &n) 482 : graph(&_graph), Edge(ue) { 484 483 direction = (_graph.source(ue) == n); 485 484 } 486 485 487 486 IncEdgeIt& operator++() { 488 digraph->nextInc(*this, direction);487 graph->nextInc(*this, direction); 489 488 return *this; 490 489 } … … 535 534 template <typename _Value> 536 535 class ArcMap 537 : public MapExtender<DefaultMap<Digraph, Arc, _Value> > { 538 public: 539 typedef EdgeSetExtender Digraph; 540 typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent; 541 542 ArcMap(const Digraph& _g) 536 : public MapExtender<DefaultMap<Graph, Arc, _Value> > { 537 typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent; 538 539 public: 540 ArcMap(const Graph& _g) 543 541 : Parent(_g) {} 544 ArcMap(const Digraph& _g, const _Value& _v)542 ArcMap(const Graph& _g, const _Value& _v) 545 543 : Parent(_g, _v) {} 546 544 … … 560 558 template <typename _Value> 561 559 class EdgeMap 562 : public MapExtender<DefaultMap<Digraph, Edge, _Value> > { 563 public: 564 typedef EdgeSetExtender Digraph; 565 typedef MapExtender<DefaultMap<Digraph, Edge, _Value> > Parent; 566 567 EdgeMap(const Digraph& _g) 560 : public MapExtender<DefaultMap<Graph, Edge, _Value> > { 561 typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent; 562 563 public: 564 EdgeMap(const Graph& _g) 568 565 : Parent(_g) {} 569 566 570 EdgeMap(const Digraph& _g, const _Value& _v)567 EdgeMap(const Graph& _g, const _Value& _v) 571 568 : Parent(_g, _v) {} 572 569 -
lemon/bits/graph_adaptor_extender.h
r580 r617 27 27 template <typename _Digraph> 28 28 class DigraphAdaptorExtender : public _Digraph { 29 typedef _Digraph Parent; 30 29 31 public: 30 32 31 typedef _Digraph Parent;32 33 typedef _Digraph Digraph; 33 34 typedef DigraphAdaptorExtender Adaptor; … … 174 175 template <typename _Graph> 175 176 class GraphAdaptorExtender : public _Graph { 177 typedef _Graph Parent; 178 176 179 public: 177 180 178 typedef _Graph Parent;179 181 typedef _Graph Graph; 180 182 typedef GraphAdaptorExtender Adaptor; -
lemon/bits/graph_extender.h
r440 r617 38 38 template <typename Base> 39 39 class DigraphExtender : public Base { 40 typedef Base Parent; 41 40 42 public: 41 43 42 typedef Base Parent;43 44 typedef DigraphExtender Digraph; 44 45 … … 219 220 class NodeMap 220 221 : public MapExtender<DefaultMap<Digraph, Node, _Value> > { 221 public:222 typedef DigraphExtender Digraph;223 222 typedef MapExtender<DefaultMap<Digraph, Node, _Value> > Parent; 224 223 224 public: 225 225 explicit NodeMap(const Digraph& digraph) 226 226 : Parent(digraph) {} … … 244 244 class ArcMap 245 245 : public MapExtender<DefaultMap<Digraph, Arc, _Value> > { 246 public:247 typedef DigraphExtender Digraph;248 246 typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent; 249 247 248 public: 250 249 explicit ArcMap(const Digraph& digraph) 251 250 : Parent(digraph) {} … … 331 330 template <typename Base> 332 331 class GraphExtender : public Base { 332 typedef Base Parent; 333 333 334 public: 334 335 335 typedef Base Parent;336 336 typedef GraphExtender Graph; 337 337 … … 602 602 class NodeMap 603 603 : public MapExtender<DefaultMap<Graph, Node, _Value> > { 604 public:605 typedef GraphExtender Graph;606 604 typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent; 607 605 606 public: 608 607 NodeMap(const Graph& graph) 609 608 : Parent(graph) {} … … 627 626 class ArcMap 628 627 : public MapExtender<DefaultMap<Graph, Arc, _Value> > { 629 public:630 typedef GraphExtender Graph;631 628 typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent; 632 629 630 public: 633 631 ArcMap(const Graph& graph) 634 632 : Parent(graph) {} … … 652 650 class EdgeMap 653 651 : public MapExtender<DefaultMap<Graph, Edge, _Value> > { 654 public:655 typedef GraphExtender Graph;656 652 typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent; 657 653 654 public: 658 655 EdgeMap(const Graph& graph) 659 656 : Parent(graph) {} -
lemon/bits/map_extender.h
r580 r617 37 37 template <typename _Map> 38 38 class MapExtender : public _Map { 39 public:40 41 39 typedef _Map Parent; 40 typedef typename Parent::GraphType GraphType; 41 42 public: 43 42 44 typedef MapExtender Map; 43 44 45 typedef typename Parent::Graph Graph;46 45 typedef typename Parent::Key Item; 47 46 … … 59 58 public: 60 59 61 MapExtender(const Graph & graph)60 MapExtender(const GraphType& graph) 62 61 : Parent(graph) {} 63 62 64 MapExtender(const Graph & graph, const Value& value)63 MapExtender(const GraphType& graph, const Value& value) 65 64 : Parent(graph, value) {} 66 65 … … 78 77 public: 79 78 class MapIt : public Item { 80 public: 81 82 typedef Item Parent; 79 typedef Item Parent; 80 81 public: 82 83 83 typedef typename Map::Value Value; 84 84 … … 117 117 118 118 class ConstMapIt : public Item { 119 public:120 121 typedef Item Parent;119 typedef Item Parent; 120 121 public: 122 122 123 123 typedef typename Map::Value Value; … … 148 148 149 149 class ItemIt : public Item { 150 public:151 152 typedef Item Parent;150 typedef Item Parent; 151 152 public: 153 153 154 154 ItemIt() {} … … 179 179 template <typename _Graph, typename _Map> 180 180 class SubMapExtender : public _Map { 181 public:182 183 181 typedef _Map Parent; 182 typedef _Graph GraphType; 183 184 public: 185 184 186 typedef SubMapExtender Map; 185 186 typedef _Graph Graph;187 188 187 typedef typename Parent::Key Item; 189 188 … … 201 200 public: 202 201 203 SubMapExtender(const Graph & _graph)202 SubMapExtender(const GraphType& _graph) 204 203 : Parent(_graph), graph(_graph) {} 205 204 206 SubMapExtender(const Graph & _graph, const Value& _value)205 SubMapExtender(const GraphType& _graph, const Value& _value) 207 206 : Parent(_graph, _value), graph(_graph) {} 208 207 … … 224 223 public: 225 224 class MapIt : public Item { 226 public:227 228 typedef Item Parent;225 typedef Item Parent; 226 227 public: 229 228 typedef typename Map::Value Value; 230 229 … … 263 262 264 263 class ConstMapIt : public Item { 265 public:266 267 typedef Item Parent;264 typedef Item Parent; 265 266 public: 268 267 269 268 typedef typename Map::Value Value; … … 294 293 295 294 class ItemIt : public Item { 296 public:297 298 typedef Item Parent;295 typedef Item Parent; 296 297 public: 299 298 300 299 ItemIt() {} … … 321 320 private: 322 321 323 const Graph & graph;322 const GraphType& graph; 324 323 325 324 }; -
lemon/bits/vector_map.h
r492 r617 57 57 58 58 // The graph type of the map. 59 typedef _Graph Graph ;59 typedef _Graph GraphType; 60 60 // The item type of the map. 61 61 typedef _Item Item; … … 73 73 // The map type. 74 74 typedef VectorMap Map; 75 // The base class of the map.76 typedef typename Notifier::ObserverBase Parent;77 75 78 76 // The reference type of the map; … … 81 79 typedef typename Container::const_reference ConstReference; 82 80 81 private: 82 83 // The base class of the map. 84 typedef typename Notifier::ObserverBase Parent; 85 86 public: 83 87 84 88 // \brief Constructor to attach the new map into the notifier. … … 86 90 // It constructs a map and attachs it into the notifier. 87 91 // It adds all the items of the graph to the map. 88 VectorMap(const Graph & graph) {92 VectorMap(const GraphType& graph) { 89 93 Parent::attach(graph.notifier(Item())); 90 94 container.resize(Parent::notifier()->maxId() + 1); … … 95 99 // It constructs a map uses a given value to initialize the map. 96 100 // It adds all the items of the graph to the map. 97 VectorMap(const Graph & graph, const Value& value) {101 VectorMap(const GraphType& graph, const Value& value) { 98 102 Parent::attach(graph.notifier(Item())); 99 103 container.resize(Parent::notifier()->maxId() + 1, value);
Note: See TracChangeset
for help on using the changeset viewer.