Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4003 in orxonox.OLD for orxonox/branches/ll2trunktemp/src/factory.h


Ignore:
Timestamp:
Apr 28, 2005, 2:25:08 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/ll2trunktemp: some small modifications, testing, why 2 instances of fabricate are deleted, and not just the first one

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/ll2trunktemp/src/factory.h

    r3940 r4003  
    1111#include "xmlparser/tinyxml.h"
    1212
     13#define CREATE_FACTORY(x) \
     14                class x ## Factory : public Factory { \
     15                 public:        \
     16                  x ## Factory (){setClassname( #x );} \
     17                  ~x ## Factory () {}; \
     18                 private: \
     19                        BaseObject* fabricate( TiXmlElement* root) \
     20                        { \
     21                                if(!strcmp(root->Value(), getClassname())) return new  x ( root); \
     22                                else if( getNext() != NULL) return getNext()->fabricate( root); \
     23                                else return NULL; \
     24                        } \
     25                }; \
     26                x ## Factory global_ ## x ## Factory;
     27               
    1328//! The Factory is
    1429/**
    15         Very philosophic description, huh?
     30   Very philosophic description, huh?
    1631*/
    1732class Factory {
     
    2035  Factory ();
    2136  ~Factory ();
     37 
    2238
    23         virtual BaseObject* fabricate( TiXmlElement* root);
    24         void initialize();
    25         void registerFactory( Factory* factory);
    26         void setClassname(char* name) {classname = name;}
    27         char* getClassname() {return classname;};
    28         void setNext( Factory* factory) {next = factory;}
    29         Factory* getNext() {return next;}
     39  virtual BaseObject* fabricate( TiXmlElement* root);
     40  void initialize();
     41  void registerFactory( Factory* factory);
     42  void setClassname(char* name) {classname = name;}
     43  char* getClassname() {return classname;};
     44  void setNext( Factory* factory) {next = factory;}
     45  Factory* getNext() {return next;}
    3046       
    3147 private:
    32         char* classname;
     48  char* classname;
    3349       
    3450  Factory* next;
Note: See TracChangeset for help on using the changeset viewer.