Changeset 5552 in orxonox.OLD for trunk/src/lib/shell/shell_command.h
- Timestamp:
- Nov 12, 2005, 1:40:06 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.h
r5551 r5552 10 10 11 11 #include "helper_functions.h" 12 #include "multi_type.h" 12 13 #include "substring.h" 13 14 #include "functor_list.h" … … 133 134 unsigned int paramCount; //!< the count of parameters. 134 135 unsigned int* parameters; //!< Parameters the function of this Command takes. 135 char* defaultStrings[FUNCTOR_MAX_ARGUMENTS];//!< A list of default Strings stored. 136 int defaultInts[FUNCTOR_MAX_ARGUMENTS]; //!< A list of default Ints stored. 137 float defaultFloats[FUNCTOR_MAX_ARGUMENTS]; //!< A list of default Floats stored. 138 bool defaultBools[FUNCTOR_MAX_ARGUMENTS]; //!< A list of default Bools stored. 139 136 MultiType* defaultValue; //!< Default Values. 140 137 141 138 private: … … 153 150 ///////////////////////////////// 154 151 //! where to chek for default BOOL values 155 #define l_BOOL_DEFGRAB(i) this->default Bools[i]152 #define l_BOOL_DEFGRAB(i) this->defaultValue[i].getBool() 156 153 //! where to chek for default INT values 157 #define l_INT_DEFGRAB(i) this->default Ints[i]154 #define l_INT_DEFGRAB(i) this->defaultValue[i].getInt() 158 155 //! where to chek for default UINT values 159 #define l_UINT_DEFGRAB(i) (unsigned int)this->default Ints[i]156 #define l_UINT_DEFGRAB(i) (unsigned int)this->defaultValue[i].getInt() 160 157 //! where to chek for default LONG values 161 #define l_LONG_DEFGRAB(i) (long)this->default Ints[i]158 #define l_LONG_DEFGRAB(i) (long)this->defaultValue[i].getInt() 162 159 //! where to chek for default FLOAT values 163 #define l_FLOAT_DEFGRAB(i) this->default Floats[i]160 #define l_FLOAT_DEFGRAB(i) this->defaultValue[i].getFloat() 164 161 //! where to chek for default STRING values 165 #define l_STRING_DEFGRAB(i) this->default Strings[i]162 #define l_STRING_DEFGRAB(i) this->defaultValue[i].getString() 166 163 167 164 ////////////////////////// … … 183 180 //! registers a command with 1 parameter 184 181 #define ShellCommandRegister1(t1) \ 185 static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE) , t1##_TYPE d1 = t1##_DEFAULT) \182 static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE)) \ 186 183 { \ 187 184 if (isRegistered(commandName, className, 1, t1##_PARAM)== true) \ 188 185 return NULL; \ 189 return new SHELLCOMMAND<T>(commandName, className, function , d1); \186 return new SHELLCOMMAND<T>(commandName, className, function); \ 190 187 } 191 188 192 189 //! registers a command with 2 parameters 193 190 #define ShellCommandRegister2(t1,t2) \ 194 static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE) , t1##_TYPE d1 = t1##_DEFAULT, t2##_TYPE d2 = t2##_DEFAULT) \191 static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE)) \ 195 192 { \ 196 193 if (isRegistered(commandName, className, 2, t1##_PARAM, t2##_PARAM)== true) \ 197 194 return NULL; \ 198 return new SHELLCOMMAND<T>(commandName, className, function , d1, d2); \195 return new SHELLCOMMAND<T>(commandName, className, function); \ 199 196 } 200 197 201 198 //! registers a command with 3 parameters 202 199 #define ShellCommandRegister3(t1,t2,t3) \ 203 static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE) , t1##_TYPE d1 = t1##_DEFAULT, t2##_TYPE d2 = t2##_DEFAULT, t3##_TYPE d3 = t3##_DEFAULT) \200 static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE)) \ 204 201 { \ 205 202 if (isRegistered(commandName, className, 3, t1##_PARAM, t2##_PARAM, t3##_PARAM)== true) \ 206 203 return NULL; \ 207 return new SHELLCOMMAND<T>(commandName, className, function , d1, d2, d3); \204 return new SHELLCOMMAND<T>(commandName, className, function); \ 208 205 } 209 206 210 207 //! registers a command with 4 parameters 211 208 #define ShellCommandRegister4(t1,t2,t3,t4) \ 212 static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE) , t1##_TYPE d1 = t1##_DEFAULT, t2##_TYPE d2 = t2##_DEFAULT, t3##_TYPE d3 = t3##_DEFAULT, t4##_TYPE d4 = t4##_DEFAULT) \209 static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE)) \ 213 210 { \ 214 211 if (isRegistered(commandName, className, 4, t1##_PARAM, t2##_PARAM, t3##_PARAM, t4##_PARAM)== true) \ 215 212 return NULL; \ 216 return new SHELLCOMMAND<T>(commandName, className, function , d1, d2, d3, d4); \213 return new SHELLCOMMAND<T>(commandName, className, function); \ 217 214 } 218 215 219 216 //! registers a command with 5 parameters 220 217 #define ShellCommandRegister5(t1,t2,t3,t4,t5) \ 221 static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE) , t1##_TYPE d1 = t1##_DEFAULT, t2##_TYPE d2 = t2##_DEFAULT, t3##_TYPE d3 = t3##_DEFAULT, t4##_TYPE d4 = t4##_DEFAULT, t5##_TYPE d5 = t5##_DEFAULT) \218 static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE)) \ 222 219 { \ 223 220 if (isRegistered(commandName, className, 5, t1##_PARAM, t2##_PARAM, t3##_PARAM, t4##_PARAM, t5##_PARAM)== true) \ 224 221 return NULL; \ 225 return new ShellCommand<T>(commandName, className, function , d1, d2, d3, d4, d5); \222 return new ShellCommand<T>(commandName, className, function); \ 226 223 } 227 224 … … 264 261 //! creates a command that takes one parameter 265 262 #define ShellCommandConstructor1(t1) \ 266 SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE) , t1##_TYPE d1) \267 : ShellCommandBase(commandName, className, 1, t1##_PARAM , d1) \263 SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE)) \ 264 : ShellCommandBase(commandName, className, 1, t1##_PARAM) \ 268 265 { \ 269 266 this->functorType = SHELLCOMMANDTYPE; \ … … 273 270 //! creates a command that takes two parameters 274 271 #define ShellCommandConstructor2(t1,t2) \ 275 SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE) , t1##_TYPE d1, t2##_TYPE d2) \276 : ShellCommandBase(commandName, className, 2, t1##_PARAM, d1, t2##_PARAM, d2) \272 SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE)) \ 273 : ShellCommandBase(commandName, className, 2, t1##_PARAM, t2##_PARAM) \ 277 274 { \ 278 275 this->functorType = SHELLCOMMANDTYPE; \ … … 282 279 //! creates a command that takes three parameter 283 280 #define ShellCommandConstructor3(t1,t2,t3) \ 284 SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE) , t1##_TYPE d1, t2##_TYPE d2, t3##_TYPE d3) \285 : ShellCommandBase(commandName, className, 3, t1##_PARAM, d1, t2##_PARAM, d2, t3##_PARAM, d3) \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) \ 286 283 { \ 287 284 this->functorType = SHELLCOMMANDTYPE; \ … … 291 288 //! creates a command that takes four parameter 292 289 #define ShellCommandConstructor4(t1,t2,t3,t4) \ 293 SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE) , t1##_TYPE d1, t2##_TYPE d2, t3##_TYPE d3, t4##_TYPE d4) \294 : ShellCommandBase(commandName, className, 4, t1##_PARAM, d1, t2##_PARAM, d2, t3##_PARAM, d3, t4##_PARAM, d4) \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) \ 295 292 { \ 296 293 this->functorType = SHELLCOMMANDTYPE; \ … … 300 297 //! creates a command that takes five parameter 301 298 #define ShellCommandConstructor5(t1,t2,t3,t4,t5) \ 302 SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE) , t1##_TYPE d1, t2##_TYPE d2, t3##_TYPE d3, t4##_TYPE d4, t5##_TYPE d5) \303 : ShellCommandBase(commandName, className, 5, t1##_PARAM, d1, t2##_PARAM, d2, t3##_PARAM, d3, t4##_PARAM, d4, t5##_PARAM, d5) \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) \ 304 301 { \ 305 302 this->functorType = SHELLCOMMANDTYPE; \
Note: See TracChangeset
for help on using the changeset viewer.