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