Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 19, 2007, 10:10:11 PM (16 years ago)
Author:
landauf
Message:
  • removed the "ClassHierarchy" manager-class and put its sole feature (bIsCreatingClassHierarchy_) directly into the Identifier.
  • added a dynamic_cast from OrxonoxClass to BaseObject to the Factory. OrxonoxClass is needed because several classes use Interfaces, but all classes are derived at least from BaseObject, so the cast will work.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchie/src/Factory.cc

    r218 r219  
    11#include "Factory.h"
    22#include "Identifier.h"
     3#include "BaseObject.h"
    34
    45namespace orxonox
    56{
    6     ClassFactory* ClassFactory::pointer_ = NULL;
     7    ClassFactory* ClassFactory::pointer_s = NULL;
    78
    8     OrxonoxClass* ClassFactory::fabricate(const std::string& name)
     9    BaseObject* ClassFactory::fabricate(const std::string& name)
    910    {
    10         if (!pointer_)
    11             pointer_ = new ClassFactory;
     11        if (!pointer_s)
     12            pointer_s = new ClassFactory;
    1213
    13         return pointer_->identifierMap_[name]->fabricate();
     14        return pointer_s->identifierMap_[name]->fabricate();
    1415    }
    1516
    1617    void ClassFactory::add(const std::string& name, Identifier* identifier)
    1718    {
    18         if (!pointer_)
    19             pointer_ = new ClassFactory;
     19        if (!pointer_s)
     20            pointer_s = new ClassFactory;
    2021
    21         pointer_->identifierMap_[name] = identifier;
     22        pointer_s->identifierMap_[name] = identifier;
    2223    }
    2324}
Note: See TracChangeset for help on using the changeset viewer.