Changeset 2384:805c5a2a36dd in lemon-0.x
- Timestamp:
- 03/01/07 18:14:24 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3215
- Location:
- lemon
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/alteration_notifier.h
r2305 r2384 144 144 /// Default constructor for ObserverBase. 145 145 /// 146 ObserverBase() : notifier(0) {}146 ObserverBase() : _notifier(0) {} 147 147 148 148 /// \brief Constructor which attach the observer into notifier. 149 149 /// 150 150 /// Constructor which attach the observer into notifier. 151 ObserverBase(AlterationNotifier& _notifier) {152 attach( _notifier);151 ObserverBase(AlterationNotifier& notifier) { 152 attach(notifier); 153 153 } 154 154 … … 159 159 ObserverBase(const ObserverBase& copy) { 160 160 if (copy.attached()) { 161 attach(*copy. getNotifier());161 attach(*copy._notifier()); 162 162 } 163 163 } … … 174 174 /// This member attaches the observer into an AlterationNotifier. 175 175 /// 176 void attach(AlterationNotifier& _notifier) {177 _notifier.attach(*this);176 void attach(AlterationNotifier& notifier) { 177 notifier.attach(*this); 178 178 } 179 179 … … 183 183 /// 184 184 void detach() { 185 notifier->detach(*this);185 _notifier->detach(*this); 186 186 } 187 187 … … 192 192 /// attached into. 193 193 /// 194 Notifier* getNotifier() const { return const_cast<Notifier*>(notifier); }194 Notifier* notifier() const { return const_cast<Notifier*>(_notifier); } 195 195 196 196 /// Gives back true when the observer is attached into a notifier. 197 bool attached() const { return notifier != 0; }197 bool attached() const { return _notifier != 0; } 198 198 199 199 private: … … 203 203 protected: 204 204 205 Notifier* notifier;206 typename std::list<ObserverBase*>::iterator index;205 Notifier* _notifier; 206 typename std::list<ObserverBase*>::iterator _index; 207 207 208 208 /// \brief The member function to notificate the observer about an … … 262 262 263 263 typedef std::list<ObserverBase*> Observers; 264 Observers observers;264 Observers _observers; 265 265 266 266 … … 294 294 ~AlterationNotifier() { 295 295 typename Observers::iterator it; 296 for (it = observers.begin(); it !=observers.end(); ++it) {297 (*it)-> notifier = 0;296 for (it = _observers.begin(); it != _observers.end(); ++it) { 297 (*it)->_notifier = 0; 298 298 } 299 299 } … … 347 347 348 348 void attach(ObserverBase& observer) { 349 observer. index = observers.insert(observers.begin(), &observer);350 observer. notifier = this;349 observer._index = _observers.insert(_observers.begin(), &observer); 350 observer._notifier = this; 351 351 } 352 352 353 353 void detach(ObserverBase& observer) { 354 observers.erase(observer.index);355 observer. index =observers.end();356 observer. notifier = 0;354 _observers.erase(observer._index); 355 observer._index = _observers.end(); 356 observer._notifier = 0; 357 357 } 358 358 … … 368 368 typename Observers::reverse_iterator it; 369 369 try { 370 for (it = observers.rbegin(); it !=observers.rend(); ++it) {370 for (it = _observers.rbegin(); it != _observers.rend(); ++it) { 371 371 (*it)->add(item); 372 372 } 373 373 } catch (...) { 374 374 typename Observers::iterator jt; 375 for (jt = it.base(); jt != observers.end(); ++jt) {375 for (jt = it.base(); jt != _observers.end(); ++jt) { 376 376 (*jt)->erase(item); 377 377 } … … 389 389 typename Observers::reverse_iterator it; 390 390 try { 391 for (it = observers.rbegin(); it !=observers.rend(); ++it) {391 for (it = _observers.rbegin(); it != _observers.rend(); ++it) { 392 392 (*it)->add(items); 393 393 } 394 394 } catch (...) { 395 395 typename Observers::iterator jt; 396 for (jt = it.base(); jt != observers.end(); ++jt) {396 for (jt = it.base(); jt != _observers.end(); ++jt) { 397 397 (*jt)->erase(items); 398 398 } … … 408 408 /// 409 409 void erase(const Item& item) throw() { 410 typename Observers::iterator it = observers.begin();411 while (it != observers.end()) {410 typename Observers::iterator it = _observers.begin(); 411 while (it != _observers.end()) { 412 412 try { 413 413 (*it)->erase(item); 414 414 ++it; 415 415 } catch (const ImmediateDetach&) { 416 it = observers.erase(it);417 (*it)-> index =observers.end();418 (*it)-> notifier = 0;416 it = _observers.erase(it); 417 (*it)->_index = _observers.end(); 418 (*it)->_notifier = 0; 419 419 } 420 420 } … … 428 428 /// 429 429 void erase(const std::vector<Item>& items) { 430 typename Observers::iterator it = observers.begin();431 while (it != observers.end()) {430 typename Observers::iterator it = _observers.begin(); 431 while (it != _observers.end()) { 432 432 try { 433 433 (*it)->erase(items); 434 434 ++it; 435 435 } catch (const ImmediateDetach&) { 436 it = observers.erase(it);437 (*it)-> index =observers.end();438 (*it)-> notifier = 0;436 it = _observers.erase(it); 437 (*it)->_index = _observers.end(); 438 (*it)->_notifier = 0; 439 439 } 440 440 } … … 449 449 typename Observers::reverse_iterator it; 450 450 try { 451 for (it = observers.rbegin(); it !=observers.rend(); ++it) {451 for (it = _observers.rbegin(); it != _observers.rend(); ++it) { 452 452 (*it)->build(); 453 453 } 454 454 } catch (...) { 455 455 typename Observers::iterator jt; 456 for (jt = it.base(); jt != observers.end(); ++jt) {456 for (jt = it.base(); jt != _observers.end(); ++jt) { 457 457 (*jt)->clear(); 458 458 } … … 467 467 /// from the container. 468 468 void clear() { 469 typename Observers::iterator it = observers.begin();470 while (it != observers.end()) {469 typename Observers::iterator it = _observers.begin(); 470 while (it != _observers.end()) { 471 471 try { 472 472 (*it)->clear(); 473 473 ++it; 474 474 } catch (const ImmediateDetach&) { 475 it = observers.erase(it);476 (*it)-> index =observers.end();477 (*it)-> notifier = 0;475 it = _observers.erase(it); 476 (*it)->_index = _observers.end(); 477 (*it)->_notifier = 0; 478 478 } 479 479 } -
lemon/bits/array_map.h
r2260 r2384 80 80 /// Graph initialized map constructor. 81 81 explicit ArrayMap(const Graph& graph) { 82 Parent::attach(graph. getNotifier(Item()));82 Parent::attach(graph.notifier(Item())); 83 83 allocate_memory(); 84 Notifier* notifier = Parent:: getNotifier();84 Notifier* notifier = Parent::notifier(); 85 85 Item it; 86 86 for (notifier->first(it); it != INVALID; notifier->next(it)) { … … 94 94 /// It constructs a map and initialize all of the the map. 95 95 ArrayMap(const Graph& graph, const Value& value) { 96 Parent::attach(graph. getNotifier(Item()));96 Parent::attach(graph.notifier(Item())); 97 97 allocate_memory(); 98 Notifier* notifier = Parent:: getNotifier();98 Notifier* notifier = Parent::notifier(); 99 99 Item it; 100 100 for (notifier->first(it); it != INVALID; notifier->next(it)) { … … 109 109 ArrayMap(const ArrayMap& copy) : Parent() { 110 110 if (copy.attached()) { 111 attach(*copy. getNotifier());111 attach(*copy.notifier()); 112 112 } 113 113 capacity = copy.capacity; 114 114 if (capacity == 0) return; 115 115 values = allocator.allocate(capacity); 116 Notifier* notifier = Parent:: getNotifier();116 Notifier* notifier = Parent::notifier(); 117 117 Item it; 118 118 for (notifier->first(it); it != INVALID; notifier->next(it)) { … … 143 143 ArrayMap& operator=(const CMap& cmap) { 144 144 checkConcept<concepts::ReadMap<Key, _Value>, CMap>(); 145 const typename Parent::Notifier* notifier = Parent:: getNotifier();145 const typename Parent::Notifier* notifier = Parent::notifier(); 146 146 Item it; 147 147 for (notifier->first(it); it != INVALID; notifier->next(it)) { … … 174 174 /// actual keys of the graph. 175 175 Value& operator[](const Key& key) { 176 int id = Parent:: getNotifier()->id(key);176 int id = Parent::notifier()->id(key); 177 177 return values[id]; 178 178 } … … 183 183 /// actual keys of the graph. 184 184 const Value& operator[](const Key& key) const { 185 int id = Parent:: getNotifier()->id(key);185 int id = Parent::notifier()->id(key); 186 186 return values[id]; 187 187 } … … 202 202 /// and it overrides the add() member function of the observer base. 203 203 virtual void add(const Key& key) { 204 Notifier* notifier = Parent:: getNotifier();204 Notifier* notifier = Parent::notifier(); 205 205 int id = notifier->id(key); 206 206 if (id >= capacity) { … … 230 230 /// and it overrides the add() member function of the observer base. 231 231 virtual void add(const std::vector<Key>& keys) { 232 Notifier* notifier = Parent:: getNotifier();232 Notifier* notifier = Parent::notifier(); 233 233 int max_id = -1; 234 234 for (int i = 0; i < (int)keys.size(); ++i) { … … 274 274 /// and it overrides the erase() member function of the observer base. 275 275 virtual void erase(const Key& key) { 276 int id = Parent:: getNotifier()->id(key);276 int id = Parent::notifier()->id(key); 277 277 allocator.destroy(&(values[id])); 278 278 } … … 284 284 virtual void erase(const std::vector<Key>& keys) { 285 285 for (int i = 0; i < (int)keys.size(); ++i) { 286 int id = Parent:: getNotifier()->id(keys[i]);286 int id = Parent::notifier()->id(keys[i]); 287 287 allocator.destroy(&(values[id])); 288 288 } … … 294 294 /// and it overrides the build() member function of the observer base. 295 295 virtual void build() { 296 Notifier* notifier = Parent:: getNotifier();296 Notifier* notifier = Parent::notifier(); 297 297 allocate_memory(); 298 298 Item it; … … 308 308 /// and it overrides the clear() member function of the observer base. 309 309 virtual void clear() { 310 Notifier* notifier = Parent:: getNotifier();310 Notifier* notifier = Parent::notifier(); 311 311 if (capacity != 0) { 312 312 Item it; … … 323 323 324 324 void allocate_memory() { 325 int max_id = Parent:: getNotifier()->maxId();325 int max_id = Parent::notifier()->maxId(); 326 326 if (max_id == -1) { 327 327 capacity = 0; -
lemon/bits/debug_map.h
r2333 r2384 112 112 /// It adds all the items of the graph to the map. 113 113 DebugMap(const Graph& graph) { 114 Parent::attach(graph. getNotifier(Item()));115 container.resize(Parent:: getNotifier()->maxId() + 1);116 flag.resize(Parent:: getNotifier()->maxId() + 1, false);117 const typename Parent::Notifier* notifier = Parent:: getNotifier();118 Item it; 119 for (notifier->first(it); it != INVALID; notifier->next(it)) { 120 flag[Parent:: getNotifier()->id(it)] = true;114 Parent::attach(graph.notifier(Item())); 115 container.resize(Parent::notifier()->maxId() + 1); 116 flag.resize(Parent::notifier()->maxId() + 1, false); 117 const typename Parent::Notifier* notifier = Parent::notifier(); 118 Item it; 119 for (notifier->first(it); it != INVALID; notifier->next(it)) { 120 flag[Parent::notifier()->id(it)] = true; 121 121 } 122 122 } … … 127 127 /// It adds all the items of the graph to the map. 128 128 DebugMap(const Graph& graph, const Value& value) { 129 Parent::attach(graph. getNotifier(Item()));130 container.resize(Parent:: getNotifier()->maxId() + 1, value);131 flag.resize(Parent:: getNotifier()->maxId() + 1, false);132 const typename Parent::Notifier* notifier = Parent:: getNotifier();133 Item it; 134 for (notifier->first(it); it != INVALID; notifier->next(it)) { 135 flag[Parent:: getNotifier()->id(it)] = true;129 Parent::attach(graph.notifier(Item())); 130 container.resize(Parent::notifier()->maxId() + 1, value); 131 flag.resize(Parent::notifier()->maxId() + 1, false); 132 const typename Parent::Notifier* notifier = Parent::notifier(); 133 Item it; 134 for (notifier->first(it); it != INVALID; notifier->next(it)) { 135 flag[Parent::notifier()->id(it)] = true; 136 136 } 137 137 } … … 142 142 DebugMap(const DebugMap& _copy) : Parent() { 143 143 if (_copy.attached()) { 144 Parent::attach(*_copy. getNotifier());144 Parent::attach(*_copy.notifier()); 145 145 container = _copy.container; 146 146 } 147 flag.resize(Parent:: getNotifier()->maxId() + 1, false);148 const typename Parent::Notifier* notifier = Parent:: getNotifier();149 Item it; 150 for (notifier->first(it); it != INVALID; notifier->next(it)) { 151 flag[Parent:: getNotifier()->id(it)] = true;152 LEMON_ASSERT(_copy.flag[Parent:: getNotifier()->id(it)], MapError());147 flag.resize(Parent::notifier()->maxId() + 1, false); 148 const typename Parent::Notifier* notifier = Parent::notifier(); 149 Item it; 150 for (notifier->first(it); it != INVALID; notifier->next(it)) { 151 flag[Parent::notifier()->id(it)] = true; 152 LEMON_ASSERT(_copy.flag[Parent::notifier()->id(it)], MapError()); 153 153 } 154 154 } … … 158 158 /// Destructor. 159 159 ~DebugMap() { 160 const typename Parent::Notifier* notifier = Parent:: getNotifier();160 const typename Parent::Notifier* notifier = Parent::notifier(); 161 161 if (notifier != 0) { 162 162 Item it; 163 163 for (notifier->first(it); it != INVALID; notifier->next(it)) { 164 LEMON_ASSERT(flag[Parent:: getNotifier()->id(it)], MapError());165 flag[Parent:: getNotifier()->id(it)] = false;164 LEMON_ASSERT(flag[Parent::notifier()->id(it)], MapError()); 165 flag[Parent::notifier()->id(it)] = false; 166 166 } 167 167 } … … 192 192 DebugMap& operator=(const CMap& cmap) { 193 193 checkConcept<concepts::ReadMap<Key, _Value>, CMap>(); 194 const typename Parent::Notifier* notifier = Parent:: getNotifier();194 const typename Parent::Notifier* notifier = Parent::notifier(); 195 195 Item it; 196 196 for (notifier->first(it); it != INVALID; notifier->next(it)) { … … 207 207 /// actual items of the graph. 208 208 Reference operator[](const Key& key) { 209 LEMON_ASSERT(flag[Parent:: getNotifier()->id(key)], MapError());210 return container[Parent:: getNotifier()->id(key)];209 LEMON_ASSERT(flag[Parent::notifier()->id(key)], MapError()); 210 return container[Parent::notifier()->id(key)]; 211 211 } 212 212 … … 216 216 /// actual items of the graph. 217 217 ConstReference operator[](const Key& key) const { 218 LEMON_ASSERT(flag[Parent:: getNotifier()->id(key)], MapError());219 return container[Parent:: getNotifier()->id(key)];218 LEMON_ASSERT(flag[Parent::notifier()->id(key)], MapError()); 219 return container[Parent::notifier()->id(key)]; 220 220 } 221 221 … … 235 235 /// and it overrides the add() member function of the observer base. 236 236 virtual void add(const Key& key) { 237 int id = Parent:: getNotifier()->id(key);237 int id = Parent::notifier()->id(key); 238 238 if (id >= (int)container.size()) { 239 239 container.resize(id + 1); 240 240 flag.resize(id + 1, false); 241 241 } 242 LEMON_ASSERT(!flag[Parent:: getNotifier()->id(key)], MapError());243 flag[Parent:: getNotifier()->id(key)] = true;242 LEMON_ASSERT(!flag[Parent::notifier()->id(key)], MapError()); 243 flag[Parent::notifier()->id(key)] = true; 244 244 if (strictCheck) { 245 245 std::vector<bool> fl(flag.size(), false); 246 const typename Parent::Notifier* notifier = Parent:: getNotifier();247 Item it; 248 for (notifier->first(it); it != INVALID; notifier->next(it)) { 249 int id = Parent:: getNotifier()->id(it);246 const typename Parent::Notifier* notifier = Parent::notifier(); 247 Item it; 248 for (notifier->first(it); it != INVALID; notifier->next(it)) { 249 int id = Parent::notifier()->id(it); 250 250 fl[id] = true; 251 251 } … … 261 261 int max = container.size() - 1; 262 262 for (int i = 0; i < (int)keys.size(); ++i) { 263 int id = Parent:: getNotifier()->id(keys[i]);263 int id = Parent::notifier()->id(keys[i]); 264 264 if (id >= max) { 265 265 max = id; … … 269 269 flag.resize(max + 1, false); 270 270 for (int i = 0; i < (int)keys.size(); ++i) { 271 LEMON_ASSERT(!flag[Parent:: getNotifier()->id(keys[i])], MapError());272 flag[Parent:: getNotifier()->id(keys[i])] = true;271 LEMON_ASSERT(!flag[Parent::notifier()->id(keys[i])], MapError()); 272 flag[Parent::notifier()->id(keys[i])] = true; 273 273 } 274 274 if (strictCheck) { 275 275 std::vector<bool> fl(flag.size(), false); 276 const typename Parent::Notifier* notifier = Parent:: getNotifier();277 Item it; 278 for (notifier->first(it); it != INVALID; notifier->next(it)) { 279 int id = Parent:: getNotifier()->id(it);276 const typename Parent::Notifier* notifier = Parent::notifier(); 277 Item it; 278 for (notifier->first(it); it != INVALID; notifier->next(it)) { 279 int id = Parent::notifier()->id(it); 280 280 fl[id] = true; 281 281 } … … 291 291 if (strictCheck) { 292 292 std::vector<bool> fl(flag.size(), false); 293 const typename Parent::Notifier* notifier = Parent:: getNotifier();294 Item it; 295 for (notifier->first(it); it != INVALID; notifier->next(it)) { 296 int id = Parent:: getNotifier()->id(it);293 const typename Parent::Notifier* notifier = Parent::notifier(); 294 Item it; 295 for (notifier->first(it); it != INVALID; notifier->next(it)) { 296 int id = Parent::notifier()->id(it); 297 297 fl[id] = true; 298 298 } 299 299 LEMON_ASSERT(fl == flag, MapError()); 300 300 } 301 container[Parent:: getNotifier()->id(key)] = Value();302 LEMON_ASSERT(flag[Parent:: getNotifier()->id(key)], MapError());303 flag[Parent:: getNotifier()->id(key)] = false;301 container[Parent::notifier()->id(key)] = Value(); 302 LEMON_ASSERT(flag[Parent::notifier()->id(key)], MapError()); 303 flag[Parent::notifier()->id(key)] = false; 304 304 } 305 305 … … 311 311 if (strictCheck) { 312 312 std::vector<bool> fl(flag.size(), false); 313 const typename Parent::Notifier* notifier = Parent:: getNotifier();314 Item it; 315 for (notifier->first(it); it != INVALID; notifier->next(it)) { 316 int id = Parent:: getNotifier()->id(it);313 const typename Parent::Notifier* notifier = Parent::notifier(); 314 Item it; 315 for (notifier->first(it); it != INVALID; notifier->next(it)) { 316 int id = Parent::notifier()->id(it); 317 317 fl[id] = true; 318 318 } … … 320 320 } 321 321 for (int i = 0; i < (int)keys.size(); ++i) { 322 container[Parent:: getNotifier()->id(keys[i])] = Value();323 LEMON_ASSERT(flag[Parent:: getNotifier()->id(keys[i])], MapError());324 flag[Parent:: getNotifier()->id(keys[i])] = false;322 container[Parent::notifier()->id(keys[i])] = Value(); 323 LEMON_ASSERT(flag[Parent::notifier()->id(keys[i])], MapError()); 324 flag[Parent::notifier()->id(keys[i])] = false; 325 325 } 326 326 } … … 336 336 } 337 337 } 338 int size = Parent:: getNotifier()->maxId() + 1;338 int size = Parent::notifier()->maxId() + 1; 339 339 container.reserve(size); 340 340 container.resize(size); 341 341 flag.reserve(size); 342 342 flag.resize(size, false); 343 const typename Parent::Notifier* notifier = Parent:: getNotifier();344 Item it; 345 for (notifier->first(it); it != INVALID; notifier->next(it)) { 346 int id = Parent:: getNotifier()->id(it);343 const typename Parent::Notifier* notifier = Parent::notifier(); 344 Item it; 345 for (notifier->first(it); it != INVALID; notifier->next(it)) { 346 int id = Parent::notifier()->id(it); 347 347 LEMON_ASSERT(!flag[id], MapError()); 348 348 flag[id] = true; … … 355 355 /// and it overrides the clear() member function of the observer base. 356 356 virtual void clear() { 357 const typename Parent::Notifier* notifier = Parent:: getNotifier();358 Item it; 359 for (notifier->first(it); it != INVALID; notifier->next(it)) { 360 int id = Parent:: getNotifier()->id(it);357 const typename Parent::Notifier* notifier = Parent::notifier(); 358 Item it; 359 for (notifier->first(it); it != INVALID; notifier->next(it)) { 360 int id = Parent::notifier()->id(it); 361 361 LEMON_ASSERT(flag[id], MapError()); 362 362 flag[id] = false; -
lemon/bits/edge_set_extender.h
r2046 r2384 82 82 public: 83 83 84 using Parent:: getNotifier;84 using Parent::notifier; 85 85 86 86 /// \brief Gives back the edge alteration notifier. 87 87 /// 88 88 /// Gives back the edge alteration notifier. 89 EdgeNotifier& getNotifier(Edge) const {89 EdgeNotifier& notifier(Edge) const { 90 90 return edge_notifier; 91 91 } … … 247 247 Edge addEdge(const Node& from, const Node& to) { 248 248 Edge edge = Parent::addEdge(from, to); 249 getNotifier(Edge()).add(edge);249 notifier(Edge()).add(edge); 250 250 return edge; 251 251 } 252 252 253 253 void clear() { 254 getNotifier(Edge()).clear();254 notifier(Edge()).clear(); 255 255 Parent::clear(); 256 256 } 257 257 258 258 void erase(const Edge& edge) { 259 getNotifier(Edge()).erase(edge);259 notifier(Edge()).erase(edge); 260 260 Parent::erase(edge); 261 261 } … … 341 341 public: 342 342 343 using Parent:: getNotifier;343 using Parent::notifier; 344 344 345 EdgeNotifier& getNotifier(Edge) const {345 EdgeNotifier& notifier(Edge) const { 346 346 return edge_notifier; 347 347 } 348 348 349 UEdgeNotifier& getNotifier(UEdge) const {349 UEdgeNotifier& notifier(UEdge) const { 350 350 return uedge_notifier; 351 351 } … … 590 590 UEdge addEdge(const Node& from, const Node& to) { 591 591 UEdge uedge = Parent::addEdge(from, to); 592 getNotifier(UEdge()).add(uedge);593 getNotifier(Edge()).add(Parent::direct(uedge, true));594 getNotifier(Edge()).add(Parent::direct(uedge, false));592 notifier(UEdge()).add(uedge); 593 notifier(Edge()).add(Parent::direct(uedge, true)); 594 notifier(Edge()).add(Parent::direct(uedge, false)); 595 595 return uedge; 596 596 } 597 597 598 598 void clear() { 599 getNotifier(Edge()).clear();600 getNotifier(UEdge()).clear();599 notifier(Edge()).clear(); 600 notifier(UEdge()).clear(); 601 601 Parent::clear(); 602 602 } 603 603 604 604 void erase(const UEdge& uedge) { 605 getNotifier(Edge()).erase(Parent::direct(uedge, true));606 getNotifier(Edge()).erase(Parent::direct(uedge, false));607 getNotifier(UEdge()).erase(uedge);605 notifier(Edge()).erase(Parent::direct(uedge, true)); 606 notifier(Edge()).erase(Parent::direct(uedge, false)); 607 notifier(UEdge()).erase(uedge); 608 608 Parent::erase(uedge); 609 609 } -
lemon/bits/graph_extender.h
r2329 r2384 87 87 public: 88 88 89 NodeNotifier& getNotifier(Node) const {89 NodeNotifier& notifier(Node) const { 90 90 return node_notifier; 91 91 } 92 92 93 EdgeNotifier& getNotifier(Edge) const {93 EdgeNotifier& notifier(Edge) const { 94 94 return edge_notifier; 95 95 } … … 267 267 Node addNode() { 268 268 Node node = Parent::addNode(); 269 getNotifier(Node()).add(node);269 notifier(Node()).add(node); 270 270 return node; 271 271 } … … 273 273 Edge addEdge(const Node& from, const Node& to) { 274 274 Edge edge = Parent::addEdge(from, to); 275 getNotifier(Edge()).add(edge);275 notifier(Edge()).add(edge); 276 276 return edge; 277 277 } 278 278 279 279 void clear() { 280 getNotifier(Edge()).clear();281 getNotifier(Node()).clear();280 notifier(Edge()).clear(); 281 notifier(Node()).clear(); 282 282 Parent::clear(); 283 283 } … … 286 286 void build(const Graph& graph, NodeRefMap& nodeRef, EdgeRefMap& edgeRef) { 287 287 Parent::build(graph, nodeRef, edgeRef); 288 getNotifier(Node()).build();289 getNotifier(Edge()).build();288 notifier(Node()).build(); 289 notifier(Edge()).build(); 290 290 } 291 291 … … 304 304 } 305 305 306 getNotifier(Node()).erase(node);306 notifier(Node()).erase(node); 307 307 Parent::erase(node); 308 308 } 309 309 310 310 void erase(const Edge& edge) { 311 getNotifier(Edge()).erase(edge);311 notifier(Edge()).erase(edge); 312 312 Parent::erase(edge); 313 313 } … … 398 398 public: 399 399 400 NodeNotifier& getNotifier(Node) const {400 NodeNotifier& notifier(Node) const { 401 401 return node_notifier; 402 402 } 403 403 404 EdgeNotifier& getNotifier(Edge) const {404 EdgeNotifier& notifier(Edge) const { 405 405 return edge_notifier; 406 406 } 407 407 408 UEdgeNotifier& getNotifier(UEdge) const {408 UEdgeNotifier& notifier(UEdge) const { 409 409 return uedge_notifier; 410 410 } … … 673 673 Node addNode() { 674 674 Node node = Parent::addNode(); 675 getNotifier(Node()).add(node);675 notifier(Node()).add(node); 676 676 return node; 677 677 } … … 679 679 UEdge addEdge(const Node& from, const Node& to) { 680 680 UEdge uedge = Parent::addEdge(from, to); 681 getNotifier(UEdge()).add(uedge);681 notifier(UEdge()).add(uedge); 682 682 std::vector<Edge> edges; 683 683 edges.push_back(Parent::direct(uedge, true)); 684 684 edges.push_back(Parent::direct(uedge, false)); 685 getNotifier(Edge()).add(edges);685 notifier(Edge()).add(edges); 686 686 return uedge; 687 687 } 688 688 689 689 void clear() { 690 getNotifier(Edge()).clear();691 getNotifier(UEdge()).clear();692 getNotifier(Node()).clear();690 notifier(Edge()).clear(); 691 notifier(UEdge()).clear(); 692 notifier(Node()).clear(); 693 693 Parent::clear(); 694 694 } … … 698 698 UEdgeRefMap& uEdgeRef) { 699 699 Parent::build(graph, nodeRef, uEdgeRef); 700 getNotifier(Node()).build();701 getNotifier(UEdge()).build();702 getNotifier(Edge()).build();700 notifier(Node()).build(); 701 notifier(UEdge()).build(); 702 notifier(Edge()).build(); 703 703 } 704 704 … … 717 717 } 718 718 719 getNotifier(Node()).erase(node);719 notifier(Node()).erase(node); 720 720 Parent::erase(node); 721 721 } … … 725 725 edges.push_back(Parent::direct(uedge, true)); 726 726 edges.push_back(Parent::direct(uedge, false)); 727 getNotifier(Edge()).erase(edges);728 getNotifier(UEdge()).erase(uedge);727 notifier(Edge()).erase(edges); 728 notifier(UEdge()).erase(uedge); 729 729 Parent::erase(uedge); 730 730 } … … 824 824 public: 825 825 826 NodeNotifier& getNotifier(Node) const {826 NodeNotifier& notifier(Node) const { 827 827 return node_notifier; 828 828 } 829 829 830 ANodeNotifier& getNotifier(ANode) const {830 ANodeNotifier& notifier(ANode) const { 831 831 return anode_notifier; 832 832 } 833 833 834 BNodeNotifier& getNotifier(BNode) const {834 BNodeNotifier& notifier(BNode) const { 835 835 return bnode_notifier; 836 836 } 837 837 838 EdgeNotifier& getNotifier(Edge) const {838 EdgeNotifier& notifier(Edge) const { 839 839 return edge_notifier; 840 840 } 841 841 842 UEdgeNotifier& getNotifier(UEdge) const {842 UEdgeNotifier& notifier(UEdge) const { 843 843 return uedge_notifier; 844 844 } … … 1284 1284 Node addANode() { 1285 1285 Node node = Parent::addANode(); 1286 getNotifier(ANode()).add(node);1287 getNotifier(Node()).add(node);1286 notifier(ANode()).add(node); 1287 notifier(Node()).add(node); 1288 1288 return node; 1289 1289 } … … 1291 1291 Node addBNode() { 1292 1292 Node node = Parent::addBNode(); 1293 getNotifier(BNode()).add(node);1294 getNotifier(Node()).add(node);1293 notifier(BNode()).add(node); 1294 notifier(Node()).add(node); 1295 1295 return node; 1296 1296 } … … 1298 1298 UEdge addEdge(const Node& source, const Node& target) { 1299 1299 UEdge uedge = Parent::addEdge(source, target); 1300 getNotifier(UEdge()).add(uedge);1300 notifier(UEdge()).add(uedge); 1301 1301 1302 1302 std::vector<Edge> edges; 1303 1303 edges.push_back(Parent::direct(uedge, true)); 1304 1304 edges.push_back(Parent::direct(uedge, false)); 1305 getNotifier(Edge()).add(edges);1305 notifier(Edge()).add(edges); 1306 1306 1307 1307 return uedge; … … 1309 1309 1310 1310 void clear() { 1311 getNotifier(Edge()).clear();1312 getNotifier(UEdge()).clear();1313 getNotifier(Node()).clear();1314 getNotifier(BNode()).clear();1315 getNotifier(ANode()).clear();1311 notifier(Edge()).clear(); 1312 notifier(UEdge()).clear(); 1313 notifier(Node()).clear(); 1314 notifier(BNode()).clear(); 1315 notifier(ANode()).clear(); 1316 1316 Parent::clear(); 1317 1317 } … … 1322 1322 BNodeRefMap& bNodeRef, UEdgeRefMap& uEdgeRef) { 1323 1323 Parent::build(graph, aNodeRef, bNodeRef, uEdgeRef); 1324 getNotifier(ANode()).build();1325 getNotifier(BNode()).build();1326 getNotifier(Node()).build();1327 getNotifier(UEdge()).build();1328 getNotifier(Edge()).build();1324 notifier(ANode()).build(); 1325 notifier(BNode()).build(); 1326 notifier(Node()).build(); 1327 notifier(UEdge()).build(); 1328 notifier(Edge()).build(); 1329 1329 } 1330 1330 … … 1337 1337 Parent::firstFromANode(uedge, node); 1338 1338 } 1339 getNotifier(ANode()).erase(node);1339 notifier(ANode()).erase(node); 1340 1340 } else { 1341 1341 Parent::firstFromBNode(uedge, node); … … 1344 1344 Parent::firstFromBNode(uedge, node); 1345 1345 } 1346 getNotifier(BNode()).erase(node);1347 } 1348 1349 getNotifier(Node()).erase(node);1346 notifier(BNode()).erase(node); 1347 } 1348 1349 notifier(Node()).erase(node); 1350 1350 Parent::erase(node); 1351 1351 } … … 1355 1355 edges.push_back(Parent::direct(uedge, true)); 1356 1356 edges.push_back(Parent::direct(uedge, false)); 1357 getNotifier(Edge()).erase(edges);1358 getNotifier(UEdge()).erase(uedge);1357 notifier(Edge()).erase(edges); 1358 notifier(UEdge()).erase(uedge); 1359 1359 Parent::erase(uedge); 1360 1360 } -
lemon/bits/map_extender.h
r2260 r2384 84 84 85 85 explicit MapIt(Map& _map) : map(_map) { 86 map. getNotifier()->first(*this);86 map.notifier()->first(*this); 87 87 } 88 88 … … 91 91 92 92 MapIt& operator++() { 93 map. getNotifier()->next(*this);93 map.notifier()->next(*this); 94 94 return *this; 95 95 } … … 124 124 125 125 explicit ConstMapIt(Map& _map) : map(_map) { 126 map. getNotifier()->first(*this);126 map.notifier()->first(*this); 127 127 } 128 128 … … 131 131 132 132 ConstMapIt& operator++() { 133 map. getNotifier()->next(*this);133 map.notifier()->next(*this); 134 134 return *this; 135 135 } … … 153 153 154 154 explicit ItemIt(Map& _map) : map(_map) { 155 map. getNotifier()->first(*this);155 map.notifier()->first(*this); 156 156 } 157 157 … … 160 160 161 161 ItemIt& operator++() { 162 map. getNotifier()->next(*this);162 map.notifier()->next(*this); 163 163 return *this; 164 164 } -
lemon/bits/vector_map.h
r2260 r2384 91 91 /// It adds all the items of the graph to the map. 92 92 VectorMap(const Graph& graph) { 93 Parent::attach(graph. getNotifier(Item()));94 container.resize(Parent:: getNotifier()->maxId() + 1);93 Parent::attach(graph.notifier(Item())); 94 container.resize(Parent::notifier()->maxId() + 1); 95 95 } 96 96 … … 100 100 /// It adds all the items of the graph to the map. 101 101 VectorMap(const Graph& graph, const Value& value) { 102 Parent::attach(graph. getNotifier(Item()));103 container.resize(Parent:: getNotifier()->maxId() + 1, value);102 Parent::attach(graph.notifier(Item())); 103 container.resize(Parent::notifier()->maxId() + 1, value); 104 104 } 105 105 … … 109 109 VectorMap(const VectorMap& _copy) : Parent() { 110 110 if (_copy.attached()) { 111 Parent::attach(*_copy. getNotifier());111 Parent::attach(*_copy.notifier()); 112 112 container = _copy.container; 113 113 } … … 135 135 VectorMap& operator=(const CMap& cmap) { 136 136 checkConcept<concepts::ReadMap<Key, _Value>, CMap>(); 137 const typename Parent::Notifier* notifier = Parent:: getNotifier();137 const typename Parent::Notifier* notifier = Parent::notifier(); 138 138 Item it; 139 139 for (notifier->first(it); it != INVALID; notifier->next(it)) { … … 150 150 /// actual items of the graph. 151 151 Reference operator[](const Key& key) { 152 return container[Parent:: getNotifier()->id(key)];152 return container[Parent::notifier()->id(key)]; 153 153 } 154 154 … … 158 158 /// actual items of the graph. 159 159 ConstReference operator[](const Key& key) const { 160 return container[Parent:: getNotifier()->id(key)];160 return container[Parent::notifier()->id(key)]; 161 161 } 162 162 … … 176 176 /// and it overrides the add() member function of the observer base. 177 177 virtual void add(const Key& key) { 178 int id = Parent:: getNotifier()->id(key);178 int id = Parent::notifier()->id(key); 179 179 if (id >= (int)container.size()) { 180 180 container.resize(id + 1); … … 189 189 int max = container.size() - 1; 190 190 for (int i = 0; i < (int)keys.size(); ++i) { 191 int id = Parent:: getNotifier()->id(keys[i]);191 int id = Parent::notifier()->id(keys[i]); 192 192 if (id >= max) { 193 193 max = id; … … 202 202 /// and it overrides the erase() member function of the observer base. 203 203 virtual void erase(const Key& key) { 204 container[Parent:: getNotifier()->id(key)] = Value();204 container[Parent::notifier()->id(key)] = Value(); 205 205 } 206 206 … … 211 211 virtual void erase(const std::vector<Key>& keys) { 212 212 for (int i = 0; i < (int)keys.size(); ++i) { 213 container[Parent:: getNotifier()->id(keys[i])] = Value();213 container[Parent::notifier()->id(keys[i])] = Value(); 214 214 } 215 215 } … … 220 220 /// and it overrides the build() member function of the observer base. 221 221 virtual void build() { 222 int size = Parent:: getNotifier()->maxId() + 1;222 int size = Parent::notifier()->maxId() + 1; 223 223 container.reserve(size); 224 224 container.resize(size); -
lemon/bpugraph_adaptor.h
r2231 r2384 170 170 171 171 typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier; 172 NodeNotifier& getNotifier(Node) const {173 return graph-> getNotifier(Node());172 NodeNotifier& notifier(Node) const { 173 return graph->notifier(Node()); 174 174 } 175 175 176 176 typedef typename ItemSetTraits<Graph, ANode>::ItemNotifier ANodeNotifier; 177 ANodeNotifier& getNotifier(ANode) const {178 return graph-> getNotifier(ANode());177 ANodeNotifier& notifier(ANode) const { 178 return graph->notifier(ANode()); 179 179 } 180 180 181 181 typedef typename ItemSetTraits<Graph, BNode>::ItemNotifier BNodeNotifier; 182 BNodeNotifier& getNotifier(BNode) const {183 return graph-> getNotifier(BNode());182 BNodeNotifier& notifier(BNode) const { 183 return graph->notifier(BNode()); 184 184 } 185 185 186 186 typedef typename ItemSetTraits<Graph, Edge>::ItemNotifier EdgeNotifier; 187 EdgeNotifier& getNotifier(Edge) const {188 return graph-> getNotifier(Edge());187 EdgeNotifier& notifier(Edge) const { 188 return graph->notifier(Edge()); 189 189 } 190 190 191 191 typedef typename ItemSetTraits<Graph, UEdge>::ItemNotifier UEdgeNotifier; 192 UEdgeNotifier& getNotifier(UEdge) const {193 return graph-> getNotifier(UEdge());192 UEdgeNotifier& notifier(UEdge) const { 193 return graph->notifier(UEdge()); 194 194 } 195 195 … … 372 372 373 373 typedef typename Parent::BNodeNotifier ANodeNotifier; 374 ANodeNotifier& getNotifier(ANode) const {375 return Parent:: getNotifier(typename Parent::BNode());374 ANodeNotifier& notifier(ANode) const { 375 return Parent::notifier(typename Parent::BNode()); 376 376 } 377 377 378 378 typedef typename Parent::ANodeNotifier BNodeNotifier; 379 BNodeNotifier& getNotifier(BNode) const {380 return Parent:: getNotifier(typename Parent::ANode());379 BNodeNotifier& notifier(BNode) const { 380 return Parent::notifier(typename Parent::ANode()); 381 381 } 382 382 -
lemon/concepts/graph_components.h
r2351 r2384 1263 1263 /// 1264 1264 /// Gives back the node alteration notifier. 1265 NodeNotifier& getNotifier(Node) const {1265 NodeNotifier& notifier(Node) const { 1266 1266 return NodeNotifier(); 1267 1267 } … … 1270 1270 /// 1271 1271 /// Gives back the edge alteration notifier. 1272 EdgeNotifier& getNotifier(Edge) const {1272 EdgeNotifier& notifier(Edge) const { 1273 1273 return EdgeNotifier(); 1274 1274 } … … 1279 1279 checkConcept<Base, _Graph>(); 1280 1280 typename _Graph::NodeNotifier& nn 1281 = graph. getNotifier(typename _Graph::Node());1281 = graph.notifier(typename _Graph::Node()); 1282 1282 1283 1283 typename _Graph::EdgeNotifier& en 1284 = graph. getNotifier(typename _Graph::Edge());1284 = graph.notifier(typename _Graph::Edge()); 1285 1285 1286 1286 ignore_unused_variable_warning(nn); … … 1317 1317 /// 1318 1318 /// Gives back the edge alteration notifier. 1319 UEdgeNotifier& getNotifier(UEdge) const {1319 UEdgeNotifier& notifier(UEdge) const { 1320 1320 return UEdgeNotifier(); 1321 1321 } … … 1326 1326 checkConcept<AlterableGraphComponent<Base>, _Graph>(); 1327 1327 typename _Graph::UEdgeNotifier& uen 1328 = graph. getNotifier(typename _Graph::UEdge());1328 = graph.notifier(typename _Graph::UEdge()); 1329 1329 ignore_unused_variable_warning(uen); 1330 1330 } … … 1365 1365 /// 1366 1366 /// Gives back the A-node alteration notifier. 1367 ANodeNotifier& getNotifier(ANode) const {1367 ANodeNotifier& notifier(ANode) const { 1368 1368 return ANodeNotifier(); 1369 1369 } … … 1372 1372 /// 1373 1373 /// Gives back the B-node alteration notifier. 1374 BNodeNotifier& getNotifier(BNode) const {1374 BNodeNotifier& notifier(BNode) const { 1375 1375 return BNodeNotifier(); 1376 1376 } … … 1381 1381 checkConcept<AlterableUGraphComponent<Base>, _Graph>(); 1382 1382 typename _Graph::ANodeNotifier& ann 1383 = graph. getNotifier(typename _Graph::ANode());1383 = graph.notifier(typename _Graph::ANode()); 1384 1384 typename _Graph::BNodeNotifier& bnn 1385 = graph. getNotifier(typename _Graph::BNode());1385 = graph.notifier(typename _Graph::BNode()); 1386 1386 ignore_unused_variable_warning(ann); 1387 1387 ignore_unused_variable_warning(bnn); -
lemon/edge_set.h
r2260 r2384 200 200 typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier; 201 201 202 NodeNotifier& getNotifier(Node) const {203 return graph-> getNotifier(Node());202 NodeNotifier& notifier(Node) const { 203 return graph->notifier(Node()); 204 204 } 205 205 … … 528 528 typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier; 529 529 530 NodeNotifier& getNotifier(Node) const {531 return graph-> getNotifier(Node());530 NodeNotifier& notifier(Node) const { 531 return graph->notifier(Node()); 532 532 } 533 533 -
lemon/full_graph.h
r2260 r2384 195 195 /// automatically and the previous values will be lost. 196 196 void resize(int n) { 197 Parent:: getNotifier(Edge()).clear();198 Parent:: getNotifier(Node()).clear();197 Parent::notifier(Edge()).clear(); 198 Parent::notifier(Node()).clear(); 199 199 construct(n); 200 Parent:: getNotifier(Node()).build();201 Parent:: getNotifier(Edge()).build();200 Parent::notifier(Node()).build(); 201 Parent::notifier(Edge()).build(); 202 202 } 203 203 … … 407 407 /// automatically and the previous values will be lost. 408 408 void resize(int n) { 409 Parent:: getNotifier(Edge()).clear();410 Parent:: getNotifier(UEdge()).clear();411 Parent:: getNotifier(Node()).clear();409 Parent::notifier(Edge()).clear(); 410 Parent::notifier(UEdge()).clear(); 411 Parent::notifier(Node()).clear(); 412 412 construct(n); 413 Parent:: getNotifier(Node()).build();414 Parent:: getNotifier(UEdge()).build();415 Parent:: getNotifier(Edge()).build();413 Parent::notifier(Node()).build(); 414 Parent::notifier(UEdge()).build(); 415 Parent::notifier(Edge()).build(); 416 416 } 417 417 … … 704 704 /// Resize the graph 705 705 void resize(int n, int m) { 706 Parent:: getNotifier(Edge()).clear();707 Parent:: getNotifier(UEdge()).clear();708 Parent:: getNotifier(Node()).clear();709 Parent:: getNotifier(ANode()).clear();710 Parent:: getNotifier(BNode()).clear();706 Parent::notifier(Edge()).clear(); 707 Parent::notifier(UEdge()).clear(); 708 Parent::notifier(Node()).clear(); 709 Parent::notifier(ANode()).clear(); 710 Parent::notifier(BNode()).clear(); 711 711 construct(n, m); 712 Parent:: getNotifier(ANode()).build();713 Parent:: getNotifier(BNode()).build();714 Parent:: getNotifier(Node()).build();715 Parent:: getNotifier(UEdge()).build();716 Parent:: getNotifier(Edge()).build();712 Parent::notifier(ANode()).build(); 713 Parent::notifier(BNode()).build(); 714 Parent::notifier(Node()).build(); 715 Parent::notifier(UEdge()).build(); 716 Parent::notifier(Edge()).build(); 717 717 } 718 718 -
lemon/graph_adaptor.h
r2340 r2384 133 133 typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier; 134 134 135 NodeNotifier& getNotifier(Node) const {136 return graph-> getNotifier(Node());135 NodeNotifier& notifier(Node) const { 136 return graph->notifier(Node()); 137 137 } 138 138 139 139 typedef typename ItemSetTraits<Graph, Edge>::ItemNotifier EdgeNotifier; 140 140 141 EdgeNotifier& getNotifier(Edge) const {142 return graph-> getNotifier(Edge());141 EdgeNotifier& notifier(Edge) const { 142 return graph->notifier(Edge()); 143 143 } 144 144 … … 1183 1183 void setGraph(_Graph& graph) { 1184 1184 Parent::setGraph(graph); 1185 edge_notifier_proxy.setNotifier(graph. getNotifier(GraphEdge()));1185 edge_notifier_proxy.setNotifier(graph.notifier(GraphEdge())); 1186 1186 } 1187 1187 … … 1197 1197 typedef typename Parent::EdgeNotifier UEdgeNotifier; 1198 1198 1199 using Parent:: getNotifier;1199 using Parent::notifier; 1200 1200 1201 1201 typedef AlterationNotifier<AlterableUndirGraphAdaptor, 1202 1202 Edge> EdgeNotifier; 1203 EdgeNotifier& getNotifier(Edge) const { return edge_notifier; }1203 EdgeNotifier& notifier(Edge) const { return edge_notifier; } 1204 1204 1205 1205 protected: … … 1232 1232 edges.push_back(AdaptorBase::Parent::direct(ge, true)); 1233 1233 edges.push_back(AdaptorBase::Parent::direct(ge, false)); 1234 adaptor-> getNotifier(Edge()).add(edges);1234 adaptor->notifier(Edge()).add(edges); 1235 1235 } 1236 1236 virtual void add(const std::vector<GraphEdge>& ge) { … … 1240 1240 edges.push_back(AdaptorBase::Parent::direct(ge[i], false)); 1241 1241 } 1242 adaptor-> getNotifier(Edge()).add(edges);1242 adaptor->notifier(Edge()).add(edges); 1243 1243 } 1244 1244 virtual void erase(const GraphEdge& ge) { … … 1246 1246 edges.push_back(AdaptorBase::Parent::direct(ge, true)); 1247 1247 edges.push_back(AdaptorBase::Parent::direct(ge, false)); 1248 adaptor-> getNotifier(Edge()).erase(edges);1248 adaptor->notifier(Edge()).erase(edges); 1249 1249 } 1250 1250 virtual void erase(const std::vector<GraphEdge>& ge) { … … 1254 1254 edges.push_back(AdaptorBase::Parent::direct(ge[i], false)); 1255 1255 } 1256 adaptor-> getNotifier(Edge()).erase(edges);1256 adaptor->notifier(Edge()).erase(edges); 1257 1257 } 1258 1258 virtual void build() { 1259 adaptor-> getNotifier(Edge()).build();1259 adaptor->notifier(Edge()).build(); 1260 1260 } 1261 1261 virtual void clear() { 1262 adaptor-> getNotifier(Edge()).clear();1262 adaptor->notifier(Edge()).clear(); 1263 1263 } 1264 1264 … … 2144 2144 void setGraph(_Graph& graph) { 2145 2145 Parent::setGraph(graph); 2146 node_notifier_proxy.setNotifier(graph. getNotifier(GraphNode()));2146 node_notifier_proxy.setNotifier(graph.notifier(GraphNode())); 2147 2147 } 2148 2148 … … 2156 2156 typedef InvalidType EdgeNotifier; 2157 2157 2158 NodeNotifier& getNotifier(Node) const { return node_notifier; }2158 NodeNotifier& notifier(Node) const { return node_notifier; } 2159 2159 2160 2160 protected: … … 2187 2187 nodes.push_back(AdaptorBase::Parent::inNode(gn)); 2188 2188 nodes.push_back(AdaptorBase::Parent::outNode(gn)); 2189 adaptor-> getNotifier(Node()).add(nodes);2189 adaptor->notifier(Node()).add(nodes); 2190 2190 } 2191 2191 … … 2196 2196 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); 2197 2197 } 2198 adaptor-> getNotifier(Node()).add(nodes);2198 adaptor->notifier(Node()).add(nodes); 2199 2199 } 2200 2200 … … 2203 2203 nodes.push_back(AdaptorBase::Parent::inNode(gn)); 2204 2204 nodes.push_back(AdaptorBase::Parent::outNode(gn)); 2205 adaptor-> getNotifier(Node()).erase(nodes);2205 adaptor->notifier(Node()).erase(nodes); 2206 2206 } 2207 2207 … … 2212 2212 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); 2213 2213 } 2214 adaptor-> getNotifier(Node()).erase(nodes);2214 adaptor->notifier(Node()).erase(nodes); 2215 2215 } 2216 2216 virtual void build() { 2217 adaptor-> getNotifier(Node()).build();2217 adaptor->notifier(Node()).build(); 2218 2218 } 2219 2219 virtual void clear() { 2220 adaptor-> getNotifier(Node()).clear();2220 adaptor->notifier(Node()).clear(); 2221 2221 } 2222 2222 … … 2256 2256 void setGraph(_Graph& graph) { 2257 2257 Parent::setGraph(graph); 2258 node_notifier_proxy.setNotifier(graph. getNotifier(GraphNode()));2259 edge_notifier_proxy.setNotifier(graph. getNotifier(GraphEdge()));2258 node_notifier_proxy.setNotifier(graph.notifier(GraphNode())); 2259 edge_notifier_proxy.setNotifier(graph.notifier(GraphEdge())); 2260 2260 } 2261 2261 … … 2270 2270 typedef AlterationNotifier<AlterableSplitGraphAdaptor, Edge> EdgeNotifier; 2271 2271 2272 NodeNotifier& getNotifier(Node) const { return node_notifier; }2273 EdgeNotifier& getNotifier(Edge) const { return edge_notifier; }2272 NodeNotifier& notifier(Node) const { return node_notifier; } 2273 EdgeNotifier& notifier(Edge) const { return edge_notifier; } 2274 2274 2275 2275 protected: … … 2302 2302 nodes.push_back(AdaptorBase::Parent::inNode(gn)); 2303 2303 nodes.push_back(AdaptorBase::Parent::outNode(gn)); 2304 adaptor-> getNotifier(Node()).add(nodes);2305 adaptor-> getNotifier(Edge()).add(AdaptorBase::Parent::edge(gn));2304 adaptor->notifier(Node()).add(nodes); 2305 adaptor->notifier(Edge()).add(AdaptorBase::Parent::edge(gn)); 2306 2306 } 2307 2307 virtual void add(const std::vector<GraphNode>& gn) { … … 2313 2313 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); 2314 2314 } 2315 adaptor-> getNotifier(Node()).add(nodes);2316 adaptor-> getNotifier(Edge()).add(edges);2315 adaptor->notifier(Node()).add(nodes); 2316 adaptor->notifier(Edge()).add(edges); 2317 2317 } 2318 2318 virtual void erase(const GraphNode& gn) { 2319 adaptor-> getNotifier(Edge()).erase(AdaptorBase::Parent::edge(gn));2319 adaptor->notifier(Edge()).erase(AdaptorBase::Parent::edge(gn)); 2320 2320 std::vector<Node> nodes; 2321 2321 nodes.push_back(AdaptorBase::Parent::inNode(gn)); 2322 2322 nodes.push_back(AdaptorBase::Parent::outNode(gn)); 2323 adaptor-> getNotifier(Node()).erase(nodes);2323 adaptor->notifier(Node()).erase(nodes); 2324 2324 } 2325 2325 virtual void erase(const std::vector<GraphNode>& gn) { … … 2331 2331 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); 2332 2332 } 2333 adaptor-> getNotifier(Edge()).erase(edges);2334 adaptor-> getNotifier(Node()).erase(nodes);2333 adaptor->notifier(Edge()).erase(edges); 2334 adaptor->notifier(Node()).erase(nodes); 2335 2335 } 2336 2336 virtual void build() { 2337 2337 std::vector<Edge> edges; 2338 const typename Parent::Notifier* notifier = Parent:: getNotifier();2338 const typename Parent::Notifier* notifier = Parent::notifier(); 2339 2339 GraphNode it; 2340 2340 for (notifier->first(it); it != INVALID; notifier->next(it)) { 2341 2341 edges.push_back(AdaptorBase::Parent::edge(it)); 2342 2342 } 2343 adaptor-> getNotifier(Node()).build();2344 adaptor-> getNotifier(Edge()).add(edges);2343 adaptor->notifier(Node()).build(); 2344 adaptor->notifier(Edge()).add(edges); 2345 2345 } 2346 2346 virtual void clear() { 2347 2347 std::vector<Edge> edges; 2348 const typename Parent::Notifier* notifier = Parent:: getNotifier();2348 const typename Parent::Notifier* notifier = Parent::notifier(); 2349 2349 GraphNode it; 2350 2350 for (notifier->first(it); it != INVALID; notifier->next(it)) { 2351 2351 edges.push_back(AdaptorBase::Parent::edge(it)); 2352 2352 } 2353 adaptor-> getNotifier(Edge()).erase(edges);2354 adaptor-> getNotifier(Node()).clear();2353 adaptor->notifier(Edge()).erase(edges); 2354 adaptor->notifier(Node()).clear(); 2355 2355 } 2356 2356 … … 2382 2382 2383 2383 virtual void add(const GraphEdge& ge) { 2384 adaptor-> getNotifier(Edge()).add(AdaptorBase::edge(ge));2384 adaptor->notifier(Edge()).add(AdaptorBase::edge(ge)); 2385 2385 } 2386 2386 virtual void add(const std::vector<GraphEdge>& ge) { … … 2389 2389 edges.push_back(AdaptorBase::edge(ge[i])); 2390 2390 } 2391 adaptor-> getNotifier(Edge()).add(edges);2391 adaptor->notifier(Edge()).add(edges); 2392 2392 } 2393 2393 virtual void erase(const GraphEdge& ge) { 2394 adaptor-> getNotifier(Edge()).erase(AdaptorBase::edge(ge));2394 adaptor->notifier(Edge()).erase(AdaptorBase::edge(ge)); 2395 2395 } 2396 2396 virtual void erase(const std::vector<GraphEdge>& ge) { … … 2399 2399 edges.push_back(AdaptorBase::edge(ge[i])); 2400 2400 } 2401 adaptor-> getNotifier(Edge()).erase(edges);2401 adaptor->notifier(Edge()).erase(edges); 2402 2402 } 2403 2403 virtual void build() { 2404 2404 std::vector<Edge> edges; 2405 const typename Parent::Notifier* notifier = Parent:: getNotifier();2405 const typename Parent::Notifier* notifier = Parent::notifier(); 2406 2406 GraphEdge it; 2407 2407 for (notifier->first(it); it != INVALID; notifier->next(it)) { 2408 2408 edges.push_back(AdaptorBase::Parent::edge(it)); 2409 2409 } 2410 adaptor-> getNotifier(Edge()).add(edges);2410 adaptor->notifier(Edge()).add(edges); 2411 2411 } 2412 2412 virtual void clear() { 2413 2413 std::vector<Edge> edges; 2414 const typename Parent::Notifier* notifier = Parent:: getNotifier();2414 const typename Parent::Notifier* notifier = Parent::notifier(); 2415 2415 GraphEdge it; 2416 2416 for (notifier->first(it); it != INVALID; notifier->next(it)) { 2417 2417 edges.push_back(AdaptorBase::Parent::edge(it)); 2418 2418 } 2419 adaptor-> getNotifier(Edge()).erase(edges);2419 adaptor->notifier(Edge()).erase(edges); 2420 2420 } 2421 2421 -
lemon/graph_utils.h
r2350 r2384 1874 1874 explicit DescriptorMap(const Graph& _graph) : Map(_graph) { 1875 1875 Item it; 1876 const typename Map::Notifier* notifier = Map:: getNotifier();1876 const typename Map::Notifier* notifier = Map::notifier(); 1877 1877 for (notifier->first(it); it != INVALID; notifier->next(it)) { 1878 1878 Map::set(it, invMap.size()); … … 1936 1936 Map::build(); 1937 1937 Item it; 1938 const typename Map::Notifier* notifier = Map:: getNotifier();1938 const typename Map::Notifier* notifier = Map::notifier(); 1939 1939 for (notifier->first(it); it != INVALID; notifier->next(it)) { 1940 1940 Map::set(it, invMap.size()); … … 2293 2293 /// Constructor for creating in-degree map. 2294 2294 explicit InDegMap(const Graph& _graph) : graph(_graph), deg(_graph) { 2295 Parent::attach(graph. getNotifier(typename _Graph::Edge()));2295 Parent::attach(graph.notifier(typename _Graph::Edge())); 2296 2296 2297 2297 for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) { … … 2405 2405 /// Constructor for creating out-degree map. 2406 2406 explicit OutDegMap(const Graph& _graph) : graph(_graph), deg(_graph) { 2407 Parent::attach(graph. getNotifier(typename _Graph::Edge()));2407 Parent::attach(graph.notifier(typename _Graph::Edge())); 2408 2408 2409 2409 for(typename _Graph::NodeIt it(graph); it != INVALID; ++it) { -
lemon/grid_ugraph.h
r2260 r2384 391 391 /// 392 392 void resize(int n, int m) { 393 Parent:: getNotifier(Edge()).clear();394 Parent:: getNotifier(UEdge()).clear();395 Parent:: getNotifier(Node()).clear();393 Parent::notifier(Edge()).clear(); 394 Parent::notifier(UEdge()).clear(); 395 Parent::notifier(Node()).clear(); 396 396 construct(n, m); 397 Parent:: getNotifier(Node()).build();398 Parent:: getNotifier(UEdge()).build();399 Parent:: getNotifier(Edge()).build();397 Parent::notifier(Node()).build(); 398 Parent::notifier(UEdge()).build(); 399 Parent::notifier(Edge()).build(); 400 400 } 401 401 -
lemon/matrix_maps.h
r2376 r2384 271 271 DynamicMatrixMap(const Graph& _graph) 272 272 : values(size(_graph.maxId(Key()) + 1)) { 273 Parent::attach(_graph. getNotifier(Key()));273 Parent::attach(_graph.notifier(Key())); 274 274 } 275 275 … … 280 280 DynamicMatrixMap(const Graph& _graph, const Value& _val) 281 281 : values(size(_graph.maxId(Key()) + 1), _val) { 282 Parent::attach(_graph. getNotifier(Key()));282 Parent::attach(_graph.notifier(Key())); 283 283 } 284 284 … … 297 297 DynamicMatrixMap& operator=(const CMap& _cmap){ 298 298 checkConcept<concepts::ReadMatrixMap<FirstKey, SecondKey, Value>, CMap>(); 299 typename Parent::Notifier* notifier = Parent:: getNotifier();299 typename Parent::Notifier* notifier = Parent::notifier(); 300 300 Key first, second; 301 301 for(notifier->first(first); first != INVALID; … … 314 314 /// Gives back the value assigned to the \c first - \c second ordered pair. 315 315 ConstReference operator()(const Key& first, const Key& second) const { 316 return values[index(Parent:: getNotifier()->id(first),317 Parent:: getNotifier()->id(second))];316 return values[index(Parent::notifier()->id(first), 317 Parent::notifier()->id(second))]; 318 318 } 319 319 … … 323 323 /// Gives back the value assigned to the \c first - \c second ordered pair. 324 324 Reference operator()(const Key& first, const Key& second) { 325 return values[index(Parent:: getNotifier()->id(first),326 Parent:: getNotifier()->id(second))];325 return values[index(Parent::notifier()->id(first), 326 Parent::notifier()->id(second))]; 327 327 } 328 328 … … 331 331 /// Setter function for the matrix map. 332 332 void set(const Key& first, const Key& second, const Value& val) { 333 values[index(Parent:: getNotifier()->id(first),334 Parent:: getNotifier()->id(second))] = val;333 values[index(Parent::notifier()->id(first), 334 Parent::notifier()->id(second))] = val; 335 335 } 336 336 … … 350 350 351 351 virtual void add(const Key& key) { 352 if (size(Parent:: getNotifier()->id(key) + 1) >= (int)values.size()) {353 values.resize(size(Parent:: getNotifier()->id(key) + 1));352 if (size(Parent::notifier()->id(key) + 1) >= (int)values.size()) { 353 values.resize(size(Parent::notifier()->id(key) + 1)); 354 354 } 355 355 } … … 358 358 int new_size = 0; 359 359 for (int i = 0; i < (int)keys.size(); ++i) { 360 if (size(Parent:: getNotifier()->id(keys[i]) + 1) >= new_size) {361 new_size = size(Parent:: getNotifier()->id(keys[i]) + 1);360 if (size(Parent::notifier()->id(keys[i]) + 1) >= new_size) { 361 new_size = size(Parent::notifier()->id(keys[i]) + 1); 362 362 } 363 363 } … … 372 372 373 373 virtual void build() { 374 values.resize(size(Parent:: getNotifier()->maxId() + 1));374 values.resize(size(Parent::notifier()->maxId() + 1)); 375 375 } 376 376 … … 420 420 DynamicSymMatrixMap(const Graph& _graph) 421 421 : values(size(_graph.maxId(Key()) + 1)) { 422 Parent::attach(_graph. getNotifier(Key()));422 Parent::attach(_graph.notifier(Key())); 423 423 } 424 424 … … 429 429 DynamicSymMatrixMap(const Graph& _graph, const Value& _val) 430 430 : values(size(_graph.maxId(Key()) + 1), _val) { 431 Parent::attach(_graph. getNotifier(Key()));431 Parent::attach(_graph.notifier(Key())); 432 432 } 433 433 … … 448 448 DynamicSymMatrixMap& operator=(const CMap& _cmap){ 449 449 checkConcept<concepts::ReadMatrixMap<FirstKey, SecondKey, Value>, CMap>(); 450 typename Parent::Notifier* notifier = Parent:: getNotifier();450 typename Parent::Notifier* notifier = Parent::notifier(); 451 451 Key first, second; 452 452 for(notifier->first(first); first != INVALID; … … 467 467 /// pair. 468 468 ConstReference operator()(const Key& first, const Key& second) const { 469 return values[index(Parent:: getNotifier()->id(first),470 Parent:: getNotifier()->id(second))];469 return values[index(Parent::notifier()->id(first), 470 Parent::notifier()->id(second))]; 471 471 } 472 472 … … 477 477 /// pair. 478 478 Reference operator()(const Key& first, const Key& second) { 479 return values[index(Parent:: getNotifier()->id(first),480 Parent:: getNotifier()->id(second))];479 return values[index(Parent::notifier()->id(first), 480 Parent::notifier()->id(second))]; 481 481 } 482 482 … … 486 486 /// 487 487 void set(const Key& first, const Key& second, const Value& val) { 488 values[index(Parent:: getNotifier()->id(first),489 Parent:: getNotifier()->id(second))] = val;488 values[index(Parent::notifier()->id(first), 489 Parent::notifier()->id(second))] = val; 490 490 } 491 491 … … 505 505 506 506 virtual void add(const Key& key) { 507 if (size(Parent:: getNotifier()->id(key) + 1) >= (int)values.size()) {508 values.resize(size(Parent:: getNotifier()->id(key) + 1));507 if (size(Parent::notifier()->id(key) + 1) >= (int)values.size()) { 508 values.resize(size(Parent::notifier()->id(key) + 1)); 509 509 } 510 510 } … … 513 513 int new_size = 0; 514 514 for (int i = 0; i < (int)keys.size(); ++i) { 515 if (size(Parent:: getNotifier()->id(keys[i]) + 1) >= new_size) {516 new_size = size(Parent:: getNotifier()->id(keys[i]) + 1);515 if (size(Parent::notifier()->id(keys[i]) + 1) >= new_size) { 516 new_size = size(Parent::notifier()->id(keys[i]) + 1); 517 517 } 518 518 } … … 527 527 528 528 virtual void build() { 529 values.resize(size(Parent:: getNotifier()->maxId() + 1));529 values.resize(size(Parent::notifier()->maxId() + 1)); 530 530 } 531 531 … … 802 802 _second_key_proxy(*this) 803 803 { 804 _first_key_proxy.attach(_firstContainer. getNotifier(FirstKey()));805 _second_key_proxy.attach(_secondContainer. getNotifier(SecondKey()));804 _first_key_proxy.attach(_firstContainer.notifier(FirstKey())); 805 _second_key_proxy.attach(_secondContainer.notifier(SecondKey())); 806 806 } 807 807 … … 818 818 _second_key_proxy(*this) 819 819 { 820 _first_key_proxy.attach(_firstContainer. getNotifier(FirstKey()));821 _second_key_proxy.attach(_secondContainer. getNotifier(SecondKey()));820 _first_key_proxy.attach(_firstContainer.notifier(FirstKey())); 821 _second_key_proxy.attach(_secondContainer.notifier(SecondKey())); 822 822 } 823 823 … … 829 829 if(_copy._first_key_proxy.attached() && 830 830 _copy._second_key_proxy.attached()){ 831 _first_key_proxy.attach(*_copy._first_key_proxy. getNotifier());832 _second_key_proxy.attach(*_copy._second_key_proxy. getNotifier());831 _first_key_proxy.attach(*_copy._first_key_proxy.notifier()); 832 _second_key_proxy.attach(*_copy._second_key_proxy.notifier()); 833 833 values = _copy.values; 834 834 } … … 855 855 ///ordered pair. 856 856 Reference operator()(const FirstKey& _first, const SecondKey& _second) { 857 return values[_first_key_proxy. getNotifier()->id(_first)]858 [_second_key_proxy. getNotifier()->id(_second)];857 return values[_first_key_proxy.notifier()->id(_first)] 858 [_second_key_proxy.notifier()->id(_second)]; 859 859 } 860 860 … … 866 866 ConstReference operator()(const FirstKey& _first, 867 867 const SecondKey& _second) const { 868 return values[_first_key_proxy. getNotifier()->id(_first)]869 [_second_key_proxy. getNotifier()->id(_second)];868 return values[_first_key_proxy.notifier()->id(_first)] 869 [_second_key_proxy.notifier()->id(_second)]; 870 870 } 871 871 … … 875 875 void set(const FirstKey& first, const SecondKey& second, 876 876 const Value& value){ 877 values[_first_key_proxy. getNotifier()->id(first)]878 [_second_key_proxy. getNotifier()->id(second)] = value;877 values[_first_key_proxy.notifier()->id(first)] 878 [_second_key_proxy.notifier()->id(second)] = value; 879 879 } 880 880 … … 894 894 checkConcept<concepts::ReadMatrixMap<FirstKey, SecondKey, Value>, CMap>(); 895 895 const typename FirstKeyProxy::Notifier* notifierFirstKey = 896 _first_key_proxy. getNotifier();896 _first_key_proxy.notifier(); 897 897 const typename SecondKeyProxy::Notifier* notifierSecondKey = 898 _second_key_proxy. getNotifier();898 _second_key_proxy.notifier(); 899 899 FirstKey itemFirst; 900 900 SecondKey itemSecond; … … 917 917 void addFirstKey(const FirstKey& firstKey) { 918 918 int size = (int)values.size(); 919 if( _first_key_proxy. getNotifier()->id(firstKey)+1 >= size ){920 values.resize(_first_key_proxy. getNotifier()->id(firstKey)+1);919 if( _first_key_proxy.notifier()->id(firstKey)+1 >= size ){ 920 values.resize(_first_key_proxy.notifier()->id(firstKey)+1); 921 921 if( (int)values[0].size() != 0 ){ 922 922 int innersize = (int)values[0].size(); … … 924 924 (values[i]).resize(innersize); 925 925 } 926 }else if(_second_key_proxy. getNotifier()->maxId() >= 0){927 int innersize = _second_key_proxy. getNotifier()->maxId();926 }else if(_second_key_proxy.notifier()->maxId() >= 0){ 927 int innersize = _second_key_proxy.notifier()->maxId(); 928 928 for(int i = 0; i != (int)values.size(); ++i){ 929 929 values[0].resize(innersize); … … 940 940 int max = values.size() - 1; 941 941 for(int i=0; i != (int)firstKeys.size(); ++i){ 942 int id = _first_key_proxy. getNotifier()->id(firstKeys[i]);942 int id = _first_key_proxy.notifier()->id(firstKeys[i]); 943 943 if(max < id){ 944 944 max = id; … … 953 953 values[i].resize(innersize); 954 954 } 955 }else if(_second_key_proxy. getNotifier()->maxId() >= 0){956 int innersize = _second_key_proxy. getNotifier()->maxId();955 }else if(_second_key_proxy.notifier()->maxId() >= 0){ 956 int innersize = _second_key_proxy.notifier()->maxId(); 957 957 for(int i = 0; i != (int)values.size(); ++i){ 958 958 values[i].resize(innersize); … … 970 970 return; 971 971 } 972 int id = _second_key_proxy. getNotifier()->id(secondKey);972 int id = _second_key_proxy.notifier()->id(secondKey); 973 973 if(id >= (int)values[0].size()){ 974 974 for(int i=0;i!=(int)values.size();++i){ … … 988 988 int max = values[0].size(); 989 989 for(int i = 0; i != (int)secondKeys.size(); ++i){ 990 int id = _second_key_proxy. getNotifier()->id(secondKeys[i]);990 int id = _second_key_proxy.notifier()->id(secondKeys[i]); 991 991 if(max < id){ 992 992 max = id; … … 1005 1005 ///class belongs to the FirstKey type. 1006 1006 void eraseFirstKey(const FirstKey& first) { 1007 int id = _first_key_proxy. getNotifier()->id(first);1007 int id = _first_key_proxy.notifier()->id(first); 1008 1008 for(int i = 0; i != (int)values[id].size(); ++i){ 1009 1009 values[id][i] = Value(); … … 1017 1017 void eraseFirstKeys(const std::vector<FirstKey>& firstKeys) { 1018 1018 for(int j = 0; j != (int)firstKeys.size(); ++j){ 1019 int id = _first_key_proxy. getNotifier()->id(firstKeys[j]);1019 int id = _first_key_proxy.notifier()->id(firstKeys[j]); 1020 1020 for(int i = 0; i != (int)values[id].size(); ++i){ 1021 1021 values[id][i] = Value(); … … 1032 1032 return; 1033 1033 } 1034 int id = _second_key_proxy. getNotifier()->id(second);1034 int id = _second_key_proxy.notifier()->id(second); 1035 1035 for(int i = 0; i != (int)values.size(); ++i){ 1036 1036 values[i][id] = Value(); … … 1047 1047 } 1048 1048 for(int j = 0; j != (int)secondKeys.size(); ++j){ 1049 int id = _second_key_proxy. getNotifier()->id(secondKeys[j]);1049 int id = _second_key_proxy.notifier()->id(secondKeys[j]); 1050 1050 for(int i = 0; i != (int)values.size(); ++i){ 1051 1051 values[i][id] = Value(); … … 1059 1059 ///to the FirstKey or SecondKey type. 1060 1060 void build() { 1061 values.resize(_first_key_proxy. getNotifier()->maxId());1061 values.resize(_first_key_proxy.notifier()->maxId()); 1062 1062 for(int i=0; i!=(int)values.size(); ++i){ 1063 values[i].resize(_second_key_proxy. getNotifier()->maxId());1063 values[i].resize(_second_key_proxy.notifier()->maxId()); 1064 1064 } 1065 1065 }
Note: See TracChangeset
for help on using the changeset viewer.