Changeset 9730 in orxonox.OLD for branches/new_class_id/src/lib/util/executor
- Timestamp:
- Sep 15, 2006, 12:09:12 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/util/executor
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/executor/executor.cc
r9728 r9730 61 61 break; 62 62 } 63 else 64 this->defaultValue[i].storeString(); 63 65 } 64 66 } … … 106 108 { 107 109 this->defaultValue[i].setValueOf(*value[i]); 110 this->defaultValue[i].storeString(); 108 111 } 109 112 } -
branches/new_class_id/src/lib/util/executor/executor.h
r9728 r9730 15 15 //! an enumerator for the definition of the Type. 16 16 typedef enum { 17 Executor_Objective = 1,18 Executor_Static = 2,17 Executor_Objective, 18 Executor_Static, 19 19 } Executor_Type; 20 20 … … 51 51 inline MultiType& getDefaultValue(unsigned int i) { return defaultValue[i]; }; 52 52 53 // EXECUTE54 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */55 // virtual void operator()(BaseObject* object, int& count, void* values) const = 0;56 /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */57 // virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const = 0;58 59 53 // RETRIEVE INFORMATION 60 54 /** @returns the Type of this Function (either static or objective) */ 61 inline long getType() const { return this->functorType; }; 55 inline Executor_Type getType() const { return this->functorType; }; 56 62 57 /** @returns the Count of Parameters this Executor takes */ 63 58 inline unsigned int getParamCount() const { return this->paramCount; }; … … 84 79 85 80 protected: 86 shortfunctorType; //!< The type of Function we've got (either static or objective).81 Executor_Type functorType; //!< The type of Function we've got (either static or objective). 87 82 unsigned int paramCount; //!< the count of parameters. 88 83 MultiType defaultValue[7]; //!< Default Values. 89 84 90 boolbRetVal; //!< True if the Executor has a return Value.85 const bool bRetVal; //!< True if the Executor has a return Value. 91 86 }; 92 87 -
branches/new_class_id/src/lib/util/executor/executor_functional.cc
r9728 r9730 15 15 16 16 #include "executor_functional.h" 17 std::string ExecutorFunctional_returningString_from[7];18 19 17 20 18 template<> bool fromString<bool>(const std::string& input, bool defaultValue) { return isBool(input, defaultValue); }; … … 39 37 template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getFloat(); }; 40 38 template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getChar(); }; 41 template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i) { return ExecutorFunctional_returningString_from[i] = defaultValues[i].getString(); };39 template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getStoredString(); }; 42 40 43 41 -
branches/new_class_id/src/lib/util/executor/executor_functional.h
r9728 r9730 51 51 template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i); 52 52 template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i); 53 54 55 /** 56 * @brief to remove writing errors, this function is Used. 57 * @param sub The SubString to use 58 * @param default The default Values. 59 */ 60 template<typename type, int index> type Evaluate(const SubString& sub, const MultiType* const defaults) 61 { 62 return (sub.size() > index) ? 63 fromString<type>(sub[index], getDefault<type>(defaults, index)) : 64 fromMulti<type>(defaults[index]); 65 }; 66 53 67 54 68 #endif /* __EXECUTOR_FUNCTIONAL_H_ */ … … 80 94 #endif 81 95 82 96 #ifdef __EXECUTOR_FUNCTIONAL_STATIC_INCLUDED 83 97 #define __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS 84 98 #else … … 103 117 104 118 #ifndef __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS 119 105 120 /////////// 106 121 //// 0 //// … … 177 192 { 178 193 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 179 (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])));194 Evaluate<type0, 0>(sub, this->defaultValue)); 180 195 }; 181 196 … … 220 235 { 221 236 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 222 (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),223 (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])));237 Evaluate<type0, 0>(sub, this->defaultValue), 238 Evaluate<type1, 1>(sub, this->defaultValue)); 224 239 }; 225 240 … … 265 280 { 266 281 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 267 (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),268 (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),269 (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])));282 Evaluate<type0, 0>(sub, this->defaultValue), 283 Evaluate<type1, 1>(sub, this->defaultValue), 284 Evaluate<type2, 2>(sub, this->defaultValue)); 270 285 }; 271 286 … … 312 327 { 313 328 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 314 (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),315 (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),316 (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])),317 (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])));329 Evaluate<type0, 0>(sub, this->defaultValue), 330 Evaluate<type1, 1>(sub, this->defaultValue), 331 Evaluate<type2, 2>(sub, this->defaultValue), 332 Evaluate<type3, 3>(sub, this->defaultValue)); 318 333 }; 319 334 … … 360 375 { 361 376 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 362 (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),363 (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),364 (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])),365 (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])),366 (sub.size() > 4) ? fromString<type4>(sub[4], getDefault<type4>(this->defaultValue, 4)) : (fromMulti<type4>(this->defaultValue[4])));377 Evaluate<type0, 0>(sub, this->defaultValue), 378 Evaluate<type1, 1>(sub, this->defaultValue), 379 Evaluate<type2, 2>(sub, this->defaultValue), 380 Evaluate<type3, 3>(sub, this->defaultValue), 381 Evaluate<type4, 4>(sub, this->defaultValue)); 367 382 }; 368 383
Note: See TracChangeset
for help on using the changeset viewer.