Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5632 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Nov 18, 2005, 4:58:01 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: added new class Executor, that should be a Functor-Handler for ShellCommand and LoadParam.

Location:
trunk/src/lib/util/executor
Files:
1 added
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/util/executor/executor.cc

    r5628 r5632  
    1616//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
    1717
    18 #include "shell_command.h"
     18#include "executor.h"
    1919
    2020#include "list.h"
     
    2929using namespace std;
    3030
    31 /**
    32  * creates a new ShellCommandClass
    33  * @param className the Name of the command-class to create
    34  */
    35 ShellCommandClass::ShellCommandClass(const char* className)
    36 {
    37   this->setClassID(CL_SHELL_COMMAND_CLASS, "ShellCommandClass");
    38   this->setName(className);
    39 
    40   this->className = className;
    41   this->classID = CL_NULL;
    42   this->commandList = new tList<ShellCommandBase>;
    43 
    44   ShellCommandClass::commandClassList->add(this);
    45 }
    46 
    47 /**
    48  * destructs the shellCommandClass again
    49  */
    50 ShellCommandClass::~ShellCommandClass()
    51 {
    52   tIterator<ShellCommandBase>* iterator = this->commandList->getIterator();
    53   ShellCommandBase* elem = iterator->firstElement();
    54   while(elem != NULL)
    55   {
    56     delete elem;
    57     elem = iterator->nextElement();
    58   }
    59   delete iterator;
    60   delete this->commandList;
    61 }
    62 
    63 /**
    64  * collects the Commands registered to some class.
    65  * @param className the name of the Class to collect the Commands from.
    66  * @param stringList a List to paste the Commands into.
    67  * @returns true on success, false otherwise
    68  */
    69 bool ShellCommandClass::getCommandListOfClass(const char* className, tList<const char>* stringList)
    70 {
    71   if (stringList == NULL || className == NULL)
    72     return false;
    73 
    74   tIterator<ShellCommandClass>* iterator = ShellCommandClass::commandClassList->getIterator();
    75   ShellCommandClass* elem = iterator->firstElement();
    76   while(elem != NULL)
    77   {
    78     if (!strcmp (elem->getName(), className))
    79     {
    80       tIterator<ShellCommandBase>* itFkt = elem->commandList->getIterator();
    81       ShellCommandBase* command = itFkt->firstElement();
    82       while (command != NULL)
    83       {
    84         stringList->add(command->getName());
    85         command = itFkt->nextElement();
    86       }
    87       delete itFkt;
    88     }
    89 
    90     elem = iterator->nextElement();
    91   }
    92   delete iterator;
    93   return true;
    94 }
    95 
    96 /**
    97  * collects the Aliases registered to the ShellCommands
    98  * @param stringList a List to paste the Aliases into.
    99  * @returns true on success, false otherwise
    100  */
    101 bool ShellCommandClass::getCommandListOfAlias(tList<const char>* stringList)
    102 {
    103   if (stringList == NULL || ShellCommandClass::aliasList == NULL)
    104     return false;
    105 
    106   tIterator<ShellCommandAlias>* iterator = ShellCommandClass::aliasList->getIterator();
    107    ShellCommandAlias* elem = iterator->firstElement();
    108    while(elem != NULL)
    109    {
    110      stringList->add(elem->getName());
    111      elem = iterator->nextElement();
    112    }
    113    delete iterator;
    114    return true;
    115 }
    116 
    117 /**
    118  * unregisters all Commands that exist
    119  */
    120 void ShellCommandClass::unregisterAllCommands()
    121 {
    122   // unregister all commands
    123   tIterator<ShellCommandClass>* iterator = ShellCommandClass::commandClassList->getIterator();
    124   ShellCommandClass* elem = iterator->firstElement();
    125   while(elem != NULL)
    126   {
    127     delete elem;
    128 
    129     elem = iterator->nextElement();
    130   }
    131   delete iterator;
    132 
    133   delete ShellCommandClass::commandClassList;
    134   ShellCommandClass::commandClassList = NULL;
    135 
    136   // unregister all aliases (there should be nothing to do here :))
    137   if (ShellCommandClass::aliasList != NULL)
    138   {
    139     tIterator<ShellCommandAlias>* itAL = ShellCommandClass::aliasList->getIterator();
    140     ShellCommandAlias* elemAL = itAL->firstElement();
    141     while(elemAL != NULL)
    142     {
    143       delete elemAL;
    144       elemAL = itAL->nextElement();
    145     }
    146     delete itAL;
    147     delete ShellCommandClass::aliasList;
    148     ShellCommandClass::aliasList = NULL;
    149   }
    150 }
    151 
    152 /**
    153  * checks if a Class is already registered to the Commands' class-stack
    154  * @param className the Name of the Class to check for
    155  * @returns the CommandClass if found, NULL otherwise
    156  */
    157 const ShellCommandClass* ShellCommandClass::isRegistered(const char* className)
    158 {
    159   if (ShellCommandClass::commandClassList == NULL)
    160     initCommandClassList();
    161 
    162   tIterator<ShellCommandClass>* iterator = ShellCommandClass::commandClassList->getIterator();
    163   ShellCommandClass* elem = iterator->firstElement();
    164   while(elem != NULL)
    165   {
    166     if (!strcmp(className, elem->className))
    167     {
    168       if (elem->classID == CL_NULL)
    169         elem->classID = ClassList::StringToID(className);
    170 
    171       delete iterator;
    172       return elem;
    173     }
    174     elem = iterator->nextElement();
    175   }
    176   delete iterator;
    177   return NULL;
    178 }
    179 
    180 /**
    181  * searches for a CommandClass
    182  * @param className the name of the CommandClass
    183  * @returns the CommandClass if found, or a new CommandClass if not
    184  */
    185 ShellCommandClass* ShellCommandClass::getCommandClass(const char* className)
    186 {
    187   if (ShellCommandClass::commandClassList == NULL)
    188     initCommandClassList();
    189 
    190   tIterator<ShellCommandClass>* iterator = ShellCommandClass::commandClassList->getIterator();
    191   ShellCommandClass* elem = iterator->firstElement();
    192   while(elem != NULL)
    193   {
    194     if (!strcmp(className, elem->className))
    195     {
    196       delete iterator;
    197       return elem;
    198     }
    199     elem = iterator->nextElement();
    200   }
    201   delete iterator;
    202   return new ShellCommandClass(className);
    203 }
    204 
    205 /**
    206  * initializes the CommandList (if it is NULL)
    207  */
    208 void ShellCommandClass::initCommandClassList()
    209 {
    210   if (ShellCommandClass::commandClassList == NULL)
    211   {
    212     ShellCommandClass::commandClassList = new tList<ShellCommandClass>;
    213     ShellCommandStatic<ShellCommandBase>::registerCommand("debug", "ShellCommand", ShellCommandBase::debug);
    214   }
    215 }
    216 
    217 void ShellCommandClass::help(const char* className)
    218 {
    219   if (className == NULL)
    220     return;
    221   if (likely(ShellCommandClass::commandClassList != NULL))
    222   {
    223     tIterator<ShellCommandClass>* itCL = ShellCommandClass::commandClassList->getIterator();
    224     ShellCommandClass* elemCL = itCL->firstElement();
    225     while(elemCL != NULL)
    226     {
    227       if (elemCL->className && !strcasecmp(className, elemCL->className))
    228       {
    229         PRINT(0)("Class:'%s' registered %d commands: \n", elemCL->className, elemCL->commandList->getSize());
    230         tIterator<ShellCommandBase>* iterator = elemCL->commandList->getIterator();
    231         const ShellCommandBase* elem = iterator->firstElement();
    232         while(elem != NULL)
    233         {
    234           PRINT(0)("  command:'%s' : params:%d: ", elem->getName(), elem->paramCount);
    235           for (unsigned int i = 0; i< elem->paramCount; i++)
    236             PRINT(0)("%s ", ShellCommandBase::paramToString(elem->parameters[i]));
    237           if (elem->description != NULL)
    238             PRINT(0)("- %s", elem->description);
    239           PRINT(0)("\n");
    240           elem = iterator->nextElement();
    241         }
    242         delete iterator;
    243 
    244         delete itCL;
    245         return;
    246       }
    247       elemCL = itCL->nextElement();
    248     }
    249     delete itCL;
    250     PRINTF(3)("Class %s not found in Command's classes\n", className);
    251   }
    252   else
    253   {
    254     PRINTF(1)("List of commandClasses does not exist");
    255   }
    256 }
    257 
    258 tList<ShellCommandClass>* ShellCommandClass::commandClassList = NULL;
    259 tList<ShellCommandAlias>* ShellCommandClass::aliasList = NULL;
    260 
    261 
    262 
    263 
    264 
    265 
    266 
    267 
    268 
    269 
    27031////////////////////////
    27132// SHELL COMMAND BASE //
     
    27738 * @param paramCount the count of parameters this command takes
    27839 */
    279 ShellCommandBase::ShellCommandBase(const char* commandName, const char* className, unsigned int paramCount, ...)
     40Executor::Executor(const char* commandName, const char* className, unsigned int paramCount, ...)
    28041{
    281   this->setClassID(CL_SHELL_COMMAND, "ShellCommand");
     42  this->setClassID(CL_EXECUTOR, "Executor");
    28243  this->setName(commandName);
    283   this->description = NULL;
    284   this->alias = NULL;
    28544
    28645//  this->classID = classID;
    287   this->shellClass = ShellCommandClass::getCommandClass(className); //ClassList::IDToString(classID);
    288   if (this->shellClass != NULL)
    289     this->shellClass->commandList->add(this);
    29046  // handling parameters, and storing them:
    29147  if (paramCount > FUNCTOR_MAX_ARGUMENTS)
     
    30460
    30561/**
    306  * deconstructs a ShellCommand
     62 * deconstructs a Executor
    30763 */
    308 ShellCommandBase::~ShellCommandBase()
     64Executor::~Executor()
    30965{
    31066  delete[] this->parameters;
    31167  delete[] this->defaultValue;
    312   if (this->alias != NULL && ShellCommandClass::aliasList != NULL)
    313   {
    314     ShellCommandClass::aliasList->remove(this->alias);
    315     delete this->alias;
    316   }
    317 }
    318 
    319 /**
    320  * unregister an existing commandName
    321  * @param className the name of the Class the command belongs to.
    322  * @param commandName the name of the command itself
    323  */
    324 void ShellCommandBase::unregisterCommand(const char* commandName, const char* className)
    325 {
    326   if (ShellCommandClass::commandClassList == NULL)
    327     ShellCommandClass::initCommandClassList();
    328 
    329  const ShellCommandClass* checkClass = ShellCommandClass::isRegistered(className);
    330 
    331  if (checkClass != NULL)
    332   {
    333     tIterator<ShellCommandBase>* iterator = checkClass->commandList->getIterator();
    334     ShellCommandBase* elem = iterator->firstElement();
    335     while(elem != NULL)
    336     {
    337       if (!strcmp(commandName, elem->getName()))
    338       {
    339         checkClass->commandList->remove(elem);
    340         delete elem;
    341         break;
    342       }
    343       elem = iterator->nextElement();
    344     }
    345     delete iterator;
    346 
    347     if (checkClass->commandList->getSize() == 0)
    348     {
    349       ShellCommandClass::commandClassList->remove(checkClass);
    350       delete checkClass;
    351     }
    352   }
    353 }
    354 
    355 /**
    356  * checks if a command has already been registered.
    357  * @param commandName the name of the Command
    358  * @param className the name of the Class the command should apply to.
    359  * @param paramCount how many arguments the Command takes
    360  * @returns true, if the command is registered/false otherwise
    361  *
    362  * This is used internally, to see, if we have multiple command subscriptions.
    363  * This is checked in the registerCommand-function.
    364  */
    365 bool ShellCommandBase::isRegistered(const char* commandName, const char* className, unsigned int paramCount, ...)
    366 {
    367   if (ShellCommandClass::commandClassList == NULL)
    368   {
    369     ShellCommandClass::initCommandClassList();
    370     return false;
    371   }
    372 
    373   const ShellCommandClass* checkClass = ShellCommandClass::isRegistered(className);
    374   if (checkClass != NULL)
    375   {
    376     tIterator<ShellCommandBase>* iterator = checkClass->commandList->getIterator();
    377     ShellCommandBase* elem = iterator->firstElement();
    378     while(elem != NULL)
    379    {
    380      if (!strcmp(commandName, elem->getName()))
    381      {
    382        PRINTF(2)("Command already registered\n");
    383        delete iterator;
    384        return true;
    385       }
    386      elem = iterator->nextElement();
    387    }
    388    delete iterator;
    389    return false;
    390   }
    391   else
    392     return false;
    393 }
    394 
    395 
    396 /**
    397  * executes commands
    398  * @param executionString the string containing the following input
    399  * ClassName [ObjectName] functionName [parameter1[,parameter2[,...]]]
    400  * @return true on success, false otherwise.
    401  */
    402 bool ShellCommandBase::execute(const char* executionString)
    403 {
    404   if (ShellCommandClass::commandClassList == NULL)
    405     return false;
    406 
    407   long classID = CL_NULL;                 //< the classID retrieved from the Class.
    408   ShellCommandClass* commandClass = NULL; //< the command class this command applies to.
    409   tList<BaseObject>* objectList = NULL;   //< the list of Objects stored in classID
    410   BaseObject* objectPointer = NULL;       //< a pointer to th Object to Execute the command on
    411   bool emptyComplete = false;             //< if the completion input is empty string. e.g ""
    412   unsigned int fktPos = 1;                //< the position of the function (needed for finding it)
    413 //  long completeType = SHELLC_NONE;      //< the Type we'd like to complete.
    414   SubString inputSplits(executionString, true);
    415 
    416   if (inputSplits.getCount() == 0)
    417     return false;
    418   if (inputSplits.getCount() >= 1)
    419   {
    420     // CHECK FOR ALIAS
    421     if (ShellCommandClass::aliasList != NULL)
    422     {
    423       tIterator<ShellCommandAlias>* itAL = ShellCommandClass::aliasList->getIterator();
    424       ShellCommandAlias* elemAL = itAL->firstElement();
    425       while(elemAL != NULL)
    426       {
    427         if (elemAL->getName() != NULL && !strcmp(elemAL->getName(), inputSplits.getString(0)) && elemAL->getCommand() != NULL &&
    428             elemAL->getCommand()->shellClass != NULL )
    429         {
    430           objectList = ClassList::getList(elemAL->getCommand()->shellClass->getName());
    431           if (objectList != NULL)
    432           {
    433             if (inputSplits.getCount() > 1)
    434               elemAL->getCommand()->executeCommand(objectList->firstElement(), executionString+inputSplits.getOffset(1));
    435             else
    436               elemAL->getCommand()->executeCommand(objectList->firstElement(), "");
    437             delete itAL;
    438             return true;
    439           }
    440         }
    441         elemAL = itAL->nextElement();
    442       }
    443       delete itAL;
    444     }
    445     // looking for a Matching Class
    446     if (likely(ShellCommandClass::commandClassList != NULL))
    447     {
    448       tIterator<ShellCommandClass>* itCL = ShellCommandClass::commandClassList->getIterator();
    449       ShellCommandClass* elemCL = itCL->firstElement();
    450       while(elemCL != NULL)
    451       {
    452         if (elemCL->getName() && !strcasecmp(inputSplits.getString(0), elemCL->getName()))
    453         {
    454           //elemCL->getName();
    455           classID = ClassList::StringToID(elemCL->getName());
    456           commandClass = elemCL;
    457           objectList = ClassList::getList(classID);
    458           break;
    459         }
    460         elemCL = itCL->nextElement();
    461       }
    462       delete itCL;
    463     }
    464 
    465     if (commandClass != NULL && inputSplits.getCount() >= 2)
    466     {
    467       if (objectList != NULL)
    468       {
    469         // Checking for a Match in the Objects of classID (else take the first)
    470         tIterator<BaseObject>* itBO = objectList->getIterator();
    471         BaseObject* enumBO = itBO->firstElement();
    472         while(enumBO)
    473         {
    474           if (enumBO->getName() != NULL && !strcasecmp(enumBO->getName(), inputSplits.getString(1)))
    475           {
    476             objectPointer = enumBO;
    477             fktPos = 2;
    478             break;
    479           }
    480           enumBO = itBO->nextElement();
    481          }
    482          delete itBO;
    483 
    484       //
    485         if (objectPointer == NULL)
    486           objectPointer = objectList->firstElement();
    487       }
    488       // match a function.
    489       if (commandClass != NULL && (fktPos == 1 || (fktPos == 2 && inputSplits.getCount() >= 3)))
    490       {
    491         tIterator<ShellCommandBase>* itCMD = commandClass->commandList->getIterator();
    492         ShellCommandBase* enumCMD = itCMD->firstElement();
    493         while (enumCMD != NULL)
    494         {
    495           if (!strcmp(enumCMD->getName(), inputSplits.getString(fktPos)))
    496           {
    497             if (objectPointer == NULL && enumCMD->functorType == ShellCommand_Objective)
    498             {
    499               delete itCMD;
    500               return false;
    501             }
    502             if (inputSplits.getCount() > fktPos+1)
    503               enumCMD->executeCommand(objectPointer, executionString+inputSplits.getOffset(fktPos +1));
    504             else
    505               enumCMD->executeCommand(objectPointer, "");
    506             delete itCMD;
    507             return true;
    508           }
    509 
    510           enumCMD = itCMD->nextElement();
    511         }
    512         delete itCMD;
    513       }
    514     }
    515   }
    51668}
    51769
     
    52072 * @param description the description of the Given command
    52173 */
    522 ShellCommandBase* ShellCommandBase::describe(const char* description)
     74Executor* Executor::describe(const char* description)
    52375{
    52476  if (this == NULL)
     
    53284
    53385/**
    534  * adds an Alias to this Command
    535  * @param alias the name of the Alias to set
    536  * @returns itself
    537  */
    538 ShellCommandBase* ShellCommandBase::setAlias(const char* alias)
    539 {
    540   if (this == NULL)
    541     return NULL;
    542 
    543   if (this->alias != NULL)
    544   {
    545     PRINTF(2)("not more than one Alias allowed for functions (%s::%s)\n", this->getName(), this->shellClass->getName());
    546   }
    547   else
    548   {
    549     if (ShellCommandClass::aliasList == NULL)
    550       ShellCommandClass::aliasList = new tList<ShellCommandAlias>;
    551 
    552     ShellCommandAlias* aliasCMD = new ShellCommandAlias(alias, this);
    553     ShellCommandClass::aliasList->add(aliasCMD);
    554     this->alias = aliasCMD;
    555   }
    556   return this;
    557 }
    558 
    559 /**
    56086 * sets default Values of the Commands
    56187 * @param count how many default Values to set.
     
    56692 * count, [EXACTLY THE SAME AS IF YOU WOULD CALL THE FUNCTION UP TO count ARGUMENTS]
    56793 */
    568 ShellCommandBase* ShellCommandBase::defaultValues(unsigned int count, ...)
     94Executor* Executor::defaultValues(unsigned int count, ...)
    56995{
    57096  if (this == NULL)
     
    613139
    614140/**
    615  * prints out nice information about the Shells Commands
     141 * prints out nice information about the Executor
    616142 */
    617 void ShellCommandBase::debug()
     143void Executor::debug()
    618144{
    619   if (ShellCommandClass::commandClassList == NULL)
    620   {
    621     PRINT(0)("No Command registered.\n");
    622     return;
    623   }
    624 
    625   tIterator<ShellCommandClass>* iteratorCL = ShellCommandClass::commandClassList->getIterator();
    626   ShellCommandClass* elemCL = iteratorCL->firstElement();
     145/*  tIterator<ExecutorClass>* iteratorCL = ExecutorClass::commandClassList->getIterator();
     146  ExecutorClass* elemCL = iteratorCL->firstElement();
    627147  while(elemCL != NULL)
    628148  {
    629149    PRINT(0)("Class:'%s' registered %d commands: \n", elemCL->className, elemCL->commandList->getSize());
    630     tIterator<ShellCommandBase>* iterator = elemCL->commandList->getIterator();
    631     const ShellCommandBase* elem = iterator->firstElement();
     150    tIterator<Executor>* iterator = elemCL->commandList->getIterator();
     151    const Executor* elem = iterator->firstElement();
    632152    while(elem != NULL)
    633153    {
    634154      PRINT(0)("  command:'%s' : params:%d: ", elem->getName(), elem->paramCount);
    635155      for (unsigned int i = 0; i< elem->paramCount; i++)
    636        printf("%s ", ShellCommandBase::paramToString(elem->parameters[i]));
     156       printf("%s ", Executor::paramToString(elem->parameters[i]));
    637157      if (elem->description != NULL)
    638158       printf("- %s", elem->description);
     
    644164    elemCL = iteratorCL->nextElement();
    645165  }
    646   delete iteratorCL;
     166  delete iteratorCL;*/
    647167}
    648 
    649 /**
    650  * converts a Parameter to a String
    651  * @param parameter the Parameter we have.
    652  * @returns the Name of the Parameter at Hand
    653  */
    654 const char* ShellCommandBase::paramToString(long parameter)
    655 {
    656   switch (parameter)
    657   {
    658     case ParameterBool:
    659       return "BOOL";
    660       break;
    661     case ParameterChar:
    662       return "CHAR";
    663       break;
    664     case ParameterString:
    665       return "STRING";
    666       break;
    667     case ParameterInt:
    668       return "INT";
    669       break;
    670     case ParameterUInt:
    671       return "UINT";
    672       break;
    673     case ParameterFloat:
    674       return "FLOAT";
    675       break;
    676     case ParameterLong:
    677       return "LONG";
    678       break;
    679     default:
    680       return "NULL";
    681       break;
    682   }
    683 }
  • trunk/src/lib/util/executor/executor.h

    r5628 r5632  
    11/*!
    2  * @file shell_command.h
     2 * @file executor.h
    33 * Definition of a on-screen-shell
    44 */
    55
    6 #ifndef _SHELL_COMMAND_H
    7 #define _SHELL_COMMAND_H
     6#ifndef _EXECUTOR_H
     7#define _EXECUTOR_H
    88
    99#include "base_object.h"
     
    1616#include <stdarg.h>
    1717
    18 #define     SHELL_COMMAND_MAX_SIZE      //!< The maximum size of a Shell Command
    19 
    20 
    21 
    2218// FORWARD DECLARATION
    2319template<class T> class tList;
    2420
    25 /**
    26  * an easy to use Macro to create a Command
    27  * @param command the name of the command (without "" around the string)
    28  * @param class the name of the class to apply this command to (without the "" around the string)
    29  * @param function the function to call
    30  *
    31  * MEANING:
    32  *  ShellCommandBase* someUniqueVarName =
    33  *       ShellCommand<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall);
    34  *
    35  * In the Shell you would call this Command using:
    36  * $ ClassName [ObjectName] commandNameInShell [parameters]
    37  */
    38 #define SHELL_COMMAND(command, class, function) \
    39         ShellCommandBase* shell_command_##class##_##command = ShellCommand<class>::registerCommand(#command, #class, &class::function)
    40 /**
    41  * an easy to use Macro to create a Command
    42  * @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 call
    45  *
    46  * MEANING:
    47  *  ShellCommandBase* 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  */
    53 #define SHELL_COMMAND_STATIC(command, class, function) \
    54                          ShellCommandBase* shell_command_##class##_##command = ShellCommandStatic<class>::registerCommand(#command, #class, function)
    55 
    56 
    5721//! an enumerator for the definition of the Type.
    5822typedef enum {
    59   ShellCommand_Objective = 1,
    60   ShellCommand_Static    = 2,
    61 } ShellCommand_Type;
     23  Executor_Objective  = 1,
     24  Executor_Static    = 2,
     25} Executor_Type;
    6226
    6327////////////////
    6428// BASE CLASS //
    6529////////////////
    66 class ShellCommandBase;
    67 class ShellCommandAlias;
    68 
    69 //! A class to hold all Classes that have (once) registered Commands.
    70 class ShellCommandClass : public BaseObject
     30//! a baseClass for all possible Executors
     31class Executor: public BaseObject
    7132{
    72   friend class ShellCommandBase;
    73 
    74   public:
    75     /** @returns the CommandClassList */
    76     static const tList<ShellCommandClass>* getCommandClassList() { return ShellCommandClass::commandClassList; };
    77     static bool getCommandListOfClass(const char* className, tList<const char>* stringList);
    78     static bool getCommandListOfAlias(tList<const char>* aliasList);
    79 
    80     static ShellCommandClass* getCommandClass(const char* className);
    81     static void unregisterAllCommands();
    82 
    83     static void help (const char* className);
    84 
    85   private:
    86     ShellCommandClass(const char* className);
    87     ~ShellCommandClass();
    88 
    89     static const ShellCommandClass* isRegistered(const char* className);
    90     static void initCommandClassList();
    91 
    92   private:
    93     const char*                      className;                 //!< The Name of the Class. This should match the ClassName of the Commands Class.
    94     long                             classID;                   //!< The classID of this Class
    95     tList<ShellCommandBase>*         commandList;               //!< A list of Commands from this Class
    96     static tList<ShellCommandClass>* commandClassList;          //!< A list of Classes
    97     static tList<ShellCommandAlias>* aliasList;                 //!< An Alias to A Command. (only for classes with one Instance)
    98 };
    99 
    100 
    101 //! a baseClass for all possible ShellCommands
    102 class ShellCommandBase : public BaseObject
    103 {
    104   friend class ShellCommandClass;
    10533  public:
    10634    static bool execute (const char* executionString);
    10735
    108     ShellCommandBase* describe(const char* description);
    109     ShellCommandBase* setAlias(const char* alias);
    110     ShellCommandBase* defaultValues(unsigned int count, ...);
     36    Executor* describe(const char* description);
     37    Executor* defaultValues(unsigned int count, ...);
    11138
    11239    /** @returns the CommandList of the Shell */
     
    11643
    11744  protected:
    118     ShellCommandBase(const char* commandName, const char* className, unsigned int paramCount, ...);
    119     ~ShellCommandBase();
     45    Executor(const char* commandName, const char* className, unsigned int paramCount, ...);
     46    ~Executor();
    12047
    12148    /** @returns the Type of this Function (either static or objective) */
    122     inline ShellCommand_Type getType() { return this->functorType; };
     49    inline Executor_Type getType() { return this->functorType; };
    12350
    12451    static bool isRegistered(const char* commandName, const char* className, unsigned int paramCount, ...);
     
    13057
    13158  protected:
    132     ShellCommand_Type                functorType;                          //!< The type of Function we've got (either static or objective).
     59    Executor_Type                    functorType;                          //!< The type of Function we've got (either static or objective).
    13360    void*                            functionPointer;                      //!< The pointeer to the function of the Class (or static pointer if ClassID == CL_NULL )
    13461    unsigned int                     paramCount;                           //!< the count of parameters.
     
    13764
    13865  private:
    139     ShellCommandClass*               shellClass;                           //!< A Pointer to the Shell-Class this Command belongs to.
    140     ShellCommandAlias*               alias;                                //!< An Alias for the Class.
    141 
    14266    const char*                      description;                          //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla");
    14367};
     
    16589// COMMAND REGISTRATION //
    16690//////////////////////////
    167 // SHELLCOMMAND can be redefined as ShellCommand or ShellCommandStatic
    168 // SHELLCOMMANDEXECUTER can be redefined too.
    169 // SHELLCOMMANDINCLASS
    170 // SHELLCOMMANDTYPE
     91// EXECUTOR can be redefined as Executor or ExecutorStatic
     92// EXECUTOREXECUTER can be redefined too.
     93// EXECUTORINCLASS
     94// EXECUTORTYPE
    17195//! registers a command without any parameters
    172 #define ShellCommandRegister0() \
    173   static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)()) \
     96#define ExecutorRegister0() \
     97  static EXECUTOR<T>* registerCommand(const char* commandName, const char* className, void EXECUTORINCLASS(*function)()) \
    17498  { \
    17599    if (isRegistered(commandName, className, 0)== true) \
    176100      return NULL; \
    177     return new SHELLCOMMAND<T>(commandName, className, function); \
     101    return new EXECUTOR<T>(commandName, className, function); \
    178102  }
    179103
    180104//! registers a command with 1 parameter
    181 #define ShellCommandRegister1(t1) \
    182   static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE)) \
     105#define ExecutorRegister1(t1) \
     106  static EXECUTOR<T>* registerCommand(const char* commandName, const char* className, void EXECUTORINCLASS(*function)(t1##_TYPE)) \
    183107  { \
    184108    if (isRegistered(commandName, className, 1, t1##_PARAM)== true) \
    185109      return NULL; \
    186     return new SHELLCOMMAND<T>(commandName, className, function); \
     110    return new EXECUTOR<T>(commandName, className, function); \
    187111  }
    188112
    189113//! registers a command with 2 parameters
    190 #define ShellCommandRegister2(t1,t2) \
    191   static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE)) \
     114#define ExecutorRegister2(t1,t2) \
     115  static EXECUTOR<T>* registerCommand(const char* commandName, const char* className, void EXECUTORINCLASS(*function)(t1##_TYPE, t2##_TYPE)) \
    192116  { \
    193117    if (isRegistered(commandName, className, 2, t1##_PARAM, t2##_PARAM)== true) \
    194118      return NULL; \
    195     return new SHELLCOMMAND<T>(commandName, className, function); \
     119    return new EXECUTOR<T>(commandName, className, function); \
    196120  }
    197121
    198122//! registers a command with 3 parameters
    199 #define ShellCommandRegister3(t1,t2,t3) \
    200   static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE)) \
     123#define ExecutorRegister3(t1,t2,t3) \
     124  static EXECUTOR<T>* registerCommand(const char* commandName, const char* className, void EXECUTORINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE)) \
    201125  { \
    202126    if (isRegistered(commandName, className, 3, t1##_PARAM, t2##_PARAM, t3##_PARAM)== true) \
    203127      return NULL; \
    204     return new SHELLCOMMAND<T>(commandName, className, function); \
     128    return new EXECUTOR<T>(commandName, className, function); \
    205129  }
    206130
    207131//! registers a command with 4 parameters
    208 #define ShellCommandRegister4(t1,t2,t3,t4) \
    209   static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE)) \
     132#define ExecutorRegister4(t1,t2,t3,t4) \
     133  static EXECUTOR<T>* registerCommand(const char* commandName, const char* className, void EXECUTORINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE)) \
    210134  { \
    211135    if (isRegistered(commandName, className, 4, t1##_PARAM, t2##_PARAM, t3##_PARAM, t4##_PARAM)== true) \
    212136      return NULL; \
    213     return new SHELLCOMMAND<T>(commandName, className, function); \
     137    return new EXECUTOR<T>(commandName, className, function); \
    214138  }
    215139
    216140//! registers a command with 5 parameters
    217 #define ShellCommandRegister5(t1,t2,t3,t4,t5) \
    218   static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE)) \
     141#define ExecutorRegister5(t1,t2,t3,t4,t5) \
     142  static EXECUTOR<T>* registerCommand(const char* commandName, const char* className, void EXECUTORINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE)) \
    219143  { \
    220144    if (isRegistered(commandName, className, 5, t1##_PARAM, t2##_PARAM, t3##_PARAM, t4##_PARAM, t5##_PARAM)== true) \
    221145      return NULL; \
    222     return new ShellCommand<T>(commandName, className, function); \
     146    return new EXECUTOR<T>(commandName, className, function); \
    223147  }
    224148
     
    226150// FUNCTION POINTERS //
    227151///////////////////////
    228 #define ShellCommandFunctionPoiter0() \
    229   void SHELLCOMMANDINCLASS(*functionPointer_0)();
    230 
    231 #define ShellCommandFunctionPoiter1(t1) \
    232   void SHELLCOMMANDINCLASS(*functionPointer_1_##t1)(t1##_TYPE);
    233 
    234 #define ShellCommandFunctionPoiter2(t1, t2) \
    235   void SHELLCOMMANDINCLASS(*functionPointer_2_##t1##_##t2)(t1##_TYPE, t2##_TYPE);
    236 
    237 
    238 #define ShellCommandFunctionPoiter3(t1, t2, t3) \
    239   void SHELLCOMMANDINCLASS(*functionPointer_3_##t1##_##t2##_##t3)(t1##_TYPE, t2##_TYPE, t3##_TYPE);
    240 
    241 #define ShellCommandFunctionPoiter4(t1, t2, t3, t4) \
    242   void SHELLCOMMANDINCLASS(*functionPointer_4_##t1##_##t2##_##t3##_##t4)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE);
    243 
    244 
    245 #define ShellCommandFunctionPoiter5(t1, t2, t3, t4, t5) \
    246   void SHELLCOMMANDINCLASS(*functionPointer_5_##t1##_##t2##_##t3##_##t4##_##t5)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE); \
     152#define ExecutorFunctionPoiter0() \
     153  void EXECUTORINCLASS(*functionPointer_0)();
     154
     155#define ExecutorFunctionPoiter1(t1) \
     156  void EXECUTORINCLASS(*functionPointer_1_##t1)(t1##_TYPE);
     157
     158#define ExecutorFunctionPoiter2(t1, t2) \
     159  void EXECUTORINCLASS(*functionPointer_2_##t1##_##t2)(t1##_TYPE, t2##_TYPE);
     160
     161
     162#define ExecutorFunctionPoiter3(t1, t2, t3) \
     163  void EXECUTORINCLASS(*functionPointer_3_##t1##_##t2##_##t3)(t1##_TYPE, t2##_TYPE, t3##_TYPE);
     164
     165#define ExecutorFunctionPoiter4(t1, t2, t3, t4) \
     166  void EXECUTORINCLASS(*functionPointer_4_##t1##_##t2##_##t3##_##t4)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE);
     167
     168
     169#define ExecutorFunctionPoiter5(t1, t2, t3, t4, t5) \
     170  void EXECUTORINCLASS(*functionPointer_5_##t1##_##t2##_##t3##_##t4##_##t5)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE); \
    247171
    248172
     
    251175/////////////////
    252176//! creates a command that takes no parameters
    253 #define ShellCommandConstructor0() \
    254   SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)()) \
    255   : ShellCommandBase(commandName, className, 0) \
    256   { \
    257     this->functorType = SHELLCOMMANDTYPE; \
     177#define ExecutorConstructor0() \
     178  EXECUTOR(const char* commandName, const char* className, void EXECUTORINCLASS(*function)()) \
     179  : Executor(commandName, className, 0) \
     180  { \
     181    this->functorType = EXECUTORTYPE; \
    258182    this->fp.functionPointer_0 = function; \
    259183  }
    260184
    261185//! creates a command that takes one parameter
    262 #define ShellCommandConstructor1(t1) \
    263   SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE)) \
    264   : ShellCommandBase(commandName, className, 1, t1##_PARAM) \
    265   { \
    266     this->functorType = SHELLCOMMANDTYPE; \
     186#define ExecutorConstructor1(t1) \
     187  EXECUTOR(const char* commandName, const char* className, void EXECUTORINCLASS(*function)(t1##_TYPE)) \
     188  : Executor(commandName, className, 1, t1##_PARAM) \
     189  { \
     190    this->functorType = EXECUTORTYPE; \
    267191    this->fp.functionPointer_1_##t1 = function; \
    268192  }
    269193
    270194//! creates a command that takes two parameters
    271 #define ShellCommandConstructor2(t1,t2) \
    272   SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE)) \
    273   : ShellCommandBase(commandName, className, 2, t1##_PARAM, t2##_PARAM) \
    274   { \
    275     this->functorType = SHELLCOMMANDTYPE; \
     195#define ExecutorConstructor2(t1,t2) \
     196  EXECUTOR(const char* commandName, const char* className, void EXECUTORINCLASS(*function)(t1##_TYPE, t2##_TYPE)) \
     197  : Executor(commandName, className, 2, t1##_PARAM, t2##_PARAM) \
     198  { \
     199    this->functorType = EXECUTORTYPE; \
    276200    this->fp.functionPointer_2_##t1##_##t2 = function; \
    277201  }
    278202
    279203//! creates a command that takes three parameter
    280 #define ShellCommandConstructor3(t1,t2,t3) \
    281   SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE)) \
    282   : ShellCommandBase(commandName, className, 3, t1##_PARAM, t2##_PARAM, t3##_PARAM) \
    283   { \
    284     this->functorType = SHELLCOMMANDTYPE; \
     204#define ExecutorConstructor3(t1,t2,t3) \
     205  EXECUTOR(const char* commandName, const char* className, void EXECUTORINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE)) \
     206  : Executor(commandName, className, 3, t1##_PARAM, t2##_PARAM, t3##_PARAM) \
     207  { \
     208    this->functorType = EXECUTORTYPE; \
    285209    this->fp.functionPointer_3_##t1##_##t2##_##t3 = function; \
    286210  }
    287211
    288212//! creates a command that takes four parameter
    289 #define ShellCommandConstructor4(t1,t2,t3,t4) \
    290   SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE)) \
    291   : ShellCommandBase(commandName, className, 4, t1##_PARAM, t2##_PARAM, t3##_PARAM, t4##_PARAM) \
    292   { \
    293     this->functorType = SHELLCOMMANDTYPE; \
     213#define ExecutorConstructor4(t1,t2,t3,t4) \
     214  EXECUTOR(const char* commandName, const char* className, void EXECUTORINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE)) \
     215  : Executor(commandName, className, 4, t1##_PARAM, t2##_PARAM, t3##_PARAM, t4##_PARAM) \
     216  { \
     217    this->functorType = EXECUTORTYPE; \
    294218    this->fp.functionPointer_4_##t1##_##t2##_##t3##_##t4 = function; \
    295219  }
    296220
    297221//! creates a command that takes five parameter
    298 #define ShellCommandConstructor5(t1,t2,t3,t4,t5) \
    299   SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE)) \
    300   : ShellCommandBase(commandName, className, 5, t1##_PARAM, t2##_PARAM, t3##_PARAM, t4##_PARAM, t5##_PARAM) \
    301   { \
    302     this->functorType = SHELLCOMMANDTYPE; \
     222#define ExecutorConstructor5(t1,t2,t3,t4,t5) \
     223  EXECUTOR(const char* commandName, const char* className, void EXECUTORINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE)) \
     224  : Executor(commandName, className, 5, t1##_PARAM, t2##_PARAM, t3##_PARAM, t4##_PARAM, t5##_PARAM) \
     225  { \
     226    this->functorType = EXECUTORTYPE; \
    303227    this->fp.functionPointer_5_##t1##_##t2##_##t3##_##t4##_##t5 = function; \
    304228  }
     
    308232///////////////
    309233//! execute-macro for functions with no parameters
    310 #define ShellCommandExecute0() \
     234#define ExecutorExecute0() \
    311235  if (this->paramCount == 0) \
    312     SHELLCOMMANDEXECUTER(_0)()
     236    EXECUTOREXECUTER(_0)()
    313237
    314238//! execute-macro for functions with one parameter
    315 #define ShellCommandExecute1(t1) \
     239#define ExecutorExecute1(t1) \
    316240   else if (this->paramCount == 1 && this->parameters[0] == t1##_PARAM) \
    317     SHELLCOMMANDEXECUTER(_1_##t1)(t1##_FUNC(parameters, t1##_DEFGRAB(0)))
     241    EXECUTOREXECUTER(_1_##t1)(t1##_FUNC(parameters, t1##_DEFGRAB(0)))
    318242
    319243//! execute-macro for functions with two parameters
    320 #define ShellCommandExecute2(t1,t2) \
     244#define ExecutorExecute2(t1,t2) \
    321245   else if (this->paramCount == 2 && this->parameters[0] == t1##_PARAM && this->parameters[1] == t2##_PARAM) \
    322     SHELLCOMMANDEXECUTER(_2_##t1##_##t2)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)))
     246    EXECUTOREXECUTER(_2_##t1##_##t2)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)))
    323247
    324248//! execute-macro for functions with three parameters
    325 #define ShellCommandExecute3(t1,t2,t3) \
     249#define ExecutorExecute3(t1,t2,t3) \
    326250   else if (this->paramCount == 3 && this->parameters[0] == t1##_PARAM && this->parameters[1] == t2##_PARAM && this->parameters[2] == t3##_PARAM) \
    327     SHELLCOMMANDEXECUTER(_3_##t1##_##t2##_##t3)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)))
     251    EXECUTOREXECUTER(_3_##t1##_##t2##_##t3)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)))
    328252
    329253//! execute-macro for functions with four parameters
    330 #define ShellCommandExecute4(t1,t2,t3,t4) \
     254#define ExecutorExecute4(t1,t2,t3,t4) \
    331255   else if (this->paramCount == 4 && this->parameters[0] == t1##_PARAM && this->parameters[1] == t2##_PARAM && this->parameters[2] == t3##_PARAM && this->parameters[3] == t4##_PARAM) \
    332     SHELLCOMMANDEXECUTER(_4_##t1##_##t2##_##t3##_##t4)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)), t4##_FUNC(sub.getString(3), t4##_DEFGRAB(3)))
     256    EXECUTOREXECUTER(_4_##t1##_##t2##_##t3##_##t4)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)), t4##_FUNC(sub.getString(3), t4##_DEFGRAB(3)))
    333257
    334258//! execute-macro for functions with five parameters
    335 #define ShellCommandExecute5(t1,t2,t3,t4,t5) \
     259#define ExecutorExecute5(t1,t2,t3,t4,t5) \
    336260   else if (this->paramCount == 5 && this->parameters[0] == t1##_PARAM && this->parameters[1] == t2##_PARAM && this->parameters[2] == t3##_PARAM && this->parameters[3] == t4##_PARAM && this->parameters[4] == t5##_PARAM) \
    337     SHELLCOMMANDEXECUTER(_5_##t1##_##t2##_##t3##_##t4##_##t5)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)), t4##_FUNC(sub.getString(3), t4##_DEFGRAB(3)), t5##_FUNC(sub.getString(4), t5##_DEFGRAB(4)))
    338 
    339 
    340 //! keeps information about a ShellCommand
    341 template<class T> class ShellCommand : public ShellCommandBase
     261    EXECUTOREXECUTER(_5_##t1##_##t2##_##t3##_##t4##_##t5)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)), t4##_FUNC(sub.getString(3), t4##_DEFGRAB(3)), t5##_FUNC(sub.getString(4), t5##_DEFGRAB(4)))
     262
     263
     264
     265
     266
     267//////////\//////////
     268// DYNAMIC FUNCTOR //
     269///////////\/////////
     270//! keeps information about a Executor
     271template<class T> class ExecutorObjective : public Executor
    342272{
    343273  public:
     
    345275#undef FUNCTOR_LIST
    346276#endif
    347 #ifdef SHELLCOMMAND
    348 #undef SHELLCOMMAND
    349 #endif
    350 #define SHELLCOMMAND                       ShellCommand
    351 #ifdef SHELLCOMMANDEXECUTER
    352 #undef SHELLCOMMANDEXECUTER
    353 #endif
    354 #define SHELLCOMMANDEXECUTER(nameExt)      (dynamic_cast<T*>(object)->*(fp.functionPointer##nameExt))
    355 #ifdef SHELLCOMMANDINCLASS
    356 #undef SHELLCOMMANDINCLASS
    357 #endif
    358 #define SHELLCOMMANDINCLASS(FUNCTION)      (T::FUNCTION)
    359 #ifdef SHELLCOMMANDTYPE
    360 #undef SHELLCOMMANDTYPE
    361 #endif
    362 #define SHELLCOMMANDTYPE                   ShellCommand_Objective
     277#ifdef EXECUTOR
     278#undef EXECUTOR
     279#endif
     280#define EXECUTOR                       ExecutorObjective
     281#ifdef EXECUTOREXECUTER
     282#undef EXECUTOREXECUTER
     283#endif
     284#define EXECUTOREXECUTER(nameExt)      (dynamic_cast<T*>(object)->*(fp.functionPointer##nameExt))
     285#ifdef EXECUTORINCLASS
     286#undef EXECUTORINCLASS
     287#endif
     288#define EXECUTORINCLASS(FUNCTION)      (T::FUNCTION)
     289#ifdef EXECUTORTYPE
     290#undef EXECUTORTYPE
     291#endif
     292#define EXECUTORTYPE                   Executor_Objective
    363293//! FUNCTOR_LIST is the List of command-registerers
    364 #define FUNCTOR_LIST(x) ShellCommandRegister ## x
     294#define FUNCTOR_LIST(x) ExecutorRegister ## x
    365295#include "functor_list.h"
    366296#undef FUNCTOR_LIST
     
    370300//! FUNCTOR_LIST is the List of FunctionPointers
    371301    union FunctionPointers {
    372 #define FUNCTOR_LIST(x) ShellCommandFunctionPoiter ## x
     302#define FUNCTOR_LIST(x) ExecutorFunctionPoiter ## x
    373303#include "functor_list.h"
    374304#undef FUNCTOR_LIST
     
    376306
    377307//! FUNCTOR_LIST is the List of CommandConstructors
    378 #define FUNCTOR_LIST(x) ShellCommandConstructor ## x
     308#define FUNCTOR_LIST(x) ExecutorConstructor ## x
    379309#include "functor_list.h"
    380310#undef FUNCTOR_LIST
     
    384314      SubString sub(parameters, true);
    385315//! FUNCTOR_LIST is the List of Executive Functions
    386 #define FUNCTOR_LIST(x) ShellCommandExecute ## x
     316#define FUNCTOR_LIST(x) ExecutorExecute ## x
    387317#include "functor_list.h"
    388318#undef FUNCTOR_LIST
     
    390320};
    391321
    392 //! keeps information about a ShellCommand, that points to a Static Function
    393 template<class T> class ShellCommandStatic : public ShellCommandBase
     322
     323
     324////////////////////
     325// STATIC FUNCTOR //
     326////////////////////
     327//! keeps information about a Executor, that points to a Static Function
     328template<class T> class ExecutorStatic : public Executor
    394329{
    395330  public:
     
    397332#undef FUNCTOR_LIST
    398333#endif
    399 #ifdef SHELLCOMMAND
    400 #undef SHELLCOMMAND
    401 #endif
    402 #define SHELLCOMMAND                      ShellCommandStatic
    403 #ifdef SHELLCOMMANDEXECUTER
    404 #undef SHELLCOMMANDEXECUTER
    405 #endif
    406 #define SHELLCOMMANDEXECUTER(nameExt)     fp.functionPointer##nameExt
    407 #ifdef SHELLCOMMANDINCLASS
    408 #undef SHELLCOMMANDINCLASS
    409 #endif
    410 #define SHELLCOMMANDINCLASS(FUNCTION)     (FUNCTION)
    411 #ifdef SHELLCOMMANDTYPE
    412 #undef SHELLCOMMANDTYPE
    413 #endif
    414 #define SHELLCOMMANDTYPE                   ShellCommand_Static
     334#ifdef EXECUTOR
     335#undef EXECUTOR
     336#endif
     337#define EXECUTOR                      ExecutorStatic
     338#ifdef EXECUTOREXECUTER
     339#undef EXECUTOREXECUTER
     340#endif
     341#define EXECUTOREXECUTER(nameExt)     fp.functionPointer##nameExt
     342#ifdef EXECUTORINCLASS
     343#undef EXECUTORINCLASS
     344#endif
     345#define EXECUTORINCLASS(FUNCTION)     (FUNCTION)
     346#ifdef EXECUTORTYPE
     347#undef EXECUTORTYPE
     348#endif
     349#define EXECUTORTYPE                   Executor_Static
    415350
    416351//! FUNCTOR_LIST is the List of command-registerers
    417 #define FUNCTOR_LIST(x) ShellCommandRegister ## x
     352#define FUNCTOR_LIST(x) ExecutorRegister ## x
    418353#include "functor_list.h"
    419354#undef FUNCTOR_LIST
     
    422357//! FUNCTOR_LIST is the List of FunctionPointers
    423358    union FunctionPointers {
    424 #define FUNCTOR_LIST(x) ShellCommandFunctionPoiter ## x
     359#define FUNCTOR_LIST(x) ExecutorFunctionPoiter ## x
    425360#include "functor_list.h"
    426361#undef FUNCTOR_LIST
     
    428363
    429364//! FUNCTOR_LIST is the List of CommandConstructors
    430 #define FUNCTOR_LIST(x) ShellCommandConstructor ## x
     365#define FUNCTOR_LIST(x) ExecutorConstructor ## x
    431366#include "functor_list.h"
    432367#undef FUNCTOR_LIST
     
    436371  SubString sub(parameters, true);
    437372//! FUNCTOR_LIST is the List of Executive Functions
    438 #define FUNCTOR_LIST(x) ShellCommandExecute ## x
     373#define FUNCTOR_LIST(x) ExecutorExecute ## x
    439374#include "functor_list.h"
    440375#undef FUNCTOR_LIST
     
    443378
    444379//! A Class, that handles aliases.
    445 class ShellCommandAlias
     380class ExecutorAlias
    446381{
    447   friend class ShellCommandBase;
     382  friend class ExecutorBase;
    448383  public:
    449384    /** @returns the Name of the Alias. */
    450385    const char* getName() const { return this->aliasName; };
    451386    /** @returns the Command, this Alias is asociated with */
    452     ShellCommandBase* getCommand() const { return this->command; };
     387    ExecutorBase* getCommand() const { return this->command; };
    453388
    454389  private:
    455390    /** @param aliasName the name of the Alias @param command the Command, to associate this alias with */
    456     ShellCommandAlias(const char* aliasName, ShellCommandBase* command) { this->aliasName = aliasName; this->command = command; };
     391    ExecutorAlias(const char* aliasName, ExecutorBase* command) { this->aliasName = aliasName; this->command = command; };
    457392
    458393  private:
    459394    const char*         aliasName;       //!< the name of the Alias
    460     ShellCommandBase*   command;         //!< a pointer to the command, this alias executes.
     395    ExecutorBase*       command;         //!< a pointer to the command, this alias executes.
    461396};
    462397
    463 #endif /* _SHELL_COMMAND_H */
     398#endif /* _EXECUTOR_H */
Note: See TracChangeset for help on using the changeset viewer.