Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Aug 27, 2005, 3:57:42 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: no more segfaults wenn creating entities

File:
1 edited

Legend:

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

    r5155 r5156  
    4141 public:
    4242  Factory (const char* factoryName = NULL);
    43   ~Factory ();
     43  virtual ~Factory ();
    4444
    4545  void fabricate(const char* className, const char* entityName);
    4646  virtual BaseObject* fabricate(const TiXmlElement* root) = NULL;
     47  virtual BaseObject* fabricateDirect() = NULL;
    4748
    4849  static void registerFactory( Factory* factory);
     
    7374  private:
    7475  virtual BaseObject* fabricate(const TiXmlElement* root);
     76  virtual BaseObject* fabricateDirect();
    7577};
    7678
     
    9395BaseObject* tFactory<T>::fabricate(const TiXmlElement* root)
    9496{
     97  if (root == NULL)
     98    return NULL;
     99
    95100  if(!strcmp(root->Value(), this->getName()))
    96101    return new T ( root);
     
    101106}
    102107
     108template<class T>
     109    BaseObject* tFactory<T>::fabricateDirect()
     110{
     111  return new T((const TiXmlElement*)NULL);
     112}
     113
    103114#endif /* _FACTORY_H */
    104115
Note: See TracChangeset for help on using the changeset viewer.