Changeset 209:765619b7cbb2 in lemon-main for lemon/concepts/digraph.h
- Timestamp:
- 07/13/08 20:51:02 (17 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/concepts/digraph.h
r125 r209 1 /* -*- C++-*-1 /* -*- mode: C++; indent-tabs-mode: nil; -*- 2 2 * 3 * This file is a part of LEMON, a generic C++ optimization library 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 5 * Copyright (C) 2003-2008 … … 47 47 private: 48 48 ///Digraphs are \e not copy constructible. Use DigraphCopy() instead. 49 49 50 50 ///Digraphs are \e not copy constructible. Use DigraphCopy() instead. 51 51 /// … … 53 53 ///\brief Assignment of \ref Digraph "Digraph"s to another ones are 54 54 ///\e not allowed. Use DigraphCopy() instead. 55 55 56 56 ///Assignment of \ref Digraph "Digraph"s to another ones are 57 57 ///\e not allowed. Use DigraphCopy() instead. … … 96 96 97 97 /// Inequality operator 98 98 99 99 /// \sa operator==(Node n) 100 100 /// 101 101 bool operator!=(Node) const { return true; } 102 102 103 104 105 106 107 108 109 110 111 112 113 }; 114 103 /// Artificial ordering operator. 104 105 /// To allow the use of digraph descriptors as key type in std::map or 106 /// similar associative container we require this. 107 /// 108 /// \note This operator only have to define some strict ordering of 109 /// the items; this order has nothing to do with the iteration 110 /// ordering of the items. 111 bool operator<(Node) const { return false; } 112 113 }; 114 115 115 /// This iterator goes through each node. 116 116 … … 130 130 NodeIt() { } 131 131 /// Copy constructor. 132 132 133 133 /// Copy constructor. 134 134 /// … … 146 146 /// Node -> NodeIt conversion. 147 147 148 /// Sets the iterator to the node of \c the digraph pointed by 149 150 /// This feature necessitates that each time we 148 /// Sets the iterator to the node of \c the digraph pointed by 149 /// the trivial iterator. 150 /// This feature necessitates that each time we 151 151 /// iterate the arc-set, the iteration order is the same. 152 152 NodeIt(const Digraph&, const Node&) { } … … 157 157 NodeIt& operator++() { return *this; } 158 158 }; 159 160 159 160 161 161 /// Class for identifying an arc of the digraph 162 162 … … 192 192 bool operator!=(Arc) const { return true; } 193 193 194 195 196 197 198 199 200 201 202 203 }; 204 194 /// Artificial ordering operator. 195 196 /// To allow the use of digraph descriptors as key type in std::map or 197 /// similar associative container we require this. 198 /// 199 /// \note This operator only have to define some strict ordering of 200 /// the items; this order has nothing to do with the iteration 201 /// ordering of the items. 202 bool operator<(Arc) const { return false; } 203 }; 204 205 205 /// This iterator goes trough the outgoing arcs of a node. 206 206 … … 214 214 /// for (Digraph::OutArcIt e(g, n); e!=INVALID; ++e) ++count; 215 215 ///\endcode 216 216 217 217 class OutArcIt : public Arc { 218 218 public: … … 233 233 OutArcIt(Invalid) { } 234 234 /// This constructor sets the iterator to the first outgoing arc. 235 235 236 236 /// This constructor sets the iterator to the first outgoing arc of 237 237 /// the node. … … 240 240 241 241 /// Sets the iterator to the value of the trivial iterator. 242 /// This feature necessitates that each time we 242 /// This feature necessitates that each time we 243 243 /// iterate the arc-set, the iteration order is the same. 244 244 OutArcIt(const Digraph&, const Arc&) { } 245 245 ///Next outgoing arc 246 247 /// Assign the iterator to the next 246 247 /// Assign the iterator to the next 248 248 /// outgoing arc of the corresponding node. 249 249 OutArcIt& operator++() { return *this; } … … 280 280 InArcIt(Invalid) { } 281 281 /// This constructor sets the iterator to first incoming arc. 282 282 283 283 /// This constructor set the iterator to the first incoming arc of 284 284 /// the node. … … 287 287 288 288 /// Sets the iterator to the value of the trivial iterator \c e. 289 /// This feature necessitates that each time we 289 /// This feature necessitates that each time we 290 290 /// iterate the arc-set, the iteration order is the same. 291 291 InArcIt(const Digraph&, const Arc&) { } … … 323 323 ArcIt(Invalid) { } 324 324 /// This constructor sets the iterator to the first arc. 325 325 326 326 /// This constructor sets the iterator to the first arc of \c g. 327 327 ///@param g the digraph … … 330 330 331 331 /// Sets the iterator to the value of the trivial iterator \c e. 332 /// This feature necessitates that each time we 332 /// This feature necessitates that each time we 333 333 /// iterate the arc-set, the iteration order is the same. 334 ArcIt(const Digraph&, const Arc&) { } 334 ArcIt(const Digraph&, const Arc&) { } 335 335 ///Next arc 336 336 337 337 /// Assign the iterator to the next arc. 338 338 ArcIt& operator++() { return *this; } … … 350 350 351 351 /// \brief Returns the ID of the node. 352 int id(Node) const { return -1; } 352 int id(Node) const { return -1; } 353 353 354 354 /// \brief Returns the ID of the arc. 355 int id(Arc) const { return -1; } 355 int id(Arc) const { return -1; } 356 356 357 357 /// \brief Returns the node with the given ID. 358 358 /// 359 359 /// \pre The argument should be a valid node ID in the graph. 360 Node nodeFromId(int) const { return INVALID; } 360 Node nodeFromId(int) const { return INVALID; } 361 361 362 362 /// \brief Returns the arc with the given ID. 363 363 /// 364 364 /// \pre The argument should be a valid arc ID in the graph. 365 Arc arcFromId(int) const { return INVALID; } 365 Arc arcFromId(int) const { return INVALID; } 366 366 367 367 /// \brief Returns an upper bound on the node IDs. 368 int maxNodeId() const { return -1; } 368 int maxNodeId() const { return -1; } 369 369 370 370 /// \brief Returns an upper bound on the arc IDs. 371 int maxArcId() const { return -1; } 371 int maxArcId() const { return -1; } 372 372 373 373 void first(Node&) const {} … … 390 390 391 391 // Dummy parameter. 392 int maxId(Node) const { return -1; } 392 int maxId(Node) const { return -1; } 393 393 // Dummy parameter. 394 int maxId(Arc) const { return -1; } 394 int maxId(Arc) const { return -1; } 395 395 396 396 /// \brief The base node of the iterator. … … 424 424 425 425 /// \brief Read write map of the nodes to type \c T. 426 /// 426 /// 427 427 /// ReadWrite map of the nodes to type \c T. 428 428 /// \sa Reference 429 template<class T> 429 template<class T> 430 430 class NodeMap : public ReadWriteMap< Node, T > { 431 431 public: … … 440 440 ///Assignment operator 441 441 template <typename CMap> 442 NodeMap& operator=(const CMap&) { 442 NodeMap& operator=(const CMap&) { 443 443 checkConcept<ReadMap<Node, T>, CMap>(); 444 return *this; 444 return *this; 445 445 } 446 446 }; … … 450 450 /// Reference map of the arcs to type \c T. 451 451 /// \sa Reference 452 template<class T> 452 template<class T> 453 453 class ArcMap : public ReadWriteMap<Arc,T> { 454 454 public: … … 462 462 ///Assignment operator 463 463 template <typename CMap> 464 ArcMap& operator=(const CMap&) { 464 ArcMap& operator=(const CMap&) { 465 465 checkConcept<ReadMap<Arc, T>, CMap>(); 466 return *this; 466 return *this; 467 467 } 468 468 }; … … 472 472 void constraints() { 473 473 checkConcept<IterableDigraphComponent<>, _Digraph>(); 474 474 checkConcept<IDableDigraphComponent<>, _Digraph>(); 475 475 checkConcept<MappableDigraphComponent<>, _Digraph>(); 476 476 } … … 478 478 479 479 }; 480 481 } //namespace concepts 480 481 } //namespace concepts 482 482 } //namespace lemon 483 483
Note: See TracChangeset
for help on using the changeset viewer.