| Rev | Line | |
|---|
| [48b662] | 1 | /**
|
|---|
| 2 | * @file proxy.hpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Mon Apr 18 12:23:43 2011
|
|---|
| 5 | *
|
|---|
| [dfed1c] | 6 | * @brief Header file for the classes VMG::CommandProxyBase and
|
|---|
| 7 | * VMG::CommandProxy, used register commands at the factory.
|
|---|
| [48b662] | 8 | *
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 | #ifndef COMMAND_PROXY_HPP_
|
|---|
| 13 | #define COMMAND_PROXY_HPP_
|
|---|
| 14 |
|
|---|
| 15 | namespace VMG
|
|---|
| 16 | {
|
|---|
| 17 |
|
|---|
| 18 | class Command;
|
|---|
| 19 |
|
|---|
| 20 | class CommandProxyBase
|
|---|
| 21 | {
|
|---|
| 22 | public:
|
|---|
| 23 | CommandProxyBase();
|
|---|
| 24 | virtual Command* CreateCommand() const = 0;
|
|---|
| 25 |
|
|---|
| 26 | virtual const char* Name() const = 0;
|
|---|
| 27 | virtual int Arguments() const = 0;
|
|---|
| 28 | };
|
|---|
| 29 |
|
|---|
| 30 | template <class T>
|
|---|
| 31 | class CommandProxy : public CommandProxyBase
|
|---|
| 32 | {
|
|---|
| 33 | public:
|
|---|
| 34 | Command* CreateCommand() const
|
|---|
| 35 | {
|
|---|
| 36 | return new T;
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| 39 | const char* Name() const
|
|---|
| 40 | {
|
|---|
| 41 | return T::Name();
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | int Arguments() const
|
|---|
| 45 | {
|
|---|
| 46 | return T::Arguments();
|
|---|
| 47 | }
|
|---|
| 48 | };
|
|---|
| 49 |
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | #endif /* COMMAND_PROXY_HPP_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.