Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5262 in orxonox.OLD for trunk/src/lib/util


Ignore:
Timestamp:
Sep 26, 2005, 11:33:55 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: file-parsing works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/util/array.h

    r5100 r5262  
    1515
    1616/*!
    17   \file array.h
    18   \brief Contains the Array Class that handles arrays of classes.
     17  @file array.h
     18  @brief Contains the Array Class that handles arrays of classes.
    1919  this class creates a Array of a semi-Dynamic length.
    2020  beware, that after finalizing the array may not be resized again.
     
    9090{
    9191  PRINTF(5)("deleting array\n");
    92   Entry* walker = this->firstEntry;
    93   Entry* previous;
    94   while (walker)
     92  if (!this->finalized)
    9593  {
    96     previous = walker;
    97     walker = walker->next;
    98     delete previous;
     94    Entry* walker = this->firstEntry;
     95    Entry* previous;
     96    while (walker)
     97    {
     98      previous = walker;
     99      walker = walker->next;
     100      delete previous;
     101    }
    99102  }
    100   if (finalized)
     103  if (this->finalized)
    101104    delete[] this->array;
    102105}
     
    109112void Array<T>::finalizeArray ()
    110113{
     114  if (this->finalized)
     115    return;
    111116  PRINTF(5)("Finalizing array. Length: %i\n", entryCount);
    112117  if (!(this->array = new T [this->entryCount]))
    113118    PRINTF(1)("could not allocate %i data Blocks\n", this->entryCount);
    114119  Entry* walker = this->firstEntry;
    115   for (int i=0; i<this->entryCount; i++)
     120  for (int i=0; i < this->entryCount; i++)
    116121  {
    117122    this->array[i] = walker->value;
Note: See TracChangeset for help on using the changeset viewer.