Changeset 1591 for code/branches
- Timestamp:
- Jun 12, 2008, 2:00:15 AM (16 years ago)
- Location:
- code/branches/core3/src
- Files:
-
- 1 added
- 1 deleted
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/core/CorePrereqs.h
r1586 r1591 138 138 class ObjectListBase; 139 139 class ObjectListBaseElement; 140 template <class T> 141 class ObjectListElement; 142 template <class T> 143 class ObjectListIterator; 140 144 class OrxonoxClass; 141 145 class Shell; … … 153 157 class XMLPortObjectContainer; 154 158 class XMLPortParamContainer; 159 160 struct ObjectListBase::Export; 155 161 156 162 // input -
code/branches/core3/src/core/Identifier.cc
r1583 r1591 39 39 #include "ConsoleCommand.h" 40 40 #include "CommandExecutor.h" 41 #include " MetaObjectList.h"41 #include "Iterator.h" 42 42 #include "ObjectList.h" 43 43 #include "OrxonoxClass.h" … … 197 197 198 198 /** 199 @brief Adds an object of the given type to the ObjectList. 200 @param object The object to add 201 */ 202 void Identifier::addObject(OrxonoxClass* object) 203 { 204 COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl; 205 object->getMetaList().add(this->objects_, this->objects_->add(object)); 199 @brief Updates the config-values of all existing objects of this class by calling their setConfigValues() function. 200 */ 201 void Identifier::updateConfigValues() const 202 { 203 for (BaseIterator it = this->getObjects()->begin(); it; ++it) 204 (*it)->setConfigValues(); 206 205 } 207 206 -
code/branches/core3/src/core/Identifier.h
r1586 r1591 60 60 #include <utility> 61 61 62 #include "Iterator.h" 62 #include "MetaObjectList.h" 63 #include "ObjectListBase.h" 63 64 #include "util/Debug.h" 64 65 #include "util/String.h" … … 103 104 bool isDirectParentOf(const Identifier* identifier) const; 104 105 105 void addObject(OrxonoxClass* object);106 107 106 /** @brief Returns the list of all existing objects of this class. @return The list */ 108 107 inline ObjectListBase* getObjects() const … … 113 112 void setName(const std::string& name); 114 113 115 v irtual void updateConfigValues() const = 0;114 void updateConfigValues() const; 116 115 117 116 /** @brief Returns the parents of the class the Identifier belongs to. @return The list of all parents */ … … 231 230 232 231 bool bCreatedOneObject_; //!< True if at least one object of the given type was created (used to determine the need of storing the parents) 232 ObjectListBase* objects_; //!< The list of all objects of this class 233 233 234 234 private: … … 264 264 bool bSetName_; //!< True if the name is set 265 265 std::string name_; //!< The name of the class the Identifier belongs to 266 ObjectListBase* objects_; //!< The list of all objects of this class267 266 BaseFactory* factory_; //!< The Factory, able to create new objects of the given class (if available) 268 267 static int hierarchyCreatingCounter_s; //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading) … … 301 300 void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass); 302 301 static bool isFirstCall(); 303 304 void updateConfigValues() const; 302 void addObject(T* object); 305 303 306 304 XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname); … … 411 409 412 410 /** 413 @brief Updates the config-values of all existing objects of this class by calling their setConfigValues() function. 414 */ 415 template <class T> 416 void ClassIdentifier<T>::updateConfigValues() const 417 { 418 for (Iterator<T> it = this->getObjects()->begin(); it; ++it) 419 (*it)->setConfigValues(); 411 @brief Adds an object of the given type to the ObjectList. 412 @param object The object to add 413 */ 414 template <class T> 415 void ClassIdentifier<T>::addObject(T* object) 416 { 417 COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl; 418 object->getMetaList().add(this->objects_, this->objects_->add(new ObjectListElement<T>(object))); 420 419 } 421 420 -
code/branches/core3/src/core/Iterator.h
r1574 r1591 31 31 @brief Definition and implementation of the Iterator class. 32 32 33 The Iterator of a given class allows to iterate through an ObjectList , containing all objects of that type.34 This is the only way to access the objects stored in an ObjectList.33 The Iterator of a given class allows to iterate through an ObjectList. Objects in 34 this list are casted to the template argument of the Iterator. 35 35 36 36 Usage: 37 for (Iterator<myClass> it = ObjectList<myClass>::begin(); it != ObjectList<myClass>::end(); ++it)37 for (Iterator<myClass> it = anyidentifier->getObjects().begin(); it != anyidentifier->getObjects().end(); ++it) 38 38 { 39 39 it->someFunction(...); … … 47 47 #include "CorePrereqs.h" 48 48 49 #include "IteratorBase.h" 49 #include "ObjectListBase.h" 50 #include "ObjectListIterator.h" 51 #include "OrxonoxClass.h" 50 52 51 53 namespace orxonox 52 54 { 53 //! The Iterator allows to iterate through the ObjectList of a given class.54 template <class T >55 class Iterator : public IteratorBase55 //! The Iterator allows to iterate through a given ObjectList 56 template <class T = OrxonoxClass> 57 class Iterator 56 58 { 57 59 public: … … 61 63 inline Iterator() 62 64 { 63 ClassIdentifier<T>::getIdentifier()->getObjects()->registerIterator(this); 64 } 65 66 /** 67 @brief Constructor: Sets the element, whereon the iterator points, to a given element. 68 @param element The element to start with 69 */ 70 inline Iterator(ObjectListBaseElement* element) : IteratorBase((ObjectListBaseElement*)element) 71 { 72 ClassIdentifier<T>::getIdentifier()->getObjects()->registerIterator(this); 65 this->element_ = 0; 66 this->list_ = 0; 67 } 68 69 /** 70 @brief Constructor: Sets this element to the exported element. 71 @param exp The exported element 72 */ 73 inline Iterator(const ObjectListBase::Export& exp) 74 { 75 this->element_ = exp.element_; 76 this->list_ = exp.list_; 77 this->iterator_ = this->list_->registerIterator(this); 78 } 79 80 /** 81 @brief Constructor: Sets this element to the element of another Iterator. 82 @param other The other Iterator 83 */ 84 inline Iterator(const Iterator<T>& other) 85 { 86 this->element_ = other.element_; 87 this->list_ = other.list_; 88 this->iterator_ = this->list_->registerIterator(this); 89 } 90 91 /** 92 @brief Constructor: Sets this element to a given element 93 @param element The element 94 */ 95 template <class O> 96 inline Iterator(ObjectListElement<O>* element) 97 { 98 this->element_ = (element) ? (ObjectListBaseElement*)element : 0; 99 this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects(); 100 this->iterator_ = this->list_->registerIterator(this); 101 } 102 103 /** 104 @brief Constructor: Sets this element to the element an ObjectListIterator. 105 @param other The ObjectListIterator 106 */ 107 template <class O> 108 inline Iterator(const ObjectListIterator<O>& other) 109 { 110 this->element_ = (other.element_) ? (ObjectListBaseElement*)other.element_ : 0; 111 this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects(); 112 this->iterator_ = this->list_->registerIterator(this); 73 113 } 74 114 … … 78 118 inline ~Iterator() 79 119 { 80 ClassIdentifier<T>::getIdentifier()->getObjects()->unregisterIterator(this); 120 this->list_->unregisterIterator(this->iterator_); 121 } 122 123 /** 124 @brief Assigns an exported element. 125 @param exp The exported element 126 */ 127 inline const Iterator<T>& operator=(const ObjectListBase::Export& exp) 128 { 129 if (this->list_) 130 this->list_->unregisterIterator(this->iterator_); 131 132 this->element_ = exp.element_; 133 this->list_ = exp.list_; 134 this->iterator_ = this->list_->registerIterator(this); 135 136 return (*this); 137 } 138 139 /** 140 @brief Assigns the element of another Iterator. 141 @param other The other Iterator 142 */ 143 inline const Iterator<T>& operator=(const Iterator<T>& other) 144 { 145 if (this->list_) 146 this->list_->unregisterIterator(this->iterator_); 147 148 this->element_ = other.element_; 149 this->list_ = other.list_; 150 this->iterator_ = this->list_->registerIterator(this); 151 152 return (*this); 153 } 154 155 /** 156 @brief Assigns a given element. 157 @param element The element 158 */ 159 template <class O> 160 inline const Iterator<T>& operator=(ObjectListElement<O>* element) 161 { 162 if (this->list_) 163 this->list_->unregisterIterator(this->iterator_); 164 165 this->element_ = (element) ? (ObjectListBaseElement*)element : 0; 166 this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects(); 167 this->iterator_ = this->list_->registerIterator(this); 168 169 return (*this); 170 } 171 172 /** 173 @brief Assigns the element of an ObjectListIterator. 174 @param other The ObjectListIterator 175 */ 176 template <class O> 177 inline const Iterator<T>& operator=(const ObjectListIterator<O>& other) 178 { 179 if (this->list_) 180 this->list_->unregisterIterator(this->iterator_); 181 182 this->element_ = (other.element_) ? (ObjectListBaseElement*)other.element_ : 0; 183 this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects(); 184 this->iterator_ = this->list_->registerIterator(this); 185 186 return (*this); 81 187 } 82 188 … … 85 191 @return The Iterator itself 86 192 */ 87 inline Iterator<T> operator++() 88 { 89 IteratorBase::operator++(); 193 inline const Iterator<T>& operator++() 194 { 195 if (this->element_) 196 this->element_ = this->element_->next_; 90 197 return *this; 91 198 } … … 98 205 { 99 206 Iterator<T> copy = *this; 100 IteratorBase::operator++(); 207 if (this->element_) 208 this->element_ = this->element_->next_; 101 209 return copy; 102 210 } … … 106 214 @return The Iterator itself 107 215 */ 108 inline Iterator<T> operator--() 109 { 110 IteratorBase::operator--(); 216 inline const Iterator<T>& operator--() 217 { 218 if (this->element_) 219 this->element_ = this->element_->prev_; 111 220 return *this; 112 221 } … … 119 228 { 120 229 Iterator<T> copy = *this; 121 IteratorBase::operator--(); 230 if (this->element_) 231 this->element_ = this->element_->prev_; 122 232 return copy; 123 233 } … … 127 237 @return The object the Iterator points at 128 238 */ 129 inline T* operator*() 130 { 131 return dynamic_cast<T*>(IteratorBase::operator*()); 239 inline T* operator*() const 240 { 241 if (this->element_) 242 return dynamic_cast<T*>(this->element_->objectBase_); 243 else 244 return 0; 132 245 } 133 246 … … 138 251 inline T* operator->() const 139 252 { 140 return dynamic_cast<T*>(IteratorBase::operator->()); 253 if (this->element_) 254 return dynamic_cast<T*>(this->element_->objectBase_); 255 else 256 return 0; 257 } 258 259 /** 260 @brief Overloading of the typecast-operator to bool: returns true if the iterator points to an existing object. 261 @return True if the Iterator points to an existing object. 262 */ 263 inline operator bool() const 264 { 265 return (this->element_ != 0); 141 266 } 142 267 … … 146 271 @return True if the iterators point to the same element 147 272 */ 148 inline bool operator==(const Iterator<T>& compare) 273 inline bool operator==(const Iterator<T>& compare) const 149 274 { 150 275 return (this->element_ == compare.element_); … … 156 281 @return True if the iterators point to different elements 157 282 */ 158 inline bool operator!=(const Iterator<T>& compare) 283 inline bool operator!=(const Iterator<T>& compare) const 159 284 { 160 285 return (this->element_ != compare.element_); 161 286 } 287 288 /** 289 @brief Increments the Iterator if it points at the given object. 290 @param object The object to compare with 291 */ 292 inline void incrementIfEqual(OrxonoxClass* object) 293 { 294 if (this->element_ && this->element_->objectBase_ == object) 295 this->operator++(); 296 } 297 298 protected: 299 ObjectListBaseElement* element_; //!< The element the Iterator points at 300 ObjectListBase* list_; //!< The list wherein the element is 301 std::list<void*>::iterator iterator_; //!< The iterator in the notifying list of the ObjectList 162 302 }; 303 304 typedef Iterator<OrxonoxClass> BaseIterator; 163 305 } 164 306 -
code/branches/core3/src/core/MetaObjectList.cc
r1586 r1591 33 33 34 34 #include "MetaObjectList.h" 35 #include "ObjectListBase.h" 36 #include "Identifier.h" 35 37 #include "util/Debug.h" 36 38 … … 46 48 { 47 49 COUT(5) << "*** MetaObjectList: Removing Object from " << this->list_->getIdentifier()->getName() << "-list." << std::endl; 48 this->list_->notifyIterators(this->element_ );50 this->list_->notifyIterators(this->element_->objectBase_); 49 51 50 52 if (this->element_->next_) -
code/branches/core3/src/core/MetaObjectList.h
r1574 r1591 40 40 41 41 #include "CorePrereqs.h" 42 43 #include "ObjectListBase.h"44 #include "Identifier.h"45 42 46 43 namespace orxonox -
code/branches/core3/src/core/ObjectList.h
r1574 r1591 41 41 42 42 #include "Identifier.h" 43 #include " Iterator.h"43 #include "ObjectListIterator.h" 44 44 45 45 namespace orxonox … … 51 51 /** 52 52 Wraps the ObjectListBase of the corresponding Identifier. 53 Use Iterator<class> to iterate through all objects in the list.53 Use ObjectListIterator<class> to iterate through all objects in the list. 54 54 */ 55 55 template <class T> … … 57 57 { 58 58 public: 59 typedef ObjectListIterator<T> iterator; 60 59 61 /** @brief Returns an Iterator to the first element in the list. @return The Iterator */ 60 inline static Iterator<T>begin()61 { return Iterator<T>(ClassIdentifier<T>::getIdentifier()->getObjects()->begin()); }62 inline static ObjectListElement<T>* begin() 63 { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->begin().element_); } 62 64 63 65 /** @brief Returns an Iterator to the element after the last element in the list. @return The Iterator */ 64 inline static Iterator<T>end()65 { return Iterator<T>(ClassIdentifier<T>::getIdentifier()->getObjects()->end()); }66 inline static ObjectListElement<T>* end() 67 { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->end().element_); } 66 68 67 69 /** @brief Returns an Iterator to the last element in the list. @return The Iterator */ 68 inline static Iterator<T>rbegin()69 { return Iterator<T>(ClassIdentifier<T>::getIdentifier()->getObjects()->rbegin()); }70 inline static ObjectListElement<T>* rbegin() 71 { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->rbegin().element_); } 70 72 71 73 /** @brief Returns an Iterator to the element before the first element in the list. @return The Iterator */ 72 inline static Iterator<T>rend()73 { return Iterator<T>(ClassIdentifier<T>::getIdentifier()->getObjects()->rend()); }74 inline static ObjectListElement<T>* rend() 75 { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->rend().element_); } 74 76 }; 75 77 } -
code/branches/core3/src/core/ObjectListBase.cc
r1574 r1591 41 41 #include "ObjectListBase.h" 42 42 #include "Identifier.h" 43 #include "Iterator Base.h"43 #include "Iterator.h" 44 44 45 45 namespace orxonox … … 73 73 @param element The element that gets removed 74 74 */ 75 void ObjectListBase::notifyIterators(O bjectListBaseElement* element)75 void ObjectListBase::notifyIterators(OrxonoxClass* object) const 76 76 { 77 for (std::set<IteratorBase*>::iterator it = this->iterators_.begin(); it != this->iterators_.end(); ++it) 78 if ((*(*(*it))) == element->object_) 79 ++(*(*it)); 77 for (std::list<void*>::const_iterator it = this->iterators_.begin(); it != this->iterators_.end(); ++it) 78 ((Iterator<OrxonoxClass>*)(*it))->incrementIfEqual(object); 79 for (std::list<void*>::const_iterator it = this->objectListIterators_.begin(); it != this->objectListIterators_.end(); ++it) 80 ((ObjectListIterator<OrxonoxClass>*)(*it))->incrementIfEqual(object); 80 81 } 81 82 … … 85 86 @return The pointer to the new ObjectListBaseElement, needed by the MetaObjectList of the added object 86 87 */ 87 ObjectListBaseElement* ObjectListBase::add(O rxonoxClass* object)88 ObjectListBaseElement* ObjectListBase::add(ObjectListBaseElement* element) 88 89 { 89 90 if (!this->last_) 90 91 { 91 92 // If the list is empty 92 this->last_ = new ObjectListBaseElement(object);93 this->last_ = element; 93 94 this->first_ = this->last_; // There's only one object in the list now 94 95 } … … 97 98 // If the list isn't empty 98 99 ObjectListBaseElement* temp = this->last_; 99 this->last_ = new ObjectListBaseElement(object);100 this->last_ = element; 100 101 this->last_->prev_ = temp; 101 102 temp->next_ = this->last_; -
code/branches/core3/src/core/ObjectListBase.h
r1574 r1591 38 38 #define _ObjectListBase_H__ 39 39 40 #include < set>40 #include <list> 41 41 42 42 #include "CorePrereqs.h" … … 55 55 @param object The object to store 56 56 */ 57 ObjectListBaseElement(OrxonoxClass* object ) : object_(object), next_(0), prev_(0) {}57 ObjectListBaseElement(OrxonoxClass* objectBase) : next_(0), prev_(0), objectBase_(objectBase) {} 58 58 59 OrxonoxClass* object_; //!< The object60 59 ObjectListBaseElement* next_; //!< The next element in the list 61 60 ObjectListBaseElement* prev_; //!< The previous element in the list 61 OrxonoxClass* objectBase_; 62 }; 63 64 65 // ############################### 66 // ### ObjectListElement ### 67 // ############################### 68 //! The list-element that actually contains the object 69 template <class T> 70 class ObjectListElement : public ObjectListBaseElement 71 { 72 public: 73 ObjectListElement(T* object) : ObjectListBaseElement(object), object_(object) {} 74 T* object_; //!< The object 62 75 }; 63 76 … … 79 92 ~ObjectListBase(); 80 93 81 ObjectListBaseElement* add(OrxonoxClass* object); 94 ObjectListBaseElement* add(ObjectListBaseElement* element); 95 96 struct Export 97 { 98 Export(ObjectListBase* list, ObjectListBaseElement* element) : list_(list), element_(element) {} 99 ObjectListBase* list_; 100 ObjectListBaseElement* element_; 101 }; 82 102 83 103 /** @brief Returns a pointer to the first element in the list. @return The element */ 84 inline ObjectListBaseElement* begin() const { return this->first_; }104 inline Export begin() { return ObjectListBase::Export(this, this->first_); } 85 105 /** @brief Returns a pointer to the element after the last element in the list. @return The element */ 86 inline ObjectListBaseElement* end() const { return 0; }106 inline Export end() { return ObjectListBase::Export(this, 0); } 87 107 /** @brief Returns a pointer to the last element in the list. @return The element */ 88 inline ObjectListBaseElement* rbegin() const { return this->last_; }108 inline Export rbegin() { return ObjectListBase::Export(this, this->last_); } 89 109 /** @brief Returns a pointer to the element in front of the first element in the list. @return The element */ 90 inline ObjectListBaseElement* rend() const { return 0; }110 inline Export rend() { return ObjectListBase::Export(this, 0); } 91 111 92 inline void registerIterator(IteratorBase* iterator)93 { this->iterators_.insert(this->iterators_.end(),iterator); }94 inline void unregisterIterator(IteratorBase* iterator)95 { this->iterators_.erase(iterator); }96 void notifyIterators(O bjectListBaseElement* element);112 inline std::list<void*>::iterator registerIterator(void* iterator) { return this->iterators_.insert(this->iterators_.begin(), iterator); } 113 inline void unregisterIterator(const std::list<void*>::iterator& iterator) { this->iterators_.erase(iterator); } 114 inline std::list<void*>::iterator registerObjectListIterator(void* iterator) { return this->objectListIterators_.insert(this->iterators_.begin(), iterator); } 115 inline void unregisterObjectListIterator(const std::list<void*>::iterator& iterator) { this->objectListIterators_.erase(iterator); } 116 void notifyIterators(OrxonoxClass* object) const; 97 117 98 118 inline Identifier* getIdentifier() const { return this->identifier_; } 99 119 100 120 private: 101 Identifier* identifier_; //!< The Iterator owning this list 102 ObjectListBaseElement* first_; //!< The first element in the list 103 ObjectListBaseElement* last_; //!< The last element in the list 104 std::set<IteratorBase*> iterators_; //!< A list of iterators pointing on an element in this list 121 Identifier* identifier_; //!< The Iterator owning this list 122 ObjectListBaseElement* first_; //!< The first element in the list 123 ObjectListBaseElement* last_; //!< The last element in the list 124 std::list<void*> iterators_; //!< A list of Iterators pointing on an element in this list 125 std::list<void*> objectListIterators_; //!< A list of ObjectListIterators pointing on an element in this list 105 126 }; 106 127 } -
code/branches/core3/src/core/Shell.cc
r1586 r1591 68 68 69 69 this->outputBuffer_.registerListener(this); 70 OutputHandler::getOutStream().setOutputBuffer(this->outputBuffer_); 70 71 71 72 this->setConfigValues(); -
code/branches/core3/src/network/ConnectionManager.cc
r1574 r1591 44 44 #include "core/CoreIncludes.h" 45 45 #include "core/BaseObject.h" 46 #include "core/Iterator.h" 46 47 #include "objects/SpaceShip.h" 47 48 #include "util/Math.h" … … 337 338 bool ConnectionManager::removeShip(ClientInformation *client){ 338 339 int id=client->getShipID(); 339 orxonox:: Iterator<orxonox::SpaceShip>it;340 orxonox::ObjectList<orxonox::SpaceShip>::iterator it; 340 341 for(it = orxonox::ObjectList<orxonox::SpaceShip>::begin(); it; ++it){ 341 342 if(it->objectID!=id) -
code/branches/core3/src/network/GameStateClient.cc
r1574 r1591 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/BaseObject.h" 35 #include "core/Iterator.h" 35 36 #include "Synchronisable.h" 36 37 … … 137 138 * @return iterator pointing to the next object in the list 138 139 */ 139 void GameStateClient::removeObject(orxonox:: Iterator<Synchronisable>&it) {140 orxonox:: Iterator<Synchronisable>temp=it;140 void GameStateClient::removeObject(orxonox::ObjectList<Synchronisable>::iterator &it) { 141 orxonox::ObjectList<Synchronisable>::iterator temp=it; 141 142 ++it; 142 143 delete *temp; … … 151 152 COUT(4) << "loadSnapshot: loading gs: " << state->id << std::endl; 152 153 // get the start of the Synchronisable list 153 orxonox:: Iterator<Synchronisable>it=orxonox::ObjectList<Synchronisable>::begin();154 orxonox::ObjectList<Synchronisable>::iterator it=orxonox::ObjectList<Synchronisable>::begin(); 154 155 syncData sync; 155 156 // loop as long as we have some data ;) … … 222 223 int tempsize=0; 223 224 // get the start of the Synchronisable list 224 orxonox:: Iterator<Synchronisable>it;225 orxonox::ObjectList<Synchronisable>::iterator it; 225 226 // struct for return value of Synchronisable::getData() 226 227 syncData sync; -
code/branches/core3/src/network/GameStateClient.h
r1505 r1591 42 42 43 43 #include <map> 44 // 44 // 45 45 #include "NetworkPrereqs.h" 46 46 #include "core/CorePrereqs.h" … … 58 58 GameStateClient(); 59 59 ~GameStateClient(); 60 60 61 61 void addGameState(GameStateCompressed *gs); 62 62 int processGameState(); … … 72 72 GameState *decode(GameState *old, GameStateCompressed *diff); 73 73 GameState *decode(GameStateCompressed *x); 74 void removeObject(orxonox:: Iterator<Synchronisable> &it);74 void removeObject(orxonox::ObjectListIterator<Synchronisable> &it); 75 75 void printGameStateMap(); 76 76 bool saveShipCache(); … … 83 83 orxonox::SpaceShip *myShip_; 84 84 syncData shipCache_; 85 86 87 88 85 86 87 88 89 89 public: 90 90 //#### ADDED FOR TESTING PURPOSE #### -
code/branches/core3/src/network/GameStateManager.cc
r1574 r1591 48 48 #include "core/CoreIncludes.h" 49 49 #include "core/BaseObject.h" 50 #include "core/Iterator.h" 50 51 #include "ClientInformation.h" 51 52 #include "Synchronisable.h" … … 180 181 int tempsize=0; 181 182 // get the start of the Synchronisable list 182 orxonox:: Iterator<Synchronisable>it;183 orxonox::ObjectList<Synchronisable>::iterator it; 183 184 // struct for return value of Synchronisable::getData() 184 185 syncData sync; … … 246 247 COUT(4) << "loadSnapshot: loading gs: " << state->id << std::endl; 247 248 // get the start of the Synchronisable list 248 orxonox:: Iterator<Synchronisable>it=orxonox::ObjectList<Synchronisable>::begin();249 orxonox::ObjectList<Synchronisable>::iterator it=orxonox::ObjectList<Synchronisable>::begin(); 249 250 syncData sync; 250 251 /*ClientInformation *client = head_->findClient(clientID); -
code/branches/core3/src/network/Server.cc
r1574 r1591 52 52 #include "objects/SpaceShip.h" 53 53 #include "core/ConsoleCommand.h" 54 #include "core/Iterator.h" 54 55 55 56 namespace network … … 400 401 401 402 //boost::recursive_mutex::scoped_lock lock(head_->mutex_); 402 orxonox:: Iterator<orxonox::SpaceShip>it = orxonox::ObjectList<orxonox::SpaceShip>::begin();403 orxonox::ObjectList<orxonox::SpaceShip>::iterator it = orxonox::ObjectList<orxonox::SpaceShip>::begin(); 403 404 ClientInformation *client = clients->findClient(&event->peer->address); 404 405 if(!client) … … 409 410 continue; 410 411 } 411 orxonox:: Iterator<orxonox::SpaceShip>temp=it;412 orxonox::ObjectList<orxonox::SpaceShip>::iterator temp=it; 412 413 ++it; 413 414 delete *temp; -
code/branches/core3/src/network/Synchronisable.h
r1534 r1591 85 85 Synchronisable(); 86 86 private: 87 /* bool removeObject( Iterator<Synchronisable>it);*/87 /* bool removeObject(ObjectList<Synchronisable>::iterator it);*/ 88 88 89 89 std::list<synchronisableVariable *> *syncList; -
code/branches/core3/src/orxonox/GraphicsEngine.cc
r1586 r1591 47 47 #include "core/CoreIncludes.h" 48 48 #include "core/ConfigValueIncludes.h" 49 #include "core/Iterator.h" 49 50 #include "core/CommandExecutor.h" 50 51 #include "core/ConsoleCommand.h" … … 100 101 101 102 if (this->detailLevelParticle_ != old) 102 for ( Iterator<ParticleInterface>it = ObjectList<ParticleInterface>::begin(); it; ++it)103 for (ObjectList<ParticleInterface>::iterator it = ObjectList<ParticleInterface>::begin(); it; ++it) 103 104 it->detailLevelChanged(this->detailLevelParticle_); 104 105 } -
code/branches/core3/src/orxonox/Orxonox.cc
r1586 r1591 54 54 // core 55 55 #include "core/ConfigFileManager.h" 56 #include "core/Iterator.h" 56 57 #include "core/ConsoleCommand.h" 57 58 #include "core/Loader.h" … … 75 76 #include "GraphicsEngine.h" 76 77 #include "Settings.h" 78 77 79 78 80 // FIXME: is this really file scope? … … 169 171 Orxonox::getSingleton()->timefactor_ = factor; 170 172 171 for ( Iterator<ParticleInterface>it = ObjectList<ParticleInterface>::begin(); it; ++it)173 for (ObjectList<ParticleInterface>::iterator it = ObjectList<ParticleInterface>::begin(); it; ++it) 172 174 it->setSpeedFactor(it->getSpeedFactor() * change); 173 175 } … … 462 464 Core::tick((float)evt.timeSinceLastFrame); 463 465 // Call those objects that need the real time 464 for ( Iterator<TickableReal>it = ObjectList<TickableReal>::begin(); it; ++it)466 for (ObjectList<TickableReal>::iterator it = ObjectList<TickableReal>::begin(); it; ++it) 465 467 it->tick((float)evt.timeSinceLastFrame); 466 468 // Call the scene objects 467 for ( Iterator<Tickable>it = ObjectList<Tickable>::begin(); it; ++it)469 for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it) 468 470 it->tick((float)evt.timeSinceLastFrame * this->timefactor_); 469 471 //AudioManager::tick(); -
code/branches/core3/src/orxonox/objects/NPC.cc
r1574 r1591 31 31 32 32 #include "core/CoreIncludes.h" 33 #include "core/Iterator.h" 33 34 34 35 namespace orxonox { … … 117 118 int numberOfNeighbour = 0; //number of observed neighbours 118 119 float distance = 0; // distance to the actual element 119 for( Iterator<WorldEntity>it = ObjectList<WorldEntity>::begin(); it; ++it) { //go through all elements120 for(ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it; ++it) { //go through all elements 120 121 distance = getDistance(*it); //get distance between this and actual 121 122 if ((distance > 0) && (distance < SEPERATIONDISTANCE)) { //do only if actual is inside detectionradius … … 144 145 //float distance = 0; 145 146 //go through all elements 146 for( Iterator<NPC>it = ObjectList<NPC>::begin(); it; ++it) { //just working with 3 elements at the moment147 for(ObjectList<NPC>::iterator it = ObjectList<NPC>::begin(); it; ++it) { //just working with 3 elements at the moment 147 148 float distance = getDistance(*it); //get distance between this and actual 148 149 if ((distance > 0) && (distance < ALIGNMENTDISTANCE)) { //check if actual element is inside detectionradius … … 164 165 //float distance = 0; 165 166 //go through all elements 166 for( Iterator<NPC>it = ObjectList<NPC>::begin(); it; ++it) { //just working with 3 elements at the moment167 for(ObjectList<NPC>::iterator it = ObjectList<NPC>::begin(); it; ++it) { //just working with 3 elements at the moment 167 168 float distance = getDistance(*it); //get distance between this and actual 168 169 if ((distance > 0) && (distance < COHESIONDISTANCE)) { //check if actual element is inside detectionradius -
code/branches/core3/src/orxonox/objects/Projectile.cc
r1584 r1591 35 35 #include "core/Executor.h" 36 36 #include "core/ConfigValueIncludes.h" 37 #include "core/Iterator.h" 37 38 #include "tools/ParticleInterface.h" 38 39 … … 87 88 88 89 float radius; 89 for ( Iterator<Model>it = ObjectList<Model>::begin(); it; ++it)90 for (ObjectList<Model>::iterator it = ObjectList<Model>::begin(); it; ++it) 90 91 { 91 92 if ((*it) != this->owner_) -
code/branches/core3/src/orxonox/objects/SpaceShip.cc
r1586 r1591 41 41 #include "core/CoreIncludes.h" 42 42 #include "core/ConfigValueIncludes.h" 43 #include "core/Iterator.h" 43 44 #include "core/input/InputManager.h" 44 45 #include "core/XMLPort.h" … … 71 72 72 73 SpaceShip *SpaceShip::getLocalShip(){ 73 Iterator<SpaceShip>it;74 ObjectList<SpaceShip>::iterator it; 74 75 for(it = ObjectList<SpaceShip>::begin(); it; ++it){ 75 76 if( (it)->myShip_ ) -
code/branches/core3/src/orxonox/objects/SpaceShipAI.cc
r1566 r1591 72 72 SpaceShipAI::~SpaceShipAI() 73 73 { 74 for ( Iterator<SpaceShipAI>it = ObjectList<SpaceShipAI>::begin(); it; ++it)74 for (ObjectList<SpaceShipAI>::iterator it = ObjectList<SpaceShipAI>::begin(); it; ++it) 75 75 it->shipDied(this); 76 76 } … … 111 111 { 112 112 int i = 0; 113 for ( Iterator<SpaceShipAI>it = ObjectList<SpaceShipAI>::begin(); it; )113 for (ObjectList<SpaceShipAI>::iterator it = ObjectList<SpaceShipAI>::begin(); it; ) 114 114 { 115 115 (it++)->kill(); … … 259 259 this->forgetTarget(); 260 260 261 for ( Iterator<SpaceShip>it = ObjectList<SpaceShip>::begin(); it; ++it)261 for (ObjectList<SpaceShip>::iterator it = ObjectList<SpaceShip>::begin(); it; ++it) 262 262 { 263 263 if (it->getTeamNr() != this->getTeamNr())
Note: See TracChangeset
for help on using the changeset viewer.