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