COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
05/14/05 19:20:40 (16 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1884
Message:

Handling simultan edge adding.
Fixed bug: directed edge maps for undir graphs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/bits/alteration_notifier.h

    r1359 r1414  
    3030  /// @{
    3131
    32   /// Registry class to register objects observes alterations in the graph.
    33 
     32  /// \brief Registry class to register objects observes alterations in
     33  /// the graph.
     34  ///
    3435  /// This class is a registry for the objects which observe the
    3536  /// alterations in a container. The alteration observers can be attached
     
    3940  ///
    4041  /// The most important application of the alteration observing is the
    41   /// dynamic map implementation when the observers are observing the
    42   /// alterations in the graph.
     42  /// dynamic map implementation.
    4343  ///
    4444  /// \param _Item The item type what the observers are observing, usually
     
    7575      friend class AlterationNotifier;
    7676
    77       /// Default constructor.
    78 
     77      /// \brief Default constructor.
     78      ///
    7979      /// Default constructor for ObserverBase.
    8080      ///
     
    8383      virtual ~ObserverBase() {}
    8484
    85       /// Attaches the observer into an AlterationNotifier.
    86 
     85      /// \brief Attaches the observer into an AlterationNotifier.
     86      ///
    8787      /// This member attaches the observer into an AlterationNotifier.
    8888      ///
     
    9292      }
    9393
    94       /// Detaches the observer into an AlterationNotifier.
    95 
     94      /// \brief Detaches the observer into an AlterationNotifier.
     95      ///
    9696      /// This member detaches the observer from an AlterationNotifier.
    9797      ///
     
    132132      /// subclasses.
    133133       
    134       virtual void add(const Item&) = 0;       
    135 
     134      virtual void add(const Item&) = 0;
     135
     136      /// \brief The member function to notificate the observer about
     137      /// simulitem is added to the container.
     138      ///
     139      /// The add() member function notificates the observer about an item
     140      /// is added to the container. It have to be overrided in the
     141      /// subclasses.
     142
     143      virtual void add(const std::vector<Item>& items) {
     144        for (int i = 0; i < (int)items.size(); ++i) {
     145          add(items[i]);
     146        }
     147      }
    136148
    137149      /// \brief The member function to notificate the observer about an
     
    143155       
    144156      virtual void erase(const Item&) = 0;
     157
     158      virtual void erase(const std::vector<Item>& items) {
     159        for (int i = 0; i < (int)items.size(); ++i) {
     160          add(items[i]);
     161        }
     162      }
    145163
    146164      /// \brief The member function to notificate the observer about the
     
    229247  public:
    230248       
    231     /// Notifies all the registered observers about an Item added to the container.
    232                
    233     /// It notifies all the registered observers about an Item added to the container.
     249    /// \brief Notifies all the registered observers about an Item added to
     250    /// the container.
     251    ///
     252    /// It notifies all the registered observers about an Item added to
     253    /// the container.
    234254    ///
    235     void add(const Item& key) {
    236       typename Container::iterator it;
    237       for (it = container.begin(); it != container.end(); ++it) {
    238         (*it)->add(key);
     255    void add(const Item& item) {
     256      typename Container::iterator it;
     257      for (it = container.begin(); it != container.end(); ++it) {
     258        (*it)->add(item);
    239259      }
    240260    }   
    241261
    242     /// Notifies all the registered observers about an Item erased from the container.
    243                
    244     /// It notifies all the registered observers about an Item erased from the container.
     262    /// \brief Notifies all the registered observers about more Item added to
     263    /// the container.
     264    ///
     265    /// It notifies all the registered observers about more Item added to
     266    /// the container.
     267    ///
     268    void add(const std::vector<Item>& items) {
     269      typename Container::iterator it;
     270      for (it = container.begin(); it != container.end(); ++it) {
     271        (*it)->add(items);
     272      }
     273    }   
     274
     275    /// \brief Notifies all the registered observers about an Item erased from
     276    /// the container.
     277    ///
     278    /// It notifies all the registered observers about an Item erased from
     279    /// the container.
    245280    ///
    246281    void erase(const Item& key) {
     
    250285      }
    251286    }
     287
     288    /// \brief Notifies all the registered observers about more Item erased 
     289    /// from the container.
     290    ///
     291    /// It notifies all the registered observers about more Item erased from
     292    /// the container.
     293    ///
     294    void erase(const std::vector<Item>& items) {
     295      typename Container::iterator it;
     296      for (it = container.begin(); it != container.end(); ++it) {
     297        (*it)->erase(items);
     298      }
     299    }
    252300   
    253301
    254     /// Notifies all the registered observers about the container is built.
    255                
     302    /// \brief Notifies all the registered observers about the container is
     303    /// built.
     304    ///         
    256305    /// Notifies all the registered observers about the container is built
    257306    /// from an empty container.
     
    264313
    265314
    266     /// Notifies all the registered observers about all Items are erased.
    267 
     315    /// \brief Notifies all the registered observers about all Items are
     316    /// erased.
     317    ///
    268318    /// Notifies all the registered observers about all Items are erased
    269319    /// from the container.
Note: See TracChangeset for help on using the changeset viewer.