lemon/bits/alteration_notifier.h
changeset 1924 9fdc893e2199
parent 1909 2d806130e700
child 1946 17eb3eaad9f8
equal deleted inserted replaced
10:3b9c89938c6b 11:f5cc4d01daf2
     1 /* -*- C++ -*-
     1 /* -*- C++ -*-
     2  * lemon/notifier.h - Part of LEMON, a generic C++ optimization library
     2  * lemon/notifier.h - Part of LEMON, a generic C++ optimization library
     3  *
     3  *
     4  * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     4  * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     5  * (Egervary Research Groin on Combinatorial Optimization, EGRES).
     6  *
     6  *
     7  * Permission to use, modify and distribute this software is granted
     7  * Permission to use, modify and distribute this software is granted
     8  * provided that this copyright notice appears in all copies. For
     8  * provided that this copyright notice appears in all copies. For
     9  * precise terms see the accompanying LICENSE file.
     9  * precise terms see the accompanying LICENSE file.
    10  *
    10  *
    18 #define LEMON_ALTERATION_OBSERVER_REGISTRY_H
    18 #define LEMON_ALTERATION_OBSERVER_REGISTRY_H
    19 
    19 
    20 #include <vector>
    20 #include <vector>
    21 #include <algorithm>
    21 #include <algorithm>
    22 
    22 
    23 ///\ingroup graphmapfactory
    23 ///\ingroin graphmapfactory
    24 ///\file
    24 ///\file
    25 ///\brief Observer registry for graph alteration observers.
    25 ///\brief Observer registry for graph alteration observers.
    26 
    26 
    27 namespace lemon {
    27 namespace lemon {
    28 
    28 
    29   /// \addtogroup graphmapfactory
    29   /// \addtogroin graphmapfactory
    30   /// @{
    30   /// @{
    31 
    31 
    32   /// \brief Registry class to register objects observes alterations in 
    32   /// \brief Registry class to register objects observes alterations in 
    33   /// the graph.
    33   /// the graph.
    34   ///
    34   ///
   499   };
   499   };
   500 
   500 
   501 
   501 
   502 
   502 
   503   template <typename _Base>
   503   template <typename _Base>
   504   class AlterableUBipartiteGraphExtender : public _Base {
   504   class AlterableBpUGraphExtender : public _Base {
   505   public:
   505   public:
   506 
   506 
   507     typedef _Base Parent;
   507     typedef _Base Parent;
   508     typedef AlterableUBipartiteGraphExtender Graph;
   508     typedef AlterableBpUGraphExtender Graph;
   509   
   509   
   510     typedef typename Parent::Node Node;
   510     typedef typename Parent::Node Node;
   511     typedef typename Parent::LowerNode LowerNode;
   511     typedef typename Parent::BNode BNode;
   512     typedef typename Parent::UpperNode UpperNode;
   512     typedef typename Parent::ANode ANode;
   513     typedef typename Parent::Edge Edge;
   513     typedef typename Parent::Edge Edge;
   514     typedef typename Parent::UEdge UEdge;
   514     typedef typename Parent::UEdge UEdge;
   515   
   515   
   516   
   516   
   517     typedef AlterationNotifier<Node> NodeNotifier;
   517     typedef AlterationNotifier<Node> NodeNotifier;
   518     typedef AlterationNotifier<LowerNode> LowerNodeNotifier;
   518     typedef AlterationNotifier<BNode> BNodeNotifier;
   519     typedef AlterationNotifier<UpperNode> UpperNodeNotifier;
   519     typedef AlterationNotifier<ANode> ANodeNotifier;
   520     typedef AlterationNotifier<Edge> EdgeNotifier;
   520     typedef AlterationNotifier<Edge> EdgeNotifier;
   521     typedef AlterationNotifier<UEdge> UEdgeNotifier;
   521     typedef AlterationNotifier<UEdge> UEdgeNotifier;
   522 
   522 
   523   protected:
   523   protected:
   524 
   524 
   525     mutable NodeNotifier nodeNotifier;
   525     mutable NodeNotifier nodeNotifier;
   526     mutable LowerNodeNotifier lowerNodeNotifier;
   526     mutable BNodeNotifier bNodeNotifier;
   527     mutable UpperNodeNotifier upperNodeNotifier;
   527     mutable ANodeNotifier aNodeNotifier;
   528     mutable EdgeNotifier edgeNotifier;
   528     mutable EdgeNotifier edgeNotifier;
   529     mutable UEdgeNotifier uEdgeNotifier;
   529     mutable UEdgeNotifier uEdgeNotifier;
   530 
   530 
   531   public:
   531   public:
   532 
   532 
   533     NodeNotifier& getNotifier(Node) const {
   533     NodeNotifier& getNotifier(Node) const {
   534       return nodeNotifier;
   534       return nodeNotifier;
   535     }
   535     }
   536 
   536 
   537     LowerNodeNotifier& getNotifier(LowerNode) const {
   537     BNodeNotifier& getNotifier(BNode) const {
   538       return lowerNodeNotifier;
   538       return bNodeNotifier;
   539     }
   539     }
   540 
   540 
   541     UpperNodeNotifier& getNotifier(UpperNode) const {
   541     ANodeNotifier& getNotifier(ANode) const {
   542       return upperNodeNotifier;
   542       return aNodeNotifier;
   543     }
   543     }
   544 
   544 
   545     EdgeNotifier& getNotifier(Edge) const {
   545     EdgeNotifier& getNotifier(Edge) const {
   546       return edgeNotifier;
   546       return edgeNotifier;
   547     }
   547     }
   548 
   548 
   549     UEdgeNotifier& getNotifier(UEdge) const {
   549     UEdgeNotifier& getNotifier(UEdge) const {
   550       return uEdgeNotifier;
   550       return uEdgeNotifier;
   551     }
   551     }
   552 
   552 
   553     ~AlterableUBipartiteGraphExtender() {
   553     ~AlterableBpUGraphExtender() {
   554       nodeNotifier.clear();
   554       nodeNotifier.clear();
   555       lowerNodeNotifier.clear();
   555       bNodeNotifier.clear();
   556       upperNodeNotifier.clear();
   556       aNodeNotifier.clear();
   557       edgeNotifier.clear();
   557       edgeNotifier.clear();
   558       uEdgeNotifier.clear();
   558       uEdgeNotifier.clear();
   559     }
   559     }
   560 
   560 
   561   };
   561   };