Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jul 22, 2005, 2:11:21 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: adapted the Factory algorithm to ObjectManager… still a logn way to go…

File:
1 edited

Legend:

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

    r4836 r4930  
    1919#include "list.h"
    2020
     21#include "debug.h"
    2122
    2223using namespace std;
     
    106107  PRINT(0)("=======================================================\n");
    107108}
     109
     110/**
     111 *  constructor
     112
     113   set everything to zero and define factoryName
     114 */
     115FastObject::FastObject (const char* fastObjectName, ClassID classID)
     116{
     117  this->setClassID(CL_FACTORY, "FastObject");
     118  this->setName(fastObjectName);
     119
     120  this->storedClassID = classID;
     121  this->next = NULL;
     122
     123  FastObject::registerFastObject(this);
     124}
     125
     126/** a reference to the First FastObject */
     127FastObject* FastObject::first = NULL;
     128
     129/**
     130 *  destructor
     131
     132   clear the Q
     133 */
     134FastObject::~FastObject ()
     135{
     136  //  printf("%s\n", this->factoryName);
     137  //  FastObject* tmpDel = this->next;
     138  //  this->next = NULL;
     139  if (this->next)
     140    delete this->next;
     141}
     142
     143/**
     144 *  add a FastObject to the FastObject Queue
     145 * @param factory a FastObject to be registered
     146 */
     147void FastObject::registerFastObject( FastObject* factory)
     148{
     149  PRINTF(4)("Registered FastObject for '%s'\n", factory->getName());
     150
     151  if( FastObject::first == NULL)
     152    FastObject::first = factory;
     153  else
     154  {
     155    FastObject* tmpFac = FastObject::first;
     156    while( tmpFac->next != NULL)
     157    {
     158      tmpFac = tmpFac->next;
     159    }
     160    tmpFac->setNext(factory);
     161  }
     162}
Note: See TracChangeset for help on using the changeset viewer.