Last change
on this file since 244 was
244,
checked in by landauf, 17 years ago
|
reimplementation of the factory and parts of the class-hierarchy-generating-algorithm. interfaces with protected constructors are now allowed.
|
File size:
942 bytes
|
Rev | Line | |
---|
[218] | 1 | #ifndef _Factory_H__ |
---|
| 2 | #define _Factory_H__ |
---|
| 3 | |
---|
| 4 | #include <map> |
---|
| 5 | #include <string> |
---|
| 6 | |
---|
| 7 | namespace orxonox |
---|
| 8 | { |
---|
[244] | 9 | class BaseObject; |
---|
[218] | 10 | class Identifier; |
---|
| 11 | |
---|
[244] | 12 | // ############################### |
---|
| 13 | // ### Factory ### |
---|
| 14 | // ############################### |
---|
| 15 | class Factory |
---|
[218] | 16 | { |
---|
| 17 | public: |
---|
[244] | 18 | static Identifier* getIdentifier(const std::string& name); |
---|
[218] | 19 | static void add(const std::string& name, Identifier* identifier); |
---|
| 20 | |
---|
| 21 | private: |
---|
[244] | 22 | Factory() {} |
---|
| 23 | Factory(const Factory& factory) {} |
---|
| 24 | ~Factory() {} |
---|
[218] | 25 | |
---|
[244] | 26 | static Factory* pointer_s; |
---|
[218] | 27 | std::map<std::string, Identifier*> identifierMap_; |
---|
| 28 | }; |
---|
[244] | 29 | |
---|
| 30 | // ############################### |
---|
| 31 | // ### BaseFactory ### |
---|
| 32 | // ############################### |
---|
| 33 | class BaseFactory |
---|
| 34 | { |
---|
| 35 | public: |
---|
| 36 | virtual BaseObject* fabricate() = 0; |
---|
| 37 | }; |
---|
[218] | 38 | } |
---|
| 39 | |
---|
| 40 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.