Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4730 in orxonox.OLD for orxonox/trunk/src/util/loading/factory.h


Ignore:
Timestamp:
Jun 29, 2005, 1:46:15 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: loading fields

File:
1 edited

Legend:

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

    r4729 r4730  
    3535  \todo make factoryName a BaseObject-parameter. (else it would be redundant)
    3636*/
    37 #define CREATE_FACTORY(CLASS_NAME) tFactory<CLASS_NAME>* global_##CLASS_NAME##Factory = new tFactory<CLASS_NAME>(#CLASS_NAME)
     37#define CREATE_FACTORY(CLASS_NAME) tFactory<CLASS_NAME>* global_##CLASS_NAME##_Factory = new tFactory<CLASS_NAME>(#CLASS_NAME)
    3838
    3939//! The Factory is a loadable object handler
     
    4545
    4646
    47   virtual BaseObject* fabricate(const TiXmlElement* root);
     47  virtual BaseObject* fabricate(const TiXmlElement* root) = NULL;
    4848  void initialize();
    4949  void registerFactory( Factory* factory);
    5050  /** \brief sets the Next factory in the list \param nextFactory the next factory */
    5151  inline void setNext( Factory* nextFactory) { this->next = nextFactory; };
     52  /** \returns the first factory */
     53  static Factory* getFirst(void) { return Factory::first; };
    5254  /** \returns the next factory */
    5355  Factory* getNext(void) const { return this->next; };
     56
    5457
    5558 private:
     
    6972
    7073  private:
    71   BaseObject* fabricate(const TiXmlElement* root);
     74  virtual BaseObject* fabricate(const TiXmlElement* root);
    7275};
    7376
     
    7982tFactory<T>::tFactory(const char* factoryName) : Factory(factoryName)
    8083{
    81   PRINTF(5)("fileName: %s loadable\n", this->getName());
     84  PRINTF(5)("Class: %s loadable\n", this->getName());
    8285}
    8386
     
    9093BaseObject* tFactory<T>::fabricate(const TiXmlElement* root)
    9194{
    92   if(!strcmp(root->Value(), getName()))
     95  if(!strcmp(root->Value(), this->getName()))
    9396    return new T ( root);
    9497  else if( getNext() != NULL)
Note: See TracChangeset for help on using the changeset viewer.