Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/objecthierarchie/src/Factory.cc @ 239

Last change on this file since 239 was 219, checked in by landauf, 17 years ago
  • 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 size: 582 bytes
Line 
1#include "Factory.h"
2#include "Identifier.h"
3#include "BaseObject.h"
4
5namespace orxonox
6{
7    ClassFactory* ClassFactory::pointer_s = NULL;
8
9    BaseObject* ClassFactory::fabricate(const std::string& name)
10    {
11        if (!pointer_s)
12            pointer_s = new ClassFactory;
13
14        return pointer_s->identifierMap_[name]->fabricate();
15    }
16
17    void ClassFactory::add(const std::string& name, Identifier* identifier)
18    {
19        if (!pointer_s)
20            pointer_s = new ClassFactory;
21
22        pointer_s->identifierMap_[name] = identifier;
23    }
24}
Note: See TracBrowser for help on using the repository browser.