COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
10/14/05 12:44:49 (19 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2245
Message:

Extending observer interface
It will be used in the indegmap, outdegmap types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/alteration_notifier.h

    r1701 r1718  
    140140
    141141      /// \brief The member function to notificate the observer about
    142       /// simulitem is added to the container.
    143       ///
    144       /// The add() member function notificates the observer about an item
     142      /// more item is added to the container.
     143      ///
     144      /// The add() member function notificates the observer about more item
    145145      /// is added to the container. It have to be overrided in the
    146146      /// subclasses.
     
    161161      virtual void erase(const Item&) = 0;
    162162
     163      /// \brief The member function to notificate the observer about
     164      /// more item is erased from the container.
     165      ///
     166      /// The erase() member function notificates the observer about more item
     167      /// is erased from the container. It have to be overrided in the
     168      /// subclasses.
    163169      virtual void erase(const std::vector<Item>& items) {
    164170        for (int i = 0; i < (int)items.size(); ++i) {
     
    166172        }
    167173      }
     174
     175      /// \brief Signal a property change on the given item.
     176      ///
     177      /// Signal a property change on the given item. It should
     178      /// be used always with the commitChange() function.
     179      /// This function is called always the property change.
     180      /// The commitChange() is called always after the change.
     181      virtual void signalChange(const Item&) {}
     182
     183      /// \brief Commit the property change on the given item.
     184      ///
     185      /// Commit the property change on the given item. It should
     186      /// be used always with the signalChange() function.
     187      /// This function is called always the property change.
     188      /// The commitChange() is called always after the change.
     189      virtual void commitChange(const Item&) {}
    168190
    169191      /// \brief The member function to notificate the observer about the
     
    304326    }
    305327   
     328    /// \brief Signal a property change on the given item.
     329    ///
     330    /// Signal a property change on the given item. It should
     331    /// be used always with the commitChange() function.
     332    /// This function is called always the property change.
     333    /// The commitChange() is called always after the change.
     334    void signalChange(const Item& item) {
     335      typename Container::iterator it;
     336      for (it = container.begin(); it != container.end(); ++it) {
     337        (*it)->signalChange(item);
     338      }
     339    }
     340   
     341    /// \brief Commit the property change on the given item.
     342    ///
     343    /// Commit the property change on the given item. It should
     344    /// be used always with the signalChange() function.
     345    /// This function is called always the property change.
     346    /// The commitChange() is called always after the change.
     347    void commitChange(const Item& item) {
     348      typename Container::iterator it;
     349      for (it = container.begin(); it != container.end(); ++it) {
     350        (*it)->commitChange(item);
     351      }
     352    }
    306353
    307354    /// \brief Notifies all the registered observers about the container is
Note: See TracChangeset for help on using the changeset viewer.