Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 9, 2005, 10:50:20 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/trackManager: backloop-check created

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/trackManager/src/track_manager.cc

    r3432 r3463  
    8888
    8989
     90/**
     91   \brief checks if there are any BackLoops in the Track
     92   \param trackElem the trackElement to check about
     93   it simply does this by looking if the current trackElem is found again somewhere else in the Track
     94*/
     95bool TrackElement::backLoopCheck(TrackElement* trackElem)
     96{
     97  if (this->childCount == 0)
     98    return true;
     99  else
     100    {
     101      for (int i = 0; i < this->childCount; i++)
     102        if(!this->children[i]->backLoopCheck(trackElem))
     103          return false;
     104     
     105      return true;
     106    }
     107}
    90108
    91109
     
    137155TrackManager* TrackManager::getInstance(void)
    138156{
    139   if (singletonRef)
    140     return singletonRef;
     157  if (TrackManager::singletonRef)
     158    return TrackManager::singletonRef;
    141159  else
    142     return singletonRef = new TrackManager();
     160    return TrackManager::singletonRef = new TrackManager();
    143161}
    144162
     
    370388{
    371389  printf("Joining %d tracks and merging to Track %d\n", count, trackIDs[0]);
     390
     391  // checking if there is a back-loop-connection and ERROR if it is.
     392  TrackElement* tmpTrackElem = this->findTrackElementByID(trackIDs[0]);
     393  if (!tmpTrackElem->backLoopCheck(tmpTrackElem))
     394    PRINTF(1)("Backloop connection detected at joining trackElements\n");
    372395
    373396  // chanching work-on to temporary value. going back at the end.
Note: See TracChangeset for help on using the changeset viewer.