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); |
---|
[362] | 19 | static Identifier* getIdentifier(const unsigned int id); |
---|
[218] | 20 | static void add(const std::string& name, Identifier* identifier); |
---|
[362] | 21 | static void changeNetworkID(Identifier* identifier, const unsigned int oldID, const unsigned int newID); |
---|
[218] | 22 | |
---|
| 23 | private: |
---|
[244] | 24 | Factory() {} |
---|
| 25 | Factory(const Factory& factory) {} |
---|
| 26 | ~Factory() {} |
---|
[218] | 27 | |
---|
[244] | 28 | static Factory* pointer_s; |
---|
[362] | 29 | std::map<std::string, Identifier*> identifierStringMap_; |
---|
| 30 | std::map<unsigned int, Identifier*> identifierNetworkIDMap_; |
---|
[218] | 31 | }; |
---|
[244] | 32 | |
---|
| 33 | // ############################### |
---|
| 34 | // ### BaseFactory ### |
---|
| 35 | // ############################### |
---|
| 36 | class BaseFactory |
---|
| 37 | { |
---|
| 38 | public: |
---|
| 39 | virtual BaseObject* fabricate() = 0; |
---|
| 40 | }; |
---|
[218] | 41 | } |
---|
| 42 | |
---|
| 43 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.