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
|
Line | |
---|
1 | #ifndef _Factory_H__ |
---|
2 | #define _Factory_H__ |
---|
3 | |
---|
4 | #include <map> |
---|
5 | #include <string> |
---|
6 | |
---|
7 | namespace orxonox |
---|
8 | { |
---|
9 | class BaseObject; |
---|
10 | class Identifier; |
---|
11 | |
---|
12 | // ############################### |
---|
13 | // ### Factory ### |
---|
14 | // ############################### |
---|
15 | class Factory |
---|
16 | { |
---|
17 | public: |
---|
18 | static Identifier* getIdentifier(const std::string& name); |
---|
19 | static void add(const std::string& name, Identifier* identifier); |
---|
20 | |
---|
21 | private: |
---|
22 | Factory() {} |
---|
23 | Factory(const Factory& factory) {} |
---|
24 | ~Factory() {} |
---|
25 | |
---|
26 | static Factory* pointer_s; |
---|
27 | std::map<std::string, Identifier*> identifierMap_; |
---|
28 | }; |
---|
29 | |
---|
30 | // ############################### |
---|
31 | // ### BaseFactory ### |
---|
32 | // ############################### |
---|
33 | class BaseFactory |
---|
34 | { |
---|
35 | public: |
---|
36 | virtual BaseObject* fabricate() = 0; |
---|
37 | }; |
---|
38 | } |
---|
39 | |
---|
40 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.