- Timestamp:
- Sep 14, 2006, 10:31:40 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/shell/shell_command.cc
r9727 r9728 44 44 // copy the executor: 45 45 this->executor = executor; 46 this->executor->setName(commandName);47 46 48 47 for (unsigned int i = 0; i < this->executor->getParamCount(); i++) -
branches/new_class_id/src/lib/shell/shell_command.h
r9727 r9728 10 10 11 11 #include "executor/executor.h" 12 13 /// THIS IS USED TO LOAD CONSTANT AND STATIC FUNCTIONS EASILY. 14 #include "executor/executor_functional.h" 15 #define EXECUTOR_FUNCTIONAL_USE_CONST 16 #include "executor/executor_functional.h" 17 #define EXECUTOR_FUNCTIONAL_USE_STATIC 18 #include "executor/executor_functional.h" 19 20 12 21 #include "shell_completion_plugin.h" 13 22 -
branches/new_class_id/src/lib/util/executor/executor.cc
r9727 r9728 19 19 20 20 21 ObjectListDefinition(ExecutorBase); 21 template<> MT_Type ExecutorParamType<bool>() { return MT_BOOL; }; 22 template<> MT_Type ExecutorParamType<int>() { return MT_INT; }; 23 template<> MT_Type ExecutorParamType<unsigned int>() { return MT_UINT; }; 24 template<> MT_Type ExecutorParamType<float>() { return MT_FLOAT; }; 25 template<> MT_Type ExecutorParamType<char>() { return MT_CHAR; }; 26 template<> MT_Type ExecutorParamType<const std::string&>() { return MT_STRING; }; 27 28 22 29 23 30 /** … … 37 44 : bRetVal(hasRetVal) 38 45 { 39 this->registerObject(this, ExecutorBase::_objectList);40 41 46 // What Parameters have we got 42 47 this->defaultValue[0] = param0; -
branches/new_class_id/src/lib/util/executor/executor.h
r9727 r9728 11 11 #include "helper_functions.h" 12 12 #include "multi_type.h" 13 #include "substring.h"14 13 #include "functor_list.h" //< MUST BE INCLUDED HERE AT LEAST ONCE. 15 14 … … 19 18 Executor_Static = 2, 20 19 } Executor_Type; 20 21 22 23 template<typename type> MT_Type ExecutorParamType() { return MT_EXT1; }; 24 template<> MT_Type ExecutorParamType<bool>(); 25 template<> MT_Type ExecutorParamType<int>(); 26 template<> MT_Type ExecutorParamType<unsigned int>(); 27 template<> MT_Type ExecutorParamType<float>(); 28 template<> MT_Type ExecutorParamType<char>(); 29 template<> MT_Type ExecutorParamType<const std::string&>(); 21 30 22 31 //////////////// … … 34 43 * Functions with many types (@see functor_list.h) 35 44 */ 36 class ExecutorBase : public BaseObject45 class ExecutorBase 37 46 { 38 ObjectListDeclaration(ExecutorBase);39 47 public: 40 48 // virtual bool operator==(const Executor* executor) const = 0; … … 60 68 61 69 protected: 70 virtual ~ExecutorBase() {}; 62 71 ExecutorBase(bool hasRetVal = false, 63 72 const MultiType& param0 = MT_NULL, const MultiType& param1 = MT_NULL, … … 109 118 } 110 119 111 112 113 120 protected: 114 121 Executor(bool hasRetVal, 115 122 const MultiType& param0 = MT_NULL, const MultiType& param1 = MT_NULL, 116 123 const MultiType& param2 = MT_NULL, const MultiType& param3 = MT_NULL, 117 124 const MultiType& param4 = MT_NULL, const MultiType& param5 = MT_NULL, 118 125 const MultiType& param6 = MT_NULL) 119 126 : ExecutorBase(hasRetVal, param0, param1, param2, param3, param4, param5, param6) 120 {} 121 }; 122 123 124 125 #include "executor/executor_functional.h" 126 #define EXECUTOR_FUNCTIONAL_USE_CONST 127 #include "executor/executor_functional.h" 128 #define EXECUTOR_FUNCTIONAL_USE_STATIC 129 #include "executor/executor_functional.h" 127 {}} 128 ; 130 129 131 130 #endif /* _EXECUTOR_H */ -
branches/new_class_id/src/lib/util/executor/executor_functional.cc
r8894 r9728 14 14 */ 15 15 16 #include "executor .h"16 #include "executor_functional.h" 17 17 std::string ExecutorFunctional_returningString_from[7]; 18 18 19 20 template<> MT_Type ExecutorParamType<bool>() { return MT_BOOL; };21 template<> MT_Type ExecutorParamType<int>() { return MT_INT; };22 template<> MT_Type ExecutorParamType<unsigned int>() { return MT_UINT; };23 template<> MT_Type ExecutorParamType<float>() { return MT_FLOAT; };24 template<> MT_Type ExecutorParamType<char>() { return MT_CHAR; };25 template<> MT_Type ExecutorParamType<const std::string&>() { return MT_STRING; };26 19 27 20 template<> bool fromString<bool>(const std::string& input, bool defaultValue) { return isBool(input, defaultValue); }; -
branches/new_class_id/src/lib/util/executor/executor_functional.h
r9727 r9728 24 24 25 25 #include "executor.h" 26 27 template<typename type> MT_Type ExecutorParamType() { return MT_EXT1; }; 28 template<> MT_Type ExecutorParamType<bool>(); 29 template<> MT_Type ExecutorParamType<int>(); 30 template<> MT_Type ExecutorParamType<unsigned int>(); 31 template<> MT_Type ExecutorParamType<float>(); 32 template<> MT_Type ExecutorParamType<char>(); 33 template<> MT_Type ExecutorParamType<const std::string&>(); 26 #include "substring.h" 27 34 28 35 29 template<typename type> type fromString(const std::string& input, type defaultValue) { return defaultValue; }; … … 70 64 71 65 #ifdef EXECUTOR_FUNCTIONAL_USE_CONST 66 #ifdef __EXECUTOR_FUNCTIONAL_CONST_INCLUDED 67 #define __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS 68 #else 69 #define __EXECUTOR_FUNCTIONAL_CONST_INCLUDED 70 #endif 72 71 #undef __EXECUTOR_FUNCTIONAL_CONST 73 72 #define __EXECUTOR_FUNCTIONAL_CONST const 74 73 #undef __EXECUTOR_FUNCTIONAL_NAME 75 74 #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount) Executor##ParamCount##Params_const 76 #endif 77 78 # ifdefEXECUTOR_FUNCTIONAL_USE_STATIC75 //#endif /* EXECUTOR_FUNCTIONAL_USE_CONST */ 76 77 #elif defined EXECUTOR_FUNCTIONAL_USE_STATIC 79 78 #ifdef EXECUTOR_FUNCTIONAL_USE_CONST 80 79 #error you obviously do not know what you are doing !! ask the bensch 81 #endif /* EXECUTOR_FUNCTIONAL_USE_CONST */ 80 #endif 81 82 #ifdef __EXECUTOR_FUNCTIONAL_STATIC_INCLUDED 83 #define __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS 84 #else 85 #define __EXECUTOR_FUNCTIONAL_STATIC_INCLUDED 86 #endif 82 87 83 88 #undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC … … 88 93 #define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER *functionPointer 89 94 90 #endif /* EXECUTOR_FUNCTIONAL_USE_STATIC */ 91 95 //#endif /* EXECUTOR_FUNCTIONAL_USE_STATIC */ 96 #else 97 #ifdef __EXECUTOR_FUNCTIONAL_PLAIN_INCLUDED 98 #define __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS 99 #else 100 #define __EXECUTOR_FUNCTIONAL_PLAIN_INCLUDED 101 #endif 102 #endif 103 104 #ifndef __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS 92 105 /////////// 93 106 //// 0 //// … … 122 135 }; 123 136 124 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */125 virtual void operator()(BaseObject* object, int& count, void* values) const126 {127 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();128 }129 130 137 /** 131 138 * @brief copies the Executor … … 161 168 this->functionPointer = functionPointer; 162 169 }; 163 164 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */165 virtual void operator()(BaseObject* object, int& count, void* values) const166 {167 const MultiType* mt = (const MultiType*)values;168 return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(169 fromMulti<type0>((count > 0)? mt[0] : this->defaultValue[0]) );170 }171 172 170 173 171 /** … … 225 223 (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1]))); 226 224 }; 227 228 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */229 virtual void operator()(BaseObject* object, int& count, void* values) const230 {231 const MultiType* mt = (const MultiType*)values;232 return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(233 fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),234 fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]) );235 }236 225 237 226 /** … … 280 269 (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2]))); 281 270 }; 282 283 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */284 virtual void operator()(BaseObject* object, int& count, void* values) const285 {286 const MultiType* mt = (const MultiType*)values;287 return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(288 fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),289 fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),290 fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]) );291 }292 271 293 272 /** … … 338 317 (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3]))); 339 318 }; 340 341 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */342 virtual void operator()(BaseObject* object, int& count, void* values) const343 {344 const MultiType* mt = (const MultiType*)values;345 return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(346 fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),347 fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),348 fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]),349 fromMulti<type3>((count > 3) ? mt[3] : this->defaultValue[3]) );350 }351 319 352 320 /** … … 399 367 }; 400 368 401 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */402 virtual void operator()(BaseObject* object, int& count, void* values) const403 {404 const MultiType* mt = (const MultiType*)values;405 return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(406 fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),407 fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),408 fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]),409 fromMulti<type3>((count > 3) ? mt[3] : this->defaultValue[3]),410 fromMulti<type4>((count > 4) ? mt[4] : this->defaultValue[4]) );411 }412 413 369 /** 414 370 * @brief copies the Executor … … 513 469 #undef EXECUTOR_FUNCTIONAL_USE_STATIC 514 470 #endif 471 472 473 #endif /* __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS */ 474 #undef __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS -
branches/new_class_id/src/lib/util/executor/executor_lua.h
r9727 r9728 127 127 } 128 128 129 /**130 * @brief executes the Command on BaseObject131 * @param object the BaseObject to execute this Executor on132 * @param loadString ignored in this case133 */134 virtual void operator()(BaseObject* object, const SubString& = SubString()) const135 {136 PRINTF(1)("no usefull executor\n");137 }138 139 129 virtual void operator()(BaseObject* object, lua_State*& state) const 140 130 { … … 174 164 } 175 165 176 /**177 * @brief executes the Command on BaseObject178 * @param object the BaseObject to execute this Executor on179 * @param loadString ignored in this case180 */181 virtual void operator()(BaseObject* object, const SubString& = SubString()) const182 {183 PRINTF(1)("no usefull executor\n");184 }185 166 186 167 virtual void operator()(BaseObject* object, lua_State*& state) const … … 374 355 this->functionPointer = function; 375 356 this->functorType = Executor_Objective; 376 }377 378 /**379 * @brief executes the Command on BaseObject380 * @param object the BaseObject to execute this Executor on381 * @param loadString ignored in this case382 */383 virtual void operator()(BaseObject* object, const SubString& = SubString()) const384 {385 PRINTF(1)("no usefull executor\n");386 357 } 387 358 -
branches/new_class_id/src/lib/util/loading/load_param.h
r9727 r9728 25 25 26 26 #include "executor/executor.h" 27 #include "executor/executor_functional.h" 28 27 29 #include "parser/tinyxml/tinyxml.h" 28 30 … … 30 32 class LoadClassDescription; 31 33 class LoadParamDescription; 34 class TiXmlElement; 32 35 33 36 /**
Note: See TracChangeset
for help on using the changeset viewer.