Changeset 4508 in orxonox.OLD for orxonox/trunk/src/util
- Timestamp:
- Jun 4, 2005, 2:29:11 PM (20 years ago)
- Location:
- orxonox/trunk/src/util/track
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/track/track_manager.cc
r4502 r4508 149 149 150 150 /** 151 \brief checks if there are any BackLoops in the Track (Backloops only 152 \param trackElem the trackElement to check about 153 \param depth the depth to search in 151 \brief checks if there are any BackLoops in the Track 154 152 \returns true if NO loop was found, false Otherwise 155 153 You actually have to act on false!! 156 it simply does this by looking if the current trackElem is found again somewhere else in the Track 157 158 \todo this has to be reimplemented 159 */ 160 bool TrackElement::backLoopCheck(const TrackElement* trackElem, unsigned int depth) const 161 { 162 if(depth == 0 || this != trackElem) 163 { 164 if (this->children) 165 { 166 tIterator<TrackElement>* iterator = this->children->getIterator(); 167 TrackElement* enumElem = iterator->nextElement(); 168 while (enumElem) 169 { 170 if(!enumElem->backLoopCheck(trackElem, depth + 1)) 171 return false; 172 enumElem = iterator->nextElement(); 173 } 174 delete iterator; 175 } 176 } 177 else 178 return false; 179 154 */ 155 bool TrackElement::backLoopCheck(void) const 156 { 157 tList<const TrackElement>* trackList = new tList<const TrackElement>; 158 159 this->backLoopCheckAtomic(trackList); 160 161 delete trackList; 180 162 // only returns if everything worked out 181 163 return true; 182 164 } 165 166 /** 167 \brief checks if there are any BackLoops in the Track. 168 \param trackList A list of stored tracks, to search in. 169 \returns true if NO loop was found, false Otherwise 170 You actually have to act on false!! 171 */ 172 bool TrackElement::backLoopCheckAtomic(tList<const TrackElement>* trackList) const 173 { 174 if (trackList->inList(this)) 175 return false; 176 177 trackList->add(this); 178 179 if (this->children) 180 { 181 tIterator<TrackElement>* iterator = this->children->getIterator(); 182 TrackElement* enumElem = iterator->nextElement(); 183 while (enumElem) 184 { 185 if (!enumElem->backLoopCheckAtomic(trackList)) 186 return false; 187 } 188 delete iterator; 189 } 190 return true; 191 } 192 183 193 184 194 /** … … 264 274 PRINT(0)(" is Joined at the End\n"); 265 275 266 if(!this->backLoopCheck( this)) /* this should not happen */276 if(!this->backLoopCheck()) /* this should not happen */ 267 277 PRINT(2)(" THERE IS A BACKLOOP TO THIS ELEMENT\n"); 268 278 } … … 916 926 // checking if there is a back-loop-connection and ERROR if it is. 917 927 tmpTrackElem = this->firstTrackElem->findByID(trackIDs[0]); 918 if (!tmpTrackElem->backLoopCheck( tmpTrackElem))928 if (!tmpTrackElem->backLoopCheck()) 919 929 { 920 930 PRINTF(2)("Backloop connection detected at joining trackElements\n -> TRACK WILL NOT BE JOINED\n"); -
orxonox/trunk/src/util/track/track_manager.h
r4502 r4508 48 48 TrackElement* findByID(unsigned int trackID); 49 49 TrackElement* findByName(const char* trackName); 50 bool backLoopCheck( const TrackElement* trackElem, unsigned int depth = 0) const;50 bool backLoopCheck(void) const; 51 51 52 52 TrackElement* getChild(int childNumber) const; … … 55 55 inline const char* getName(void) const { return this->name; }; 56 56 57 57 private: 58 bool backLoopCheckAtomic(tList<const TrackElement>* trackList) const; 59 60 public: 58 61 // atributes 59 62 bool isFresh; //!< If no Points where added until now
Note: See TracChangeset
for help on using the changeset viewer.