1.1 --- a/lemon/bits/alteration_notifier.h Fri Oct 14 10:40:00 2005 +0000
1.2 +++ b/lemon/bits/alteration_notifier.h Fri Oct 14 10:44:49 2005 +0000
1.3 @@ -139,9 +139,9 @@
1.4 virtual void add(const Item&) = 0;
1.5
1.6 /// \brief The member function to notificate the observer about
1.7 - /// simulitem is added to the container.
1.8 + /// more item is added to the container.
1.9 ///
1.10 - /// The add() member function notificates the observer about an item
1.11 + /// The add() member function notificates the observer about more item
1.12 /// is added to the container. It have to be overrided in the
1.13 /// subclasses.
1.14
1.15 @@ -160,12 +160,34 @@
1.16
1.17 virtual void erase(const Item&) = 0;
1.18
1.19 + /// \brief The member function to notificate the observer about
1.20 + /// more item is erased from the container.
1.21 + ///
1.22 + /// The erase() member function notificates the observer about more item
1.23 + /// is erased from the container. It have to be overrided in the
1.24 + /// subclasses.
1.25 virtual void erase(const std::vector<Item>& items) {
1.26 for (int i = 0; i < (int)items.size(); ++i) {
1.27 erase(items[i]);
1.28 }
1.29 }
1.30
1.31 + /// \brief Signal a property change on the given item.
1.32 + ///
1.33 + /// Signal a property change on the given item. It should
1.34 + /// be used always with the commitChange() function.
1.35 + /// This function is called always the property change.
1.36 + /// The commitChange() is called always after the change.
1.37 + virtual void signalChange(const Item&) {}
1.38 +
1.39 + /// \brief Commit the property change on the given item.
1.40 + ///
1.41 + /// Commit the property change on the given item. It should
1.42 + /// be used always with the signalChange() function.
1.43 + /// This function is called always the property change.
1.44 + /// The commitChange() is called always after the change.
1.45 + virtual void commitChange(const Item&) {}
1.46 +
1.47 /// \brief The member function to notificate the observer about the
1.48 /// container is built.
1.49 ///
1.50 @@ -303,6 +325,31 @@
1.51 }
1.52 }
1.53
1.54 + /// \brief Signal a property change on the given item.
1.55 + ///
1.56 + /// Signal a property change on the given item. It should
1.57 + /// be used always with the commitChange() function.
1.58 + /// This function is called always the property change.
1.59 + /// The commitChange() is called always after the change.
1.60 + void signalChange(const Item& item) {
1.61 + typename Container::iterator it;
1.62 + for (it = container.begin(); it != container.end(); ++it) {
1.63 + (*it)->signalChange(item);
1.64 + }
1.65 + }
1.66 +
1.67 + /// \brief Commit the property change on the given item.
1.68 + ///
1.69 + /// Commit the property change on the given item. It should
1.70 + /// be used always with the signalChange() function.
1.71 + /// This function is called always the property change.
1.72 + /// The commitChange() is called always after the change.
1.73 + void commitChange(const Item& item) {
1.74 + typename Container::iterator it;
1.75 + for (it = container.begin(); it != container.end(); ++it) {
1.76 + (*it)->commitChange(item);
1.77 + }
1.78 + }
1.79
1.80 /// \brief Notifies all the registered observers about the container is
1.81 /// built.