Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5144 in orxonox.OLD for trunk/src/util


Ignore:
Timestamp:
Aug 27, 2005, 12:56:47 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: now it is also possible, to execute Functions on NON-singleton classes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/shell_command.cc

    r5143 r5144  
    146146          commandBegin++;
    147147        if (strncmp (commandBegin, elem->getName(), strlen(elem->getName())))
     148        {
     149          elem = iterator->nextElement();
    148150          continue;
     151        }
     152        // getting singleton-reference
    149153        objectPointer = ClassList::getList(elem->classID)->firstElement();
    150154      }
    151155      else
    152156      {
     157        // checking for the Object
    153158        while(*commandBegin == ' ')
    154159          commandBegin++;
    155160        tIterator<BaseObject>* iterBO = ClassList::getList(elem->classID)->getIterator();
    156161        BaseObject* enumBO = iterBO->firstElement();
     162        while(enumBO != NULL)
    157163        {
    158           if( !strncmp(commandBegin, enumBO->getName(), strlen(enumBO->getName())))
     164          if(!strncmp(commandBegin, enumBO->getName(), strlen(enumBO->getName())))
    159165          {
     166            PRINTF(4)("Object %s matches\n", enumBO->getName());
    160167            objectPointer = enumBO;
    161168            break;
     
    165172        delete iterBO;
    166173
     174        // break on no object Found. We cannot operate on Classes, but on Objects
    167175        if (objectPointer == NULL)
    168176          break;
     
    170178        while(*commandBegin == ' ')
    171179          commandBegin++;
     180        // checking for the requested function.
     181        if (strncmp (commandBegin, elem->getName(), strlen(elem->getName())))
     182        {
     183          elem = iterator->nextElement();
     184          continue;
     185        }
     186        PRINTF(3)("Function '%s' found\n", commandBegin);
    172187      }
    173       const char* commandEnd = strchr(commandBegin, ' ');
    174       if (commandEnd == NULL)
    175         commandEnd = commandBegin + strlen(commandBegin);
     188      const char* paramBegin = strchr(commandBegin, ' ');
     189      if (paramBegin == NULL)
     190        paramBegin = commandBegin + strlen(elem->getName());
    176191
    177192      if (objectPointer != NULL)
    178193      {
    179         elem->executeCommand(objectPointer, commandEnd);
     194        elem->executeCommand(objectPointer, paramBegin);
    180195        delete iterator;
    181196        return true;
Note: See TracChangeset for help on using the changeset viewer.