Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5637 in orxonox.OLD for trunk


Ignore:
Timestamp:
Nov 18, 2005, 7:04:02 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: using Executor successfully (but with runtime-errors)

Location:
trunk/src/lib/shell
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_command.cc

    r5636 r5637  
    280280 * @param paramCount the count of parameters this command takes
    281281 */
    282 ShellCommand::ShellCommand(const char* commandName, const char* className, unsigned int paramCount, ...)
     282ShellCommand::ShellCommand(const char* commandName, const char* className, Executor* executor)
    283283{
    284284  this->setClassID(CL_SHELL_COMMAND, "ShellCommand");
     
    298298  this->defaultValue = new MultiType[paramCount];
    299299
    300   va_list parameterList;
    301   va_start(parameterList, paramCount);
    302 
    303   // What Parameters we have got
    304   for (unsigned int i = 0; i < paramCount; i++)
    305     this->parameters[i] = va_arg(parameterList, int);
     300  this->executor = executor;
    306301}
    307302
     
    325320ShellCommand* ShellCommand::registerCommand(const char* commandName, const char* className, Executor* executor)
    326321{
    327   return NULL;
     322  if (ShellCommand::isRegistered(commandName, className, executor))
     323    return NULL;
     324  else
     325    return new ShellCommand(commandName, className, executor);
    328326
    329327}
     
    378376 * This is checked in the registerCommand-function.
    379377 */
    380 bool ShellCommand::isRegistered(const char* commandName, const char* className, unsigned int paramCount, ...)
     378bool ShellCommand::isRegistered(const char* commandName, const char* className, Executor* executor)
    381379{
    382380  if (ShellCommandClass::commandClassList == NULL)
     
    447445          {
    448446            if (inputSplits.getCount() > 1)
    449               elemAL->getCommand()->executeCommand(objectList->firstElement(), executionString+inputSplits.getOffset(1));
     447              elemAL->getCommand()->executor->execute(objectList->firstElement(), executionString+inputSplits.getOffset(1));
    450448            else
    451               elemAL->getCommand()->executeCommand(objectList->firstElement(), "");
     449              elemAL->getCommand()->executor->execute(objectList->firstElement(), "");
    452450            delete itAL;
    453451            return true;
     
    516514            }
    517515            if (inputSplits.getCount() > fktPos+1)
    518               enumCMD->executeCommand(objectPointer, executionString+inputSplits.getOffset(fktPos +1));
     516              enumCMD->executor->execute(objectPointer, executionString+inputSplits.getOffset(fktPos +1));
    519517            else
    520               enumCMD->executeCommand(objectPointer, "");
     518              enumCMD->executor->execute(objectPointer, "");
    521519            delete itCMD;
    522520            return true;
  • trunk/src/lib/shell/shell_command.h

    r5636 r5637  
    120120
    121121  protected:
    122     ShellCommand(const char* commandName, const char* className, unsigned int paramCount, ...);
     122    ShellCommand(const char* commandName, const char* className, Executor* executor);
    123123    ~ShellCommand();
    124124
     
    126126    inline ShellCommand_Type getType() { return this->functorType; };
    127127
    128     static bool isRegistered(const char* commandName, const char* className, unsigned int paramCount, ...);
     128    static bool isRegistered(const char* commandName, const char* className, Executor* executor);
    129129    static const char* paramToString(long parameter);
    130 
    131   private:
    132     /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */
    133     virtual void executeCommand (BaseObject* object, const char* parameters) = 0;
    134130
    135131  protected:
Note: See TracChangeset for help on using the changeset viewer.