Changeset 7214 in orxonox.OLD for branches/std/src/lib/util/executor
- Timestamp:
- Mar 10, 2006, 7:18:03 PM (19 years ago)
- Location:
- branches/std/src/lib/util/executor
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/util/executor/executor.h
r7212 r7214 48 48 49 49 /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */ 50 virtual void execute (BaseObject* object, const void* parameters = NULL) = 0;50 virtual void execute (BaseObject* object, const std::string& parameters = "") = 0; 51 51 52 52 /** @returns the Type of this Function (either static or objective) */ … … 192 192 #define ExecutorExecute1(t1) \ 193 193 else if (this->paramCount == 1 && this->defaultValue[0] == t1##_PARAM) \ 194 EXECUTOREXECUTER(_1_##t1)(t1##_FUNC( (const char*)parameters, t1##_DEFGRAB(0)))194 EXECUTOREXECUTER(_1_##t1)(t1##_FUNC(sub[0], t1##_DEFGRAB(0))) 195 195 196 196 //! execute-macro for functions with two parameters 197 197 #define ExecutorExecute2(t1,t2) \ 198 198 else if (this->paramCount == 2 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM) \ 199 EXECUTOREXECUTER(_2_##t1##_##t2)(t1##_FUNC(sub .getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)))199 EXECUTOREXECUTER(_2_##t1##_##t2)(t1##_FUNC(sub[0], t1##_DEFGRAB(0)), t2##_FUNC(sub[1], t2##_DEFGRAB(1))) 200 200 201 201 //! execute-macro for functions with three parameters 202 202 #define ExecutorExecute3(t1,t2,t3) \ 203 203 else if (this->paramCount == 3 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM && this->defaultValue[2] == t3##_PARAM) \ 204 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)))204 EXECUTOREXECUTER(_3_##t1##_##t2##_##t3)(t1##_FUNC(sub[0], t1##_DEFGRAB(0)), t2##_FUNC(sub[1], t2##_DEFGRAB(1)), t3##_FUNC(sub[2], t3##_DEFGRAB(2))) 205 205 206 206 //! execute-macro for functions with four parameters 207 207 #define ExecutorExecute4(t1,t2,t3,t4) \ 208 208 else if (this->paramCount == 4 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM && this->defaultValue[2] == t3##_PARAM && this->defaultValue[3] == t4##_PARAM) \ 209 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))) \209 EXECUTOREXECUTER(_4_##t1##_##t2##_##t3##_##t4)(t1##_FUNC(sub[0], t1##_DEFGRAB(0)), t2##_FUNC(sub[1], t2##_DEFGRAB(1)), t3##_FUNC(sub[2], t3##_DEFGRAB(2)), t4##_FUNC(sub[3], t4##_DEFGRAB(3))) \ 210 210 211 211 … … 213 213 #define ExecutorExecute5(t1,t2,t3,t4,t5) \ 214 214 else if (this->paramCount == 5 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM && this->defaultValue[2] == t3##_PARAM && this->defaultValue[3] == t4##_PARAM && this->defaultValue[4] == t5##_PARAM) \ 215 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)))215 EXECUTOREXECUTER(_5_##t1##_##t2##_##t3##_##t4##_##t5)(t1##_FUNC(sub[0], t1##_DEFGRAB(0)), t2##_FUNC(sub[1], t2##_DEFGRAB(1)), t3##_FUNC(sub[2], t3##_DEFGRAB(2)), t4##_FUNC(sub[3], t4##_DEFGRAB(3)), t5##_FUNC(sub[4], t5##_DEFGRAB(4))) 216 216 217 217 … … 242 242 #define EXECUTORTYPE Executor_Objective 243 243 //! keeps information about a Executor 244 template<class T> class E xecutorObjective: public Executor244 template<class T> class EXECUTOR : public Executor 245 245 { 246 246 public: 247 E xecutorObjective() : Executor() { };247 EXECUTOR() : Executor() { }; 248 248 // COPY constuctor (virtual version) 249 249 virtual Executor* clone () const 250 250 { 251 E xecutorObjective<T>* executor = new ExecutorObjective<T>();251 EXECUTOR<T>* executor = new EXECUTOR<T>(); 252 252 this->cloning(executor); 253 253 executor->fp = this->fp; … … 268 268 } fp; 269 269 270 virtual void execute (BaseObject* object, const void* parameters = NULL)270 virtual void execute (BaseObject* object, const std::string& parameters = "") 271 271 { 272 272 SubString sub; 273 printf("===%s\n", (const char*)parameters);274 if (parameters != NULL)275 sub.split((const char*)parameters, " \n\t,", '\\');273 printf("===%s\n", parameters.c_str()); 274 sub.split(parameters, " \n\t,", '\\'); 275 sub.debug(); 276 276 //! FUNCTOR_LIST is the List of Executive Functions 277 277 #define FUNCTOR_LIST(x) ExecutorExecute ## x … … 309 309 { 310 310 public: 311 E xecutorStatic() : Executor() { };311 EXECUTOR() : Executor() { }; 312 312 // COPY constuctor 313 313 virtual Executor* clone () const 314 314 { 315 E xecutorStatic<T>* executor = new ExecutorStatic<T>();315 EXECUTOR<T>* executor = new EXECUTOR<T>(); 316 316 this->cloning(executor); 317 317 executor->fp = this->fp; … … 333 333 334 334 335 virtual void execute (BaseObject* object, const void* parameters = NULL)335 virtual void execute (BaseObject* object, const std::string& parameters = "") 336 336 { 337 337 SubString sub; 338 if (parameters != NULL) 339 sub.split((const char*)parameters, " \n\t,", '\\'); 338 sub.split(parameters, " \n\t,", '\\'); 340 339 //! FUNCTOR_LIST is the List of Executive Functions 341 340 #define FUNCTOR_LIST(x) ExecutorExecute ## x -
branches/std/src/lib/util/executor/executor_specials.h
r7197 r7214 60 60 * @param loadString ignored in this case 61 61 */ 62 virtual void execute(BaseObject* object, const void* parameters = NULL)62 virtual void execute(BaseObject* object, const std::string& = "") 63 63 { 64 64 if (object != NULL && this->element != NULL) -
branches/std/src/lib/util/executor/functor_list.h
r7203 r7214 74 74 //#define l_VECTOR_DEFAULT Vector(0,0,0) //!< Default value for a VECTOR 75 75 76 #define l_CSTRING_TYPE const char* //!< The type of a STRING77 #define l_CSTRING_FUNC isCString //!< The function to parse a STRING78 #define l_CSTRING_NAME "cstring" //!< The name of a STRING79 #define l_CSTRING_PARAM MT_STRING //!< the type of the parameter STRING80 #define l_CSTRING_DEFAULT "" //!< a default Value for an STRING76 #define l_CSTRING_TYPE const char* //!< The type of a CSTRING 77 #define l_CSTRING_FUNC isCString //!< The function to parse a CSTRING 78 #define l_CSTRING_NAME "cstring" //!< The name of a CSTRING 79 #define l_CSTRING_PARAM MT_STRING //!< the type of the parameter CSTRING 80 #define l_CSTRING_DEFAULT "" //!< a default Value for an CSTRING 81 81 82 82 #define l_STRING_TYPE const std::string& //!< The type of a STRING 83 83 #define l_STRING_FUNC isString //!< The function to parse a STRING 84 84 #define l_STRING_NAME "string" //!< The name of a STRING 85 #define l_STRING_PARAM MT_ STRING//!< the type of the parameter STRING85 #define l_STRING_PARAM MT_CSTRING //!< the type of the parameter STRING 86 86 #define l_STRING_DEFAULT "" //!< a default Value for an STRING 87 87
Note: See TracChangeset
for help on using the changeset viewer.