Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4933 in orxonox.OLD for orxonox/trunk/src/util/object_manager.cc


Ignore:
Timestamp:
Jul 22, 2005, 6:20:42 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: more elaborate FastFactory, that should work…
now i have to test it… this will generate segfaults for sure :/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/object_manager.cc

    r4932 r4933  
    2929 *  constructor, sets everything to zero and define factoryName
    3030 */
    31 FastFactory::FastFactory (const char* fastFactoryName, ClassID classID)
     31FastFactory::FastFactory (ClassID classID, const char* fastFactoryName)
    3232{
    3333  this->setClassID(CL_FAST_FACTORY, "FastFactory");
     
    3636  this->storedClassID = classID;
    3737  this->next = NULL;
     38
     39  this->storedDeadObjects = 0;
    3840
    3941  FastFactory::registerFastFactory(this);
     
    5658}
    5759
    58 /**
    59  * add a FastFactory to the FastFactory Queue
    60  * @param factory a FastFactory to be registered
    61  */
    62 void FastFactory::registerFastFactory( FastFactory* factory)
     60void FastFactory::registerFastFactory(FastFactory* fastFactory)
    6361{
    64   PRINTF(3)("Registered FastFactory for '%s'\n", factory->getName());
     62  PRINTF(4)("Registered FastFactory for '%s'\n", fastFactory->getName());
    6563
    6664  if( FastFactory::first == NULL)
    67     FastFactory::first = factory;
     65    FastFactory::first = fastFactory;
    6866  else
    6967  {
    7068    FastFactory* tmpFac = FastFactory::first;
    7169    while( tmpFac->next != NULL)
    72     {
    7370      tmpFac = tmpFac->next;
    74     }
    75     tmpFac->setNext(factory);
     71    tmpFac->setNext(fastFactory);
    7672  }
    7773}
    7874
    7975
     76/**
     77 * searches for a FastFactory
     78 * @param factoryName the Name of the Factory to search for (not used)
     79 * @param classID the ClassID of the FastFactory to search for
     80 * @returns true if found, false otherwise.
     81 */
     82FastFactory* FastFactory::searchFastFactory(ClassID classID, const char* fastFactoryName)
     83{
     84  if (FastFactory::first == NULL)
     85    return NULL;
     86   else
     87   {
     88     FastFactory* tmpFac = FastFactory::first;
     89     while (tmpFac != NULL)
     90     {
     91       if (tmpFac->storedClassID == classID)
     92         return tmpFac;
     93       tmpFac = tmpFac->next;
     94     }
     95   }
     96   return NULL;
     97}
    8098
    8199
Note: See TracChangeset for help on using the changeset viewer.