Changeset 3652 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Mar 25, 2005, 5:51:00 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/Makefile.am
r3646 r3652 119 119 lib/util/ini_parser.h \ 120 120 lib/math/vector.h \ 121 lib/math/vector_new.h \122 lib/math/quaternion.h \123 121 lib/math/curve.h \ 124 122 glmenu/glmenu_imagescreen.h -
orxonox/trunk/src/Makefile.in
r3646 r3652 323 323 lib/util/ini_parser.h \ 324 324 lib/math/vector.h \ 325 lib/math/vector_new.h \326 lib/math/quaternion.h \327 325 lib/math/curve.h \ 328 326 glmenu/glmenu_imagescreen.h -
orxonox/trunk/src/lib/util/list.h
r3586 r3652 46 46 }; 47 47 48 class Iterator 49 { 50 48 49 50 template<class T> struct listElement 51 { 52 listElement* prev; 53 T* curr; 54 listElement* next; 55 }; 56 57 template<class T> class tIterator 58 { 51 59 public: 52 bool hasNext(); 53 WorldEntity* next(); 60 tIterator(listElement<T>* startElement); 61 ~tIterator(); 62 63 T* nextElement(); 54 64 55 65 private: 56 57 }; 66 listElement<T>* currentEl; 67 listElement<T>* firstEl; 68 }; 69 70 71 template<class T> 72 tIterator<T>::tIterator (listElement<T>* startElement) 73 { 74 this->currentEl = startElement; 75 this->firstEl = startElement; 76 } 77 78 79 template<class T> 80 tIterator<T>::~tIterator () 81 { 82 this->currentEl = NULL; 83 } 84 85 86 template<class T> 87 inline T* tIterator<T>::nextElement () 88 { 89 if( this->currentEl == NULL) 90 { 91 PRINTF(1)("Iterator has not been initialized - there is no currentEl\n"); 92 return NULL; 93 } 94 if( this->currentEl->next == NULL) 95 return NULL; 96 return this->currentEl->next->curr; 97 } 98 58 99 59 100 60 101 template<class T> class tList 61 102 { 62 private:63 struct listElement64 {65 listElement* prev;66 T* curr;67 listElement* next;68 };69 70 Uint32 size;71 listElement* first;72 listElement* last;73 listElement* currentEl;74 103 75 104 public: 76 105 tList (); 77 106 ~tList (); 78 79 107 80 108 void add(T* entity); … … 85 113 int getSize(); 86 114 T* enumerate(); 115 tIterator<T>* getIterator(); 87 116 T* nextElement(); 88 117 T* nextElement(T* toEntity); 89 118 T* toArray(); 90 119 void debug(); 120 121 private: 122 123 Uint32 size; 124 listElement<T>* first; 125 listElement<T>* last; 126 listElement<T>* currentEl; 127 91 128 }; 92 129 … … 106 143 while(this->currentEl != NULL) 107 144 { 108 listElement * le = this->currentEl->next;145 listElement<T>* le = this->currentEl->next; 109 146 //delete this->currentEl->curr; 110 147 delete this->currentEl; … … 121 158 { 122 159 if( entity == NULL) return; 123 listElement * el = new listElement;160 listElement<T>* el = new listElement<T>; 124 161 el->prev = this->last; 125 162 el->curr = entity; … … 139 176 if( entity == NULL) return; 140 177 this->currentEl = this->first; 141 listElement * te;178 listElement<T>* te; 142 179 while( this->currentEl != NULL) 143 180 { … … 167 204 while(this->currentEl != NULL) 168 205 { 169 listElement * le = this->currentEl->next;206 listElement<T>* le = this->currentEl->next; 170 207 //delete this->currentEl->curr; 171 208 delete this->currentEl; … … 203 240 { 204 241 //if( this->last == this->first == NULL) return NULL; 205 if( this->size == 0) return NULL;242 if( this->size == 0) return NULL; 206 243 this->currentEl = this->first; 207 244 return this->currentEl->curr; … … 210 247 211 248 template<class T> 249 tIterator<T>* tList<T>::getIterator() 250 { 251 if( this->size == 0) return NULL; 252 tIterator<T>* iterator = new tIterator<T>(this->first); 253 return iterator; 254 } 255 256 257 template<class T> 212 258 T* tList<T>::nextElement() 213 259 { 214 260 // if( this->last == this->first == NULL) return NULL; 215 if( this->size == 0) return NULL;261 if( this->size == 0) return NULL; 216 262 this->currentEl = this->currentEl->next; 217 if( this->currentEl == NULL) return NULL;263 if( this->currentEl == NULL) return NULL; 218 264 return this->currentEl->curr; 219 265 } -
orxonox/trunk/src/orxonox.cc
r3651 r3652 628 628 mi = mittel / (float)VECTOR_MAX; 629 629 printf(" Generate rot matrix: q->matrix(m)\t%11.2f\n", mi); 630 631 632 633 634 635 630 } 636 637 638 631 } 639 632 }
Note: See TracChangeset
for help on using the changeset viewer.