Changeset 2384:805c5a2a36dd in lemon-0.x for lemon/bits/array_map.h
- Timestamp:
- 03/01/07 18:14:24 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3215
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note: See TracChangeset
for help on using the changeset viewer.