Changeset 7394 in orxonox.OLD for trunk/src/lib/shell/shell_command.cc
- Timestamp:
- Apr 27, 2006, 1:33:23 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.cc
r7389 r7394 27 27 namespace OrxShell 28 28 { 29 30 /** 31 * constructs and registers a new Command 29 SHELL_COMMAND_STATIC(debug, ShellCommand, ShellCommand::debug); 30 31 32 /** 33 * @brief constructs and registers a new Command 32 34 * @param commandName the name of the Command 33 35 * @param className the name of the class to apply this command to … … 50 52 51 53 /** 52 * deconstructs a ShellCommand54 * @brief deconstructs a ShellCommand 53 55 */ 54 56 ShellCommand::~ShellCommand() … … 106 108 107 109 /** 108 * checks if a command has already been registered.110 * @brief checks if a command has already been registered. 109 111 * @param commandName the name of the Command 110 112 * @param className the name of the Class the command should apply to. … … 116 118 bool ShellCommand::isRegistered(const std::string& commandName, const std::string& className) 117 119 { 118 if (ShellCommandClass::commandClassList == NULL)119 {120 ShellCommandClass::initCommandClassList();121 return false;122 }123 124 120 const ShellCommandClass* checkClass = ShellCommandClass::isRegistered(className); 125 121 if (checkClass != NULL) … … 142 138 143 139 /** 144 * executes commands140 * @brief executes commands 145 141 * @param executionString the string containing the following input 146 142 * ClassName [ObjectName] functionName [parameter1[,parameter2[,...]]] … … 149 145 bool ShellCommand::execute(const std::string& executionString) 150 146 { 151 if (ShellCommandClass::commandClassList == NULL)152 return false;153 154 147 long classID = CL_NULL; //< the classID retrieved from the Class. 155 148 ShellCommandClass* commandClass = NULL; //< the command class this command applies to. … … 186 179 187 180 // looking for a Matching Class 188 if (likely(ShellCommandClass::commandClassList != NULL)) 189 { 190 std::list<ShellCommandClass*>::iterator commandClassIT; 191 for (commandClassIT = ShellCommandClass::commandClassList->begin(); commandClassIT != ShellCommandClass::commandClassList->end(); commandClassIT++) 192 { 193 if ((*commandClassIT)->getName() && inputSplits[0] == (*commandClassIT)->getName()) 194 { 195 //elemCL->getName(); 196 classID = ClassList::StringToID((*commandClassIT)->getName()); 197 commandClass = (*commandClassIT); 198 objectList = ClassList::getList((ClassID)classID); 199 break; 200 } 181 std::vector<ShellCommandClass*>::iterator commandClassIT; 182 for (commandClassIT = ShellCommandClass::commandClassList.begin(); commandClassIT != ShellCommandClass::commandClassList.end(); commandClassIT++) 183 { 184 if ((*commandClassIT)->getName() && inputSplits[0] == (*commandClassIT)->getName()) 185 { 186 //elemCL->getName(); 187 classID = ClassList::StringToID((*commandClassIT)->getName()); 188 commandClass = (*commandClassIT); 189 objectList = ClassList::getList((ClassID)classID); 190 break; 201 191 } 202 192 } … … 312 302 void ShellCommand::debug() 313 303 { 314 if (ShellCommandClass::commandClassList == NULL) 315 { 316 PRINT(0)("No Command registered.\n"); 317 return; 318 } 319 320 std::list<ShellCommandClass*>::iterator classIT; 321 for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++) 304 std::vector<ShellCommandClass*>::iterator classIT; 305 for (classIT = ShellCommandClass::commandClassList.begin(); classIT != ShellCommandClass::commandClassList.end(); classIT++) 322 306 { 323 307 PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className.c_str(), (*classIT)->commandList.size());
Note: See TracChangeset
for help on using the changeset viewer.