Changeset 1414:01d9d6bc1284 in lemon-0.x for src/lemon/bits/alteration_notifier.h
- Timestamp:
- 05/14/05 19:20:40 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1884
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/bits/alteration_notifier.h
r1359 r1414 30 30 /// @{ 31 31 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 /// 34 35 /// This class is a registry for the objects which observe the 35 36 /// alterations in a container. The alteration observers can be attached … … 39 40 /// 40 41 /// 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. 43 43 /// 44 44 /// \param _Item The item type what the observers are observing, usually … … 75 75 friend class AlterationNotifier; 76 76 77 /// Default constructor.78 77 /// \brief Default constructor. 78 /// 79 79 /// Default constructor for ObserverBase. 80 80 /// … … 83 83 virtual ~ObserverBase() {} 84 84 85 /// Attaches the observer into an AlterationNotifier.86 85 /// \brief Attaches the observer into an AlterationNotifier. 86 /// 87 87 /// This member attaches the observer into an AlterationNotifier. 88 88 /// … … 92 92 } 93 93 94 /// Detaches the observer into an AlterationNotifier.95 94 /// \brief Detaches the observer into an AlterationNotifier. 95 /// 96 96 /// This member detaches the observer from an AlterationNotifier. 97 97 /// … … 132 132 /// subclasses. 133 133 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 } 136 148 137 149 /// \brief The member function to notificate the observer about an … … 143 155 144 156 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 } 145 163 146 164 /// \brief The member function to notificate the observer about the … … 229 247 public: 230 248 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. 234 254 /// 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); 239 259 } 240 260 } 241 261 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. 245 280 /// 246 281 void erase(const Item& key) { … … 250 285 } 251 286 } 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 } 252 300 253 301 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 /// 256 305 /// Notifies all the registered observers about the container is built 257 306 /// from an empty container. … … 264 313 265 314 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 /// 268 318 /// Notifies all the registered observers about all Items are erased 269 319 /// from the container.
Note: See TracChangeset
for help on using the changeset viewer.