Changeset 10920 for code/branches/cpp11_v2/src
- Timestamp:
- Dec 6, 2015, 2:51:14 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/ClassTreeMask.cc
r10919 r10920 851 851 this->objectIterator_ = Context::getRootContext()->getObjectList(this->subclassIterator_->first)->begin(); 852 852 else 853 this->objectIterator_ = ObjectList<BaseObject> ::end();853 this->objectIterator_ = ObjectList<BaseObject>().end(); 854 854 855 855 // Check if the iterator points on a valid object. If not, go to the next object by calling ++ -
code/branches/cpp11_v2/src/libraries/core/Loader.cc
r10917 r10920 207 207 if (!file) 208 208 return; 209 for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject> ::begin(); it; )209 for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>().begin(); it; ) 210 210 { 211 211 if ((it->getFile() == file) && mask.isIncluded(it->getIdentifier())) -
code/branches/cpp11_v2/src/libraries/core/class/Identifier.h
r10919 r10920 415 415 void ClassIdentifier<T>::destroyObjects(Listable*) 416 416 { 417 ObjectListBase* objectList = Context::getRootContext()->getObjectList(this); 418 ObjectListElement<T>* begin = static_cast<ObjectListElement<T>*>(objectList->begin()); 419 ObjectListElement<T>* end = static_cast<ObjectListElement<T>*>(objectList->end()); 420 for (typename ObjectList<T>::iterator it = begin; it != end; ) 417 ObjectList<T> list(Context::getRootContext()->getObjectList(this)); 418 for (typename ObjectList<T>::iterator it = list.begin(); it != list.end(); ) 421 419 this->destroyObject(*(it++)); 422 420 } -
code/branches/cpp11_v2/src/libraries/core/object/ObjectList.h
r10774 r10920 71 71 typedef ObjectListIterator<T> iterator; 72 72 73 /// Returns the size of the list (for the root context) 74 inline static size_t size() 75 { return size(Context::getRootContext()); } 73 ObjectList() : ObjectList(Context::getRootContext()) {} 74 ObjectList(Context* context) : ObjectList(context->getObjectList<T>()) {} 75 ObjectList(ObjectListBase* list) : list_(list) {} 76 76 77 /// Returns the size of the list 77 inline static size_t size(Context* context) 78 { 79 return context->getObjectList<T>()->size(); 80 } 78 inline size_t size() 79 { return this->list_->size(); } 81 80 82 /// Returns an Iterator to the first element in the list (for the root context).83 inline static ObjectListIterator<T> begin()84 { return begin(Context::getRootContext()); }85 81 /// Returns an Iterator to the first element in the list. 86 inline static ObjectListIterator<T> begin(Context* context)87 { 88 ObjectListBase* list = context->getObjectList<T>();89 return static_cast<ObjectListElement<T>*>(list->begin());90 }82 inline ObjectListIterator<T> begin() 83 { return static_cast<ObjectListElement<T>*>(this->list_->begin()); } 84 /// Returns an Iterator to the element after the last element in the list. 85 inline ObjectListIterator<T> end() 86 { return static_cast<ObjectListElement<T>*>(this->list_->end()); } 91 87 92 /// Returns an Iterator to the element after the last element in the list (for the root context). 93 inline static ObjectListIterator<T> end() 94 { return end(Context::getRootContext()); } 95 /// Returns an Iterator to the element after the last element in the list. 96 inline static ObjectListIterator<T> end(Context* context) 97 { 98 ObjectListBase* list = context->getObjectList<T>(); 99 return static_cast<ObjectListElement<T>*>(list->end()); 100 } 88 /// Returns an Iterator to the last element in the list. 89 inline ObjectListIterator<T> rbegin() 90 { return static_cast<ObjectListElement<T>*>(this->list_->rbegin()); } 91 /// Returns an Iterator to the element before the first element in the list. 92 inline ObjectListIterator<T> rend() 93 { return static_cast<ObjectListElement<T>*>(this->list_->rend()); } 101 94 102 /// Returns an Iterator to the last element in the list (for the root context). 103 inline static ObjectListIterator<T> rbegin() 104 { return rbegin(Context::getRootContext()); } 105 /// Returns an Iterator to the last element in the list. 106 inline static ObjectListIterator<T> rbegin(Context* context) 107 { 108 ObjectListBase* list = context->getObjectList<T>(); 109 return static_cast<ObjectListElement<T>*>(list->rbegin()); 110 } 111 112 /// Returns an Iterator to the element before the first element in the list (for the root context). 113 inline static ObjectListIterator<T> rend() 114 { return rend(Context::getRootContext()); } 115 /// Returns an Iterator to the element before the first element in the list. 116 inline static ObjectListIterator<T> rend(Context* context) 117 { 118 ObjectListBase* list = context->getObjectList<T>(); 119 return static_cast<ObjectListElement<T>*>(list->rend()); 120 } 95 private: 96 ObjectListBase* list_; 121 97 }; 122 98 } -
code/branches/cpp11_v2/src/libraries/core/object/ObjectListIterator.h
r10769 r10920 41 41 Usage: 42 42 @code 43 for (ObjectListIterator<myClass> it = ObjectList<myClass>::begin(); it != ObjectList<myClass>::end(); ++it) 43 ObjectList<myClass> list; 44 for (ObjectListIterator<myClass> it = list.begin(); it != list.end(); ++it) 44 45 { 45 46 it->someFunction(...); -
code/branches/cpp11_v2/src/libraries/network/packet/Gamestate.cc
r10919 r10920 126 126 mem += GamestateHeader::getSize(); 127 127 ObjectList<Synchronisable>::iterator it; 128 for(it = ObjectList<Synchronisable> ::begin(); it; ++it)128 for(it = ObjectList<Synchronisable>().begin(); it; ++it) 129 129 { 130 130 -
code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceController.cc
r10919 r10920 59 59 60 60 virtualCheckPointIndex = -2; 61 if (ObjectList<SpaceRaceManager> ::size() != 1)62 orxout(internal_warning) << "Expected 1 instance of SpaceRaceManager but found " << ObjectList<SpaceRaceManager> ::size() << endl;61 if (ObjectList<SpaceRaceManager>().size() != 1) 62 orxout(internal_warning) << "Expected 1 instance of SpaceRaceManager but found " << ObjectList<SpaceRaceManager>().size() << endl; 63 63 for (SpaceRaceManager* manager : ObjectList<SpaceRaceManager>()) 64 64 { … … 299 299 orxout()<<"add VCP at"<<virtualCheckPointPosition.x<<", "<<virtualCheckPointPosition.y<<", "<<virtualCheckPointPosition.z<<endl; 300 300 RaceCheckPoint* newTempRaceCheckPoint; 301 for (ObjectList<SpaceRaceManager>::iterator it = ObjectList<SpaceRaceManager>::begin(); it!= ObjectList<SpaceRaceManager>::end(); ++it) 301 ObjectList<SpaceRaceManager> list; 302 for (ObjectList<SpaceRaceManager>::iterator it = list.begin(); it!= list.end(); ++it) 302 303 { 303 304 newTempRaceCheckPoint = new RaceCheckPoint((*it)); … … 488 489 std::vector<StaticEntity*> problematicObjects; 489 490 490 for (ObjectList<StaticEntity>::iterator it = ObjectList<StaticEntity>::begin(); it!= ObjectList<StaticEntity>::end(); ++it) 491 ObjectList<StaticEntity> list; 492 for (ObjectList<StaticEntity>::iterator it = list.begin(); it!= list.end(); ++it) 491 493 { 492 494 -
code/branches/cpp11_v2/src/modules/jump/Jump.cc
r10916 r10920 141 141 } 142 142 143 ObjectList<JumpPlatform>::iterator beginPlatform = ObjectList<JumpPlatform>::begin(); 144 ObjectList<JumpPlatform>::iterator endPlatform = ObjectList<JumpPlatform>::end(); 145 ObjectList<JumpPlatform>::iterator itPlatform = beginPlatform; 143 ObjectList<JumpPlatform> listPlatform; 144 ObjectList<JumpPlatform>::iterator itPlatform = listPlatform.begin(); 146 145 Vector3 platformPosition; 147 146 148 while (itPlatform != endPlatform)147 while (itPlatform != listPlatform.end()) 149 148 { 150 149 platformPosition = itPlatform->getPosition(); … … 163 162 164 163 // Deleted deactivated platforms 165 ObjectList<JumpPlatformDisappear>::iterator beginDisappear = ObjectList<JumpPlatformDisappear>::begin(); 166 ObjectList<JumpPlatformDisappear>::iterator endDisappear = ObjectList<JumpPlatformDisappear>::end(); 167 ObjectList<JumpPlatformDisappear>::iterator itDisappear = beginDisappear; 168 169 while (itDisappear != endDisappear) 164 ObjectList<JumpPlatformDisappear> listDisappear; 165 ObjectList<JumpPlatformDisappear>::iterator itDisappear = listDisappear.begin(); 166 167 while (itDisappear != listDisappear.end()) 170 168 { 171 169 if (!itDisappear->isActive()) … … 182 180 } 183 181 184 ObjectList<JumpPlatformTimer>::iterator beginTimer = ObjectList<JumpPlatformTimer>::begin(); 185 ObjectList<JumpPlatformTimer>::iterator endTimer = ObjectList<JumpPlatformTimer>::end(); 186 ObjectList<JumpPlatformTimer>::iterator itTimer = beginTimer; 187 188 while (itTimer != endTimer) 182 ObjectList<JumpPlatformTimer> listTimer; 183 ObjectList<JumpPlatformTimer>::iterator itTimer = listTimer.begin(); 184 185 while (itTimer != listTimer.end()) 189 186 { 190 187 if (!itTimer->isActive()) … … 201 198 } 202 199 203 ObjectList<JumpProjectile>::iterator beginProjectile = ObjectList<JumpProjectile>::begin(); 204 ObjectList<JumpProjectile>::iterator endProjectile = ObjectList<JumpProjectile>::end(); 205 ObjectList<JumpProjectile>::iterator itProjectile = beginProjectile; 200 ObjectList<JumpProjectile> listProjectile; 201 ObjectList<JumpProjectile>::iterator itProjectile = listProjectile.begin(); 206 202 Vector3 projectilePosition; 207 203 208 while (itProjectile != endProjectile)204 while (itProjectile != listProjectile.end()) 209 205 { 210 206 projectilePosition = itProjectile->getPosition(); … … 222 218 } 223 219 224 ObjectList<JumpEnemy>::iterator beginEnemy = ObjectList<JumpEnemy>::begin(); 225 ObjectList<JumpEnemy>::iterator endEnemy = ObjectList<JumpEnemy>::end(); 226 ObjectList<JumpEnemy>::iterator itEnemy = beginEnemy; 220 ObjectList<JumpEnemy> listEnemy; 221 ObjectList<JumpEnemy>::iterator itEnemy = listEnemy.begin(); 227 222 Vector3 enemyPosition; 228 223 229 while (itEnemy != endEnemy)224 while (itEnemy != listEnemy.end()) 230 225 { 231 226 enemyPosition = itEnemy->getPosition(); … … 243 238 } 244 239 245 ObjectList<JumpItem>::iterator beginItem = ObjectList<JumpItem>::begin(); 246 ObjectList<JumpItem>::iterator endItem = ObjectList<JumpItem>::end(); 247 ObjectList<JumpItem>::iterator itItem = beginItem; 240 ObjectList<JumpItem> listItem; 241 ObjectList<JumpItem>::iterator itItem = listItem.begin(); 248 242 Vector3 itemPosition; 249 243 250 while (itItem != endItem)244 while (itItem != listItem.end()) 251 245 { 252 246 itemPosition = itItem->getPosition(); -
code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.cc
r10917 r10920 183 183 void Mini4Dgame::undoStone()//Vector4 move, const int playerColor) 184 184 { 185 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard> ::begin();185 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard>().begin(); 186 186 it->undoMove(); 187 187 } … … 191 191 { 192 192 Mini4DgamePosition move = Mini4DgamePosition(x,y,z,w); 193 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard> ::begin();193 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard>().begin(); 194 194 it->makeMove(move); 195 195 } -
code/branches/cpp11_v2/src/modules/overlays/debugging/DebugPositionText.cc
r9943 r10920 52 52 SUPER(DebugPositionText, tick, dt); 53 53 54 ObjectList<NewHumanController>::iterator it = ObjectList<NewHumanController> ::begin();54 ObjectList<NewHumanController>::iterator it = ObjectList<NewHumanController>().begin(); 55 55 if (it && it->getControllableEntity() ) 56 56 { -
code/branches/cpp11_v2/src/orxonox/Radar.cc
r10919 r10920 138 138 void Radar::cycleFocus() 139 139 { 140 if (ObjectList<RadarViewable>::begin() == ObjectList<RadarViewable>::end()) 140 ObjectList<RadarViewable> listRadarViewable; 141 if (listRadarViewable.size() == 0) 141 142 { 142 143 // list is empty … … 158 159 ObjectList<RadarViewable>::iterator itFallback = nullptr; 159 160 160 for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it)161 for (ObjectList<RadarViewable>::iterator it = listRadarViewable.begin(); it; ++it) 161 162 { 162 163 if (*it == static_cast<RadarViewable*>(HumanController::getLocalControllerEntityAsPawn())) -
code/branches/cpp11_v2/src/orxonox/gamestates/GSLevel.cc
r10919 r10920 215 215 void GSLevel::unloadLevelAsClient() 216 216 { 217 for (ObjectList<Level>::iterator it = ObjectList<Level>::begin(); it != ObjectList<Level>::end(); ) 217 ObjectList<Level> listLevel; 218 for (ObjectList<Level>::iterator it = listLevel.begin(); it != listLevel.end(); ) 218 219 { 219 220 StrongPtr<Level> level = *(it++); // StrongPtr prevents that the Level gets destroyed while we loop over it 220 for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(level); it != ObjectList<BaseObject>::end(level); ) 221 ObjectList<BaseObject> listBaseObject(level); 222 for (ObjectList<BaseObject>::iterator it = listBaseObject.begin(); it != listBaseObject.end(); ) 221 223 (it++)->destroy(); 222 224 } 223 225 224 for (ObjectList<Synchronisable>::iterator it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); ) 226 ObjectList<Synchronisable> listSynchronisable; 227 for (ObjectList<Synchronisable>::iterator it = listSynchronisable.begin(); it != listSynchronisable.end(); ) 225 228 { 226 229 if (it->getSyncMode() != 0x0) -
code/branches/cpp11_v2/src/orxonox/gamestates/GSRoot.cc
r10919 r10920 113 113 } 114 114 115 for (ObjectList<Timer>::iterator it = ObjectList<Timer>::begin(); it; ) 115 ObjectList<Timer> listTimer; 116 for (ObjectList<Timer>::iterator it = listTimer.begin(); it; ) 116 117 { 117 118 Timer* object = *it; … … 129 130 } 130 131 float realdt = leveldt * TimeFactorListener::getTimeFactor(); 131 for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ) 132 ObjectList<Tickable> listTickable; 133 for (ObjectList<Tickable>::iterator it = listTickable.begin(); it; ) 132 134 { 133 135 Tickable* object = *it; -
code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc
r10919 r10920 492 492 { 493 493 unsigned int i = 0; 494 for (ObjectList<Bot>::iterator it = ObjectList<Bot>::begin(); (it != ObjectList<Bot>::end()) && ((amount == 0) || (i < amount)); ) 494 ObjectList<Bot> list; 495 for (ObjectList<Bot>::iterator it = list.begin(); (it != list.end()) && ((amount == 0) || (i < amount)); ) 495 496 { 496 497 if (it->getGametype() == this)
Note: See TracChangeset
for help on using the changeset viewer.