Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4729 in orxonox.OLD for orxonox/trunk/src/util


Ignore:
Timestamp:
Jun 29, 2005, 12:05:16 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: factory-fix

Location:
orxonox/trunk/src/util/loading
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/loading/factory.cc

    r4725 r4729  
    3535  this->setName(factoryName);
    3636
    37   this->factoryName = NULL;
    38   this->setFactoryName(factoryName);
    3937  next = NULL;
    4038
     
    5452  if (this->next)
    5553    delete this->next;
    56 
    57   if (this->factoryName)
    58     delete []this->factoryName;
    5954}
    60 
    61 /**
    62    \brief sets the name of this factory
    63 */
    64 void Factory::setFactoryName(const char* factoryName)
    65 {
    66   if (this->factoryName)
    67     delete this->factoryName;
    68   this->factoryName = new char[strlen(factoryName)+1];
    69   strcpy(this->factoryName, factoryName);
    70 }
    71 
    7255
    7356/**
  • orxonox/trunk/src/util/loading/factory.h

    r4597 r4729  
    4848  void initialize();
    4949  void registerFactory( Factory* factory);
    50   void setFactoryName(const char* factoryName);
    51   /** \returns the name of the factory */
    52   const char* getFactoryName() { return this->factoryName; };
    5350  /** \brief sets the Next factory in the list \param nextFactory the next factory */
    5451  inline void setNext( Factory* nextFactory) { this->next = nextFactory; };
     
    5653  Factory* getNext(void) const { return this->next; };
    5754
    58  protected:
    59   char*         factoryName;          //!< the name of the factory
    6055 private:
    61   Factory*      next;                 //!< pointer to the next factory.
     56  Factory*          next;                 //!< pointer to the next factory.
     57  static Factory*   first;                //!< A pointer to the first factory.
    6258};
    6359
     
    8379tFactory<T>::tFactory(const char* factoryName) : Factory(factoryName)
    8480{
    85   PRINTF(5)("fileName: %s loadable\n", this->factoryName);
     81  PRINTF(5)("fileName: %s loadable\n", this->getName());
    8682}
    8783
     
    9490BaseObject* tFactory<T>::fabricate(const TiXmlElement* root)
    9591{
    96   if(!strcmp(root->Value(), getFactoryName()))
     92  if(!strcmp(root->Value(), getName()))
    9793    return new T ( root);
    9894  else if( getNext() != NULL)
  • orxonox/trunk/src/util/loading/game_loader.cc

    r4598 r4729  
    326326        assert( factory != NULL);
    327327
    328         PRINTF(4)("Registered factory for '%s'\n", factory->getFactoryName());
     328        PRINTF(4)("Registered factory for '%s'\n", factory->getName());
    329329
    330330        if( first == NULL) first = factory;
Note: See TracChangeset for help on using the changeset viewer.