Line | |
---|
1 | #include "Factory.h" |
---|
2 | #include "Identifier.h" |
---|
3 | |
---|
4 | namespace orxonox |
---|
5 | { |
---|
6 | Factory* Factory::pointer_s = NULL; |
---|
7 | |
---|
8 | Identifier* Factory::getIdentifier(const std::string& name) |
---|
9 | { |
---|
10 | if (!pointer_s) |
---|
11 | pointer_s = new Factory; |
---|
12 | |
---|
13 | return pointer_s->identifierStringMap_[name]; |
---|
14 | } |
---|
15 | |
---|
16 | Identifier* Factory::getIdentifier(const unsigned int id) |
---|
17 | { |
---|
18 | if (!pointer_s) |
---|
19 | pointer_s = new Factory; |
---|
20 | |
---|
21 | return pointer_s->identifierNetworkIDMap_[id]; |
---|
22 | } |
---|
23 | |
---|
24 | void Factory::add(const std::string& name, Identifier* identifier) |
---|
25 | { |
---|
26 | if (!pointer_s) |
---|
27 | pointer_s = new Factory; |
---|
28 | |
---|
29 | pointer_s->identifierStringMap_[name] = identifier; |
---|
30 | pointer_s->identifierNetworkIDMap_[identifier->getNetworkID()] = identifier; |
---|
31 | } |
---|
32 | |
---|
33 | void Factory::changeNetworkID(Identifier* identifier, const unsigned int oldID, const unsigned int newID) |
---|
34 | { |
---|
35 | pointer_s->identifierNetworkIDMap_.erase(oldID); |
---|
36 | pointer_s->identifierNetworkIDMap_[newID] = identifier; |
---|
37 | } |
---|
38 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.