Changeset 7374 in orxonox.OLD for trunk/src/lib/shell/shell_command.h
- Timestamp:
- Apr 26, 2006, 3:28:55 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.h
r7368 r7374 16 16 17 17 18 // FORWARD DECLARATION 19 class ShellCommandClass; 20 class ShellCommandAlias; 18 namespace OrxShell 19 { 20 // FORWARD DECLARATION 21 class ShellCommandClass; 22 class ShellCommandAlias; 21 23 22 /**23 * an easy to use Macro to create a Command24 * @param command the name of the command (without "" around the string)25 * @param class the name of the class to apply this command to (without the "" around the string)26 * @param function the function to call27 *28 * MEANING:29 * ShellCommand* someUniqueVarName =30 * ShellCommand<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall);31 *32 * In the Shell you would call this Command using:33 * $ ClassName [ObjectName] commandNameInShell [parameters]34 */35 //#define SHELL_COMMAND(command, class, function) \36 // ShellCommand* shell_command_##class##_##command = ShellCommand<class>::registerCommand(#command, #class, &class::function)24 /** 25 * an easy to use Macro to create a Command 26 * @param command the name of the command (without "" around the string) 27 * @param class the name of the class to apply this command to (without the "" around the string) 28 * @param function the function to call 29 * 30 * MEANING: 31 * ShellCommand* someUniqueVarName = 32 * ShellCommand<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall); 33 * 34 * In the Shell you would call this Command using: 35 * $ ClassName [ObjectName] commandNameInShell [parameters] 36 */ 37 //#define SHELL_COMMAND(command, class, function) \ 38 // ShellCommand* shell_command_##class##_##command = ShellCommand<class>::registerCommand(#command, #class, &class::function) 37 39 #define SHELL_COMMAND(command, class, function) \ 38 ShellCommand* shell_command_##class##_##command =ShellCommand::registerCommand(#command, #class, ExecutorObjective<class>(&class::function))40 OrxShell::ShellCommand* shell_command_##class##_##command = OrxShell::ShellCommand::registerCommand(#command, #class, ExecutorObjective<class>(&class::function)) 39 41 40 /**41 * an easy to use Macro to create a Command42 * @param command the name of the command (without "" around the string)43 * @param class the name of the class to apply this command to (without the "" around the string)44 * @param function the function to call45 *46 * MEANING:47 * ShellCommand* someUniqueVarName =48 * ShellCommand<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall);49 *50 * In the Shell you would call this Command using:51 * $ ClassName [ObjectName] commandNameInShell [parameters]52 */42 /** 43 * an easy to use Macro to create a Command 44 * @param command the name of the command (without "" around the string) 45 * @param class the name of the class to apply this command to (without the "" around the string) 46 * @param function the function to call 47 * 48 * MEANING: 49 * ShellCommand* someUniqueVarName = 50 * ShellCommand<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall); 51 * 52 * In the Shell you would call this Command using: 53 * $ ClassName [ObjectName] commandNameInShell [parameters] 54 */ 53 55 #define SHELL_COMMAND_STATIC(command, class, function) \ 54 ShellCommand* shell_command_##class##_##command =ShellCommand::registerCommand(#command, #class, ExecutorStatic<class>(function))56 OrxShell::ShellCommand* shell_command_##class##_##command = OrxShell::ShellCommand::registerCommand(#command, #class, ExecutorStatic<class>(function)) 55 57 56 58 57 59 58 //! a baseClass for all possible ShellCommands59 class ShellCommand : public BaseObject60 {61 friend class ShellCommandClass;60 //! a baseClass for all possible ShellCommands 61 class ShellCommand : public BaseObject 62 { 63 friend class ShellCommandClass; 62 64 public: 63 65 static bool execute (const std::string& executionString); … … 89 91 Executor* executor; //!< The Executor, that really executes the Function. 90 92 91 };93 }; 92 94 93 //! A Class, that handles aliases.94 class ShellCommandAlias95 {96 friend class ShellCommand;95 //! A Class, that handles aliases. 96 class ShellCommandAlias 97 { 98 friend class ShellCommand; 97 99 public: 98 100 /** @returns the Name of the Alias. */ … … 108 110 std::string aliasName; //!< the name of the Alias 109 111 ShellCommand* command; //!< a pointer to the command, this alias executes. 110 }; 112 }; 113 114 } 111 115 112 116 #endif /* _SHELL_COMMAND_H */
Note: See TracChangeset
for help on using the changeset viewer.