Last change
on this file since 4239 was
4239,
checked in by bensch, 19 years ago
|
orxonox/branches/levelLoader: factory not in stdincl anymore
|
File size:
1.0 KB
|
Line | |
---|
1 | |
---|
2 | #ifndef _LOAD_PARAM_H |
---|
3 | #define _LOAD_PARAM_H |
---|
4 | |
---|
5 | #include "factory.h" |
---|
6 | #include "debug.h" |
---|
7 | |
---|
8 | // abstract base class |
---|
9 | class baseLoadParam |
---|
10 | { |
---|
11 | public: |
---|
12 | // virtual void Call(const char* string)=0; // call using function |
---|
13 | }; |
---|
14 | |
---|
15 | |
---|
16 | // derived template class |
---|
17 | template<class T> class LoadParam : public baseLoadParam |
---|
18 | { |
---|
19 | public: |
---|
20 | LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(const char*)) |
---|
21 | { |
---|
22 | const char* loadString = grabParameter(root, paramName); |
---|
23 | if (loadString != NULL) |
---|
24 | (*pt2Object.*function)(loadString); |
---|
25 | else |
---|
26 | PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); |
---|
27 | |
---|
28 | }; |
---|
29 | |
---|
30 | LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(float)) |
---|
31 | { |
---|
32 | const char* loadString = grabParameter(root, paramName); |
---|
33 | if (loadString != NULL) |
---|
34 | (*pt2Object.*function)(atoi(loadString)); |
---|
35 | else |
---|
36 | PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); |
---|
37 | }; |
---|
38 | }; |
---|
39 | |
---|
40 | |
---|
41 | #endif /* _LOAD_PARAM_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.