Changeset 5641 in orxonox.OLD for trunk/src/lib/shell
- Timestamp:
- Nov 18, 2005, 9:22:23 PM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.cc
r5640 r5641 36 36 * @param paramCount the count of parameters this command takes 37 37 */ 38 ShellCommand::ShellCommand(const char* commandName, const char* className, Executor*executor)38 ShellCommand::ShellCommand(const char* commandName, const char* className, const Executor& executor) 39 39 { 40 40 this->setClassID(CL_SHELL_COMMAND, "ShellCommand"); … … 54 54 this->defaultValue = new MultiType[paramCount]; 55 55 56 this->executor = executor ;56 this->executor = executor.clone(); 57 57 } 58 58 … … 69 69 delete this->alias; 70 70 } 71 delete this->executor; 71 72 } 72 73 … … 74 75 * registers a new ShellCommand 75 76 */ 76 ShellCommand* ShellCommand::registerCommand(const char* commandName, const char* className, Executor*executor)77 ShellCommand* ShellCommand::registerCommand(const char* commandName, const char* className, const Executor& executor) 77 78 { 78 79 if (ShellCommand::isRegistered(commandName, className, executor)) … … 132 133 * This is checked in the registerCommand-function. 133 134 */ 134 bool ShellCommand::isRegistered(const char* commandName, const char* className, Executor*executor)135 bool ShellCommand::isRegistered(const char* commandName, const char* className, const Executor& executor) 135 136 { 136 137 if (ShellCommandClass::commandClassList == NULL) -
trunk/src/lib/shell/shell_command.h
r5640 r5641 41 41 // ShellCommand* shell_command_##class##_##command = ShellCommand<class>::registerCommand(#command, #class, &class::function) 42 42 #define SHELL_COMMAND(command, class, function) \ 43 ShellCommand* shell_command_##class##_##command = ShellCommand::registerCommand(#command, #class, newExecutorObjective<class>(&class::function))43 ShellCommand* shell_command_##class##_##command = ShellCommand::registerCommand(#command, #class, ExecutorObjective<class>(&class::function)) 44 44 45 45 /** … … 57 57 */ 58 58 #define SHELL_COMMAND_STATIC(command, class, function) \ 59 ShellCommand* shell_command_##class##_##command = ShellCommand::registerCommand(#command, #class, newExecutorStatic<class>(function))59 ShellCommand* shell_command_##class##_##command = ShellCommand::registerCommand(#command, #class, ExecutorStatic<class>(function)) 60 60 61 61 … … 72 72 ShellCommand* defaultValues(unsigned int count, ...); 73 73 74 static ShellCommand* registerCommand(const char* commandName, const char* className, Executor*executor);74 static ShellCommand* registerCommand(const char* commandName, const char* className, const Executor& executor); 75 75 76 76 static void unregisterCommand(const char* commandName, const char* className); … … 79 79 80 80 protected: 81 ShellCommand(const char* commandName, const char* className, Executor*executor);81 ShellCommand(const char* commandName, const char* className, const Executor& executor); 82 82 ~ShellCommand(); 83 83 84 static bool isRegistered(const char* commandName, const char* className, Executor*executor);84 static bool isRegistered(const char* commandName, const char* className, const Executor& executor); 85 85 static const char* paramToString(long parameter); 86 86 87 87 protected: 88 void* functionPointer; //!< The pointeer to the function of the Class (or static pointer if ClassID == CL_NULL )89 88 unsigned int paramCount; //!< the count of parameters. 90 89 unsigned int* parameters; //!< Parameters the function of this Command takes. -
trunk/src/lib/shell/shell_command_class.cc
r5639 r5641 217 217 { 218 218 ShellCommandClass::commandClassList = new tList<ShellCommandClass>; 219 ShellCommand::registerCommand("debug", "ShellCommand", newExecutorStatic<ShellCommand>(ShellCommand::debug));219 ShellCommand::registerCommand("debug", "ShellCommand", ExecutorStatic<ShellCommand>(ShellCommand::debug)); 220 220 } 221 221 }
Note: See TracChangeset
for help on using the changeset viewer.