| Rev | Line | |
|---|
| [dfed1c] | 1 | /**
|
|---|
| 2 | * @file command_factory.hpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Thu May 19 16:48:40 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief Class to store possible commands.
|
|---|
| 7 | *
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | #ifndef COMMAND_FACTORY_HPP_
|
|---|
| 11 | #define COMMAND_FACTORY_HPP_
|
|---|
| 12 |
|
|---|
| 13 | #include <map>
|
|---|
| 14 | #include <string>
|
|---|
| 15 |
|
|---|
| 16 | namespace VMG
|
|---|
| 17 | {
|
|---|
| 18 |
|
|---|
| 19 | class Command;
|
|---|
| 20 | class CommandProxyBase;
|
|---|
| 21 |
|
|---|
| 22 | class CommandFactory
|
|---|
| 23 | {
|
|---|
| 24 | public:
|
|---|
| 25 | CommandFactory();
|
|---|
| 26 | virtual ~CommandFactory();
|
|---|
| 27 |
|
|---|
| 28 | void Register(CommandProxyBase* command); ///< Registers a command
|
|---|
| 29 | Command* Get(const std::string& id); ///< Returns a command
|
|---|
| 30 | void Delete(const std::string& id); ///< Deletes a command
|
|---|
| 31 |
|
|---|
| 32 | bool CheckNumberOfArguments(const std::string& id, const int& num_arguments);
|
|---|
| 33 |
|
|---|
| 34 | void PrintAvailableCommands(); ///< Prints the names of all registered commands
|
|---|
| 35 |
|
|---|
| 36 | private:
|
|---|
| 37 | std::map<std::string, CommandProxyBase*> proxy_map;
|
|---|
| 38 | std::map<std::string, Command*> instance_map;
|
|---|
| 39 |
|
|---|
| 40 | };
|
|---|
| 41 |
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | #endif /* COMMAND_FACTORY_HPP_ */
|
|---|
| 45 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.