Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 4, 2005, 1:39:32 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/parenting: added some more functionality, and wrote the [con|de]structors

File:
1 edited

Legend:

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

    r3330 r3331  
    2222using namespace std;
    2323
     24/**
     25   \brief initializes a TrackElement (sets the default values)
     26*/
     27TrackElement::TrackElement(void)
     28{
     29  this->isSavePoint = false;
     30  this->isFork = false;
     31  this->isJoined = false;
     32  this->cond; //!< todo think!!
     33  this->ID = -1;
     34  this->length =0;
     35  this->curveType = BEZIERCURVE;
     36  this->nodeCount = 0;
     37  childCount = 0;
     38  this->curve = NULL;
     39  this->children = NULL;
     40}
     41
     42/**
     43    \destroys all alocated memory)
     44    \todo eventually when deleting a TrackElement you would not like to delete all its preceding TrackElements
     45*/
     46TrackElement::~TrackElement(void)
     47{
     48  if (this->curve)
     49    delete this->curve;
     50  if (this->childCount > 0)
     51    {
     52      for (int i=0; i < this->childCount; i++)
     53        delete this->children[i];
     54    }
     55}
     56
     57
     58
    2459
    2560/**
     
    3065TrackManager::TrackManager ()
    3166{
    32    this->setClassName ("TrackManager");
    33 }
    34 
    35 
    36 /**
    37    \brief standard deconstructor
     67  this->setClassName ("TrackManager");
     68
     69  PRINTF(3)("Initializing the TrackManager\n");
     70  this->firstTrackElem = NULL;
     71  this->currentTrackElem = firstTrackElem;
     72  this->localTime = 0;
     73  this->maxTime = 0;
     74  this->trackElemCount = 0;
     75}
     76
     77
     78/**
     79   \brief standard destructor
    3880
    3981   \todo this deconstructor is not jet implemented - do it
     
    4183TrackManager::~TrackManager ()
    4284{
    43 
     85  PRINTF(3)("Destruct TrackManager\n");
     86
     87  PRINTF(3)("Deleting all the TrackElements\n");
     88  delete this->firstTrackElem;
     89  // we do not have a TrackManager anymore
     90  singletonRef = NULL;
     91}
     92
     93TrackManager* TrackManager::singletonRef = NULL;
     94
     95/**
     96   \returns The reference on the TrackManager.
     97
     98   If the TrackManager does not exist, it will be created.
     99*/
     100TrackManager* TrackManager::getInstance(void)
     101{
     102  if (singletonRef)
     103    return singletonRef;
     104  else
     105    return singletonRef = new TrackManager();
    44106}
    45107
     
    201263
    202264/**
     265   \brief Jumps to a certain point on the Track.
     266   \param time The time on the Track to jump to.
     267
     268   This should be used to Jump backwards on a Track, because moving forward means to change between the Path. (it then tries to choose the default.)
     269   Max is trackLengthMax.
     270*/
     271void TrackManager::jumpTo(float time)
     272{
     273
     274}
     275
     276/**
    203277   \brief a Function that decides which Path we should follow.
    204278   \param graphID The Path to choose.
Note: See TracChangeset for help on using the changeset viewer.