lemon/bits/edge_set_extender.h
changeset 613 b1811c363299
parent 519 c786cd201266
child 617 4137ef9aacc6
equal deleted inserted replaced
1:1b3c491906e9 2:003580a06207
    22 #include <lemon/core.h>
    22 #include <lemon/core.h>
    23 #include <lemon/error.h>
    23 #include <lemon/error.h>
    24 #include <lemon/bits/default_map.h>
    24 #include <lemon/bits/default_map.h>
    25 #include <lemon/bits/map_extender.h>
    25 #include <lemon/bits/map_extender.h>
    26 
    26 
    27 ///\ingroup digraphbits
    27 //\ingroup digraphbits
    28 ///\file
    28 //\file
    29 ///\brief Extenders for the arc set types
    29 //\brief Extenders for the arc set types
    30 namespace lemon {
    30 namespace lemon {
    31 
    31 
    32   /// \ingroup digraphbits
    32   // \ingroup digraphbits
    33   ///
    33   //
    34   /// \brief Extender for the ArcSets
    34   // \brief Extender for the ArcSets
    35   template <typename Base>
    35   template <typename Base>
    36   class ArcSetExtender : public Base {
    36   class ArcSetExtender : public Base {
    37   public:
    37   public:
    38 
    38 
    39     typedef Base Parent;
    39     typedef Base Parent;
    70     }
    70     }
    71 
    71 
    72 
    72 
    73     // Alteration notifier extensions
    73     // Alteration notifier extensions
    74 
    74 
    75     /// The arc observer registry.
    75     // The arc observer registry.
    76     typedef AlterationNotifier<ArcSetExtender, Arc> ArcNotifier;
    76     typedef AlterationNotifier<ArcSetExtender, Arc> ArcNotifier;
    77 
    77 
    78   protected:
    78   protected:
    79 
    79 
    80     mutable ArcNotifier arc_notifier;
    80     mutable ArcNotifier arc_notifier;
    81 
    81 
    82   public:
    82   public:
    83 
    83 
    84     using Parent::notifier;
    84     using Parent::notifier;
    85 
    85 
    86     /// \brief Gives back the arc alteration notifier.
    86     // Gives back the arc alteration notifier.
    87     ///
       
    88     /// Gives back the arc alteration notifier.
       
    89     ArcNotifier& notifier(Arc) const {
    87     ArcNotifier& notifier(Arc) const {
    90       return arc_notifier;
    88       return arc_notifier;
    91     }
    89     }
    92 
    90 
    93     // Iterable extensions
    91     // Iterable extensions
   183 	return *this; 
   181 	return *this; 
   184       }
   182       }
   185 
   183 
   186     };
   184     };
   187 
   185 
   188     /// \brief Base node of the iterator
   186     // \brief Base node of the iterator
   189     ///
   187     //
   190     /// Returns the base node (ie. the source in this case) of the iterator
   188     // Returns the base node (ie. the source in this case) of the iterator
   191     Node baseNode(const OutArcIt &e) const {
   189     Node baseNode(const OutArcIt &e) const {
   192       return Parent::source(static_cast<const Arc&>(e));
   190       return Parent::source(static_cast<const Arc&>(e));
   193     }
   191     }
   194     /// \brief Running node of the iterator
   192     // \brief Running node of the iterator
   195     ///
   193     //
   196     /// Returns the running node (ie. the target in this case) of the
   194     // Returns the running node (ie. the target in this case) of the
   197     /// iterator
   195     // iterator
   198     Node runningNode(const OutArcIt &e) const {
   196     Node runningNode(const OutArcIt &e) const {
   199       return Parent::target(static_cast<const Arc&>(e));
   197       return Parent::target(static_cast<const Arc&>(e));
   200     }
   198     }
   201 
   199 
   202     /// \brief Base node of the iterator
   200     // \brief Base node of the iterator
   203     ///
   201     //
   204     /// Returns the base node (ie. the target in this case) of the iterator
   202     // Returns the base node (ie. the target in this case) of the iterator
   205     Node baseNode(const InArcIt &e) const {
   203     Node baseNode(const InArcIt &e) const {
   206       return Parent::target(static_cast<const Arc&>(e));
   204       return Parent::target(static_cast<const Arc&>(e));
   207     }
   205     }
   208     /// \brief Running node of the iterator
   206     // \brief Running node of the iterator
   209     ///
   207     //
   210     /// Returns the running node (ie. the source in this case) of the
   208     // Returns the running node (ie. the source in this case) of the
   211     /// iterator
   209     // iterator
   212     Node runningNode(const InArcIt &e) const {
   210     Node runningNode(const InArcIt &e) const {
   213       return Parent::source(static_cast<const Arc&>(e));
   211       return Parent::source(static_cast<const Arc&>(e));
   214     }
   212     }
   215 
   213 
   216     using Parent::first;
   214     using Parent::first;
   269     }
   267     }
   270 
   268 
   271   };
   269   };
   272 
   270 
   273 
   271 
   274   /// \ingroup digraphbits
   272   // \ingroup digraphbits
   275   ///
   273   //
   276   /// \brief Extender for the EdgeSets
   274   // \brief Extender for the EdgeSets
   277   template <typename Base>
   275   template <typename Base>
   278   class EdgeSetExtender : public Base {
   276   class EdgeSetExtender : public Base {
   279 
   277 
   280   public:
   278   public:
   281 
   279 
   490 	digraph->nextInc(*this, direction);
   488 	digraph->nextInc(*this, direction);
   491 	return *this; 
   489 	return *this; 
   492       }
   490       }
   493     };
   491     };
   494 
   492 
   495     /// \brief Base node of the iterator
   493     // \brief Base node of the iterator
   496     ///
   494     //
   497     /// Returns the base node (ie. the source in this case) of the iterator
   495     // Returns the base node (ie. the source in this case) of the iterator
   498     Node baseNode(const OutArcIt &e) const {
   496     Node baseNode(const OutArcIt &e) const {
   499       return Parent::source(static_cast<const Arc&>(e));
   497       return Parent::source(static_cast<const Arc&>(e));
   500     }
   498     }
   501     /// \brief Running node of the iterator
   499     // \brief Running node of the iterator
   502     ///
   500     //
   503     /// Returns the running node (ie. the target in this case) of the
   501     // Returns the running node (ie. the target in this case) of the
   504     /// iterator
   502     // iterator
   505     Node runningNode(const OutArcIt &e) const {
   503     Node runningNode(const OutArcIt &e) const {
   506       return Parent::target(static_cast<const Arc&>(e));
   504       return Parent::target(static_cast<const Arc&>(e));
   507     }
   505     }
   508 
   506 
   509     /// \brief Base node of the iterator
   507     // \brief Base node of the iterator
   510     ///
   508     //
   511     /// Returns the base node (ie. the target in this case) of the iterator
   509     // Returns the base node (ie. the target in this case) of the iterator
   512     Node baseNode(const InArcIt &e) const {
   510     Node baseNode(const InArcIt &e) const {
   513       return Parent::target(static_cast<const Arc&>(e));
   511       return Parent::target(static_cast<const Arc&>(e));
   514     }
   512     }
   515     /// \brief Running node of the iterator
   513     // \brief Running node of the iterator
   516     ///
   514     //
   517     /// Returns the running node (ie. the source in this case) of the
   515     // Returns the running node (ie. the source in this case) of the
   518     /// iterator
   516     // iterator
   519     Node runningNode(const InArcIt &e) const {
   517     Node runningNode(const InArcIt &e) const {
   520       return Parent::source(static_cast<const Arc&>(e));
   518       return Parent::source(static_cast<const Arc&>(e));
   521     }
   519     }
   522 
   520 
   523     /// Base node of the iterator
   521     // Base node of the iterator
   524     ///
   522     //
   525     /// Returns the base node of the iterator
   523     // Returns the base node of the iterator
   526     Node baseNode(const IncEdgeIt &e) const {
   524     Node baseNode(const IncEdgeIt &e) const {
   527       return e.direction ? u(e) : v(e);
   525       return e.direction ? u(e) : v(e);
   528     }
   526     }
   529     /// Running node of the iterator
   527     // Running node of the iterator
   530     ///
   528     //
   531     /// Returns the running node of the iterator
   529     // Returns the running node of the iterator
   532     Node runningNode(const IncEdgeIt &e) const {
   530     Node runningNode(const IncEdgeIt &e) const {
   533       return e.direction ? v(e) : u(e);
   531       return e.direction ? v(e) : u(e);
   534     }
   532     }
   535 
   533 
   536 
   534