Changeset 7719 in orxonox.OLD for trunk/src/lib/util
- Timestamp:
- May 19, 2006, 3:13:13 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/executor/executor_functional.h
r7718 r7719 70 70 #endif /* EXECUTOR_FUNCTIONAL_USE_CONST */ 71 71 72 72 #undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC 73 73 #define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC functionPointer 74 74 #undef __EXECUTOR_FUNCTIONAL_NAME … … 77 77 #define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER *functionPointer 78 78 79 79 #undef EXECUTOR_FUNCTIONAL_USE_STATIC 80 80 #endif /* EXECUTOR_FUNCTIONAL_USE_STATIC */ 81 81 … … 98 98 }; 99 99 100 virtual Executor* clone() const { 100 virtual Executor* clone() const 101 { 101 102 return new __EXECUTOR_FUNCTIONAL_NAME(0)<T>(this->functionPointer); 102 103 }; 103 104 }; 104 105 105 106 //! SINGLE VALUE 106 107 template<class T, typename type0> class __EXECUTOR_FUNCTIONAL_NAME(1) : public Executor 107 108 { … … 129 130 }; 130 131 131 virtual Executor* clone() const { 132 virtual Executor* clone() const 133 { 132 134 return new __EXECUTOR_FUNCTIONAL_NAME(1)<T, type0>(this->functionPointer); 133 135 }; 134 136 }; 135 137 136 // / DOUBLE PENETRATION138 //! DOUBLE VALUE 137 139 template<class T, typename type0, typename type1> class __EXECUTOR_FUNCTIONAL_NAME(2) : public Executor 138 140 { … … 155 157 }; 156 158 157 virtual Executor* clone() const { 159 virtual Executor* clone() const 160 { 158 161 return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, type0, type1>(this->functionPointer); 159 162 }; … … 161 164 162 165 163 164 /// HACK !! THESE WILL BE RESET AGAIN !! 166 //! TRIPPLE VALUE 167 template<class T, typename type0, typename type1, typename type2> class __EXECUTOR_FUNCTIONAL_NAME(3) : public Executor 168 { 169 private: 170 void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST; 171 172 public: 173 __EXECUTOR_FUNCTIONAL_NAME(3) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST) 174 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>()) 175 { 176 this->functorType = Executor_Objective; 177 this->functionPointer = functionPointer; 178 }; 179 180 virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const 181 { 182 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 183 fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)), 184 fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)), 185 fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2))); 186 }; 187 188 virtual Executor* clone() const 189 { 190 return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, type0, type1, type2>(this->functionPointer); 191 }; 192 }; 193 194 195 196 //! QUADRUPPEL VALUE 197 template<class T, typename type0, typename type1, typename type2, typename type3> class __EXECUTOR_FUNCTIONAL_NAME(4) : public Executor 198 { 199 private: 200 void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST; 201 202 public: 203 __EXECUTOR_FUNCTIONAL_NAME(4) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST) 204 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>()) 205 { 206 this->functorType = Executor_Objective; 207 this->functionPointer = functionPointer; 208 }; 209 210 virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const 211 { 212 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 213 fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)), 214 fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)), 215 fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)), 216 fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3))); 217 }; 218 219 virtual Executor* clone() const 220 { 221 return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, type0, type1, type2, type3>(this->functionPointer); 222 }; 223 }; 224 225 //! CHINQUE VALUE 226 template<class T, typename type0, typename type1, typename type2, typename type3, typename type4> class __EXECUTOR_FUNCTIONAL_NAME(5) : public Executor 227 { 228 private: 229 void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST; 230 231 public: 232 __EXECUTOR_FUNCTIONAL_NAME(5) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST) 233 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>()) 234 { 235 this->functorType = Executor_Objective; 236 this->functionPointer = functionPointer; 237 }; 238 239 virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const 240 { 241 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 242 fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)), 243 fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)), 244 fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)), 245 fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)), 246 fromString<type4>(sub[4], getDefault<type4>(this->defaultValue, 4))); 247 }; 248 249 virtual Executor* clone() const 250 { 251 return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, type0, type1, type2, type3, type4>(this->functionPointer); 252 }; 253 }; 254 165 255 166 256 … … 183 273 } 184 274 185 #define EXECUTOR_FUNCTIONAL_CREATOR3(type0, type1, type2) 186 #define EXECUTOR_FUNCTIONAL_CREATOR4(type0, type1, type2, type3) 187 #define EXECUTOR_FUNCTIONAL_CREATOR5(type0, type1, type2, type3, type4) 275 #define EXECUTOR_FUNCTIONAL_CREATOR3(type0, type1, type2) \ 276 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \ 277 { \ 278 return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE>(functionPointer); \ 279 } 280 281 #define EXECUTOR_FUNCTIONAL_CREATOR4(type0, type1, type2, type3) \ 282 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \ 283 { \ 284 return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE>(functionPointer); \ 285 } 286 287 #define EXECUTOR_FUNCTIONAL_CREATOR5(type0, type1, type2, type3, type4) \ 288 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \ 289 { \ 290 return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE>(functionPointer); \ 291 } 188 292 189 293
Note: See TracChangeset
for help on using the changeset viewer.