Changeset 1747 for code/trunk/src/core/Functor.h
- Timestamp:
- Sep 9, 2008, 4:25:52 AM (17 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/core3 (added) merged: 1573-1574,1583-1586,1591-1594,1596-1597,1603,1606-1607,1610-1611,1655,1658,1676-1679,1681-1685,1687,1716-1723,1725-1729,1736
- Property svn:mergeinfo changed
-
code/trunk/src/core/Functor.h
r1505 r1747 33 33 #include "CorePrereqs.h" 34 34 35 #include "util/MultiType Math.h"36 #include " Debug.h"35 #include "util/MultiType.h" 36 #include "util/Debug.h" 37 37 38 38 #define MAX_FUNCTOR_ARGUMENTS 5 … … 69 69 CreateTypeToStringTemplate(long); 70 70 CreateTypeToStringTemplate(unsigned long); 71 CreateTypeToStringTemplate(long long); 72 CreateTypeToStringTemplate(unsigned long long); 71 73 CreateTypeToStringTemplate(float); 72 74 CreateTypeToStringTemplate(double); … … 80 82 CreateTypeToStringTemplate(Degree); 81 83 82 template <> \83 inline std::string typeToString<std::string>() { return "string"; } \84 template <> \85 inline std::string typeToString<std::string&>() { return "string"; } \86 template <> \87 inline std::string typeToString<const std::string>() { return "string"; } \88 template <> \84 template <> 85 inline std::string typeToString<std::string>() { return "string"; } 86 template <> 87 inline std::string typeToString<std::string&>() { return "string"; } 88 template <> 89 inline std::string typeToString<const std::string>() { return "string"; } 90 template <> 89 91 inline std::string typeToString<const std::string&>() { return "string"; } 90 92 … … 95 97 virtual ~Functor() {} 96 98 97 virtual void operator()(const MultiType Math& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;99 virtual void operator()(const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) = 0; 98 100 99 101 inline unsigned int getParamCount() const { return this->numParams_; } 100 102 inline bool hasReturnvalue() const { return this->hasReturnValue_; } 101 103 inline FunctionType getType() const { return this->type_; } 102 inline MultiType MathgetReturnvalue() const { return this->returnedValue_; }104 inline MultiType getReturnvalue() const { return this->returnedValue_; } 103 105 104 106 std::string getTypenameParam(unsigned int param) const { return (param >= 0 && param < 5) ? this->typeParam_[param] : ""; } 105 107 std::string getTypenameReturnvalue() const { return this->typeReturnvalue_; } 106 108 107 virtual void evaluateParam(unsigned int index, MultiType Math& param) const = 0;109 virtual void evaluateParam(unsigned int index, MultiType& param) const = 0; 108 110 109 111 protected: … … 111 113 bool hasReturnValue_; 112 114 FunctionType type_; 113 MultiType MathreturnedValue_;115 MultiType returnedValue_; 114 116 115 117 std::string typeReturnvalue_; … … 121 123 public: 122 124 virtual ~FunctorStatic() {} 123 virtual void operator()(const MultiType Math& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;125 virtual void operator()(const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) = 0; 124 126 }; 125 127 … … 136 138 virtual ~FunctorMember() {} 137 139 138 virtual void operator()(T* object, const MultiType Math& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;139 virtual void operator()(const T* object, const MultiType Math& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;140 141 virtual void operator()(const MultiType Math& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null)140 virtual void operator()(T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) = 0; 141 virtual void operator()(const T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) = 0; 142 143 virtual void operator()(const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) 142 144 { 143 145 if (this->bConstObject_) … … 284 286 #define FUNCTOR_EVALUATE_PARAM0 285 287 #define FUNCTOR_EVALUATE_PARAM1 \ 286 if (index == 0) { P1 temp = param; param = temp; }288 if (index == 0) { param.convert<P1>(); } 287 289 #define FUNCTOR_EVALUATE_PARAM2 \ 288 if (index == 0) { P1 temp = param; param = temp; } \289 else if (index == 1) { P2 temp = param; param = temp; }290 if (index == 0) { param.convert<P1>(); } \ 291 else if (index == 1) { param.convert<P2>(); } 290 292 #define FUNCTOR_EVALUATE_PARAM3 \ 291 if (index == 0) { P1 temp = param; param = temp; } \292 else if (index == 1) { P2 temp = param; param = temp; } \293 else if (index == 2) { P3 temp = param; param = temp; }293 if (index == 0) { param.convert<P1>(); } \ 294 else if (index == 1) { param.convert<P2>(); } \ 295 else if (index == 2) { param.convert<P3>(); } 294 296 #define FUNCTOR_EVALUATE_PARAM4 \ 295 if (index == 0) { P1 temp = param; param = temp; } \296 else if (index == 1) { P2 temp = param; param = temp; } \297 else if (index == 2) { P3 temp = param; param = temp; } \298 else if (index == 3) { P4 temp = param; param = temp; }297 if (index == 0) { param.convert<P1>(); } \ 298 else if (index == 1) { param.convert<P2>(); } \ 299 else if (index == 2) { param.convert<P3>(); } \ 300 else if (index == 3) { param.convert<P4>(); } 299 301 #define FUNCTOR_EVALUATE_PARAM5 \ 300 if (index == 0) { P1 temp = param; param = temp; } \301 else if (index == 1) { P2 temp = param; param = temp; } \302 else if (index == 2) { P3 temp = param; param = temp; } \303 else if (index == 3) { P4 temp = param; param = temp; } \304 else if (index == 4) { P5 temp = param; param = temp; }302 if (index == 0) { param.convert<P1>(); } \ 303 else if (index == 1) { param.convert<P2>(); } \ 304 else if (index == 2) { param.convert<P3>(); } \ 305 else if (index == 3) { param.convert<P4>(); } \ 306 else if (index == 4) { param.convert<P5>(); } 305 307 306 308 … … 324 326 } \ 325 327 \ 326 void operator()(const MultiType Math& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \328 void operator()(const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \ 327 329 { \ 328 330 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \ 329 331 } \ 330 332 \ 331 virtual void evaluateParam(unsigned int index, MultiType Math& param) const \333 virtual void evaluateParam(unsigned int index, MultiType& param) const \ 332 334 { \ 333 335 FUNCTOR_EVALUATE_PARAM(numparams); \ … … 362 364 } \ 363 365 \ 364 void operator()(T* object, const MultiType Math& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \366 void operator()(T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \ 365 367 { \ 366 368 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \ 367 369 } \ 368 370 \ 369 void operator()(const T* object, const MultiType Math& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \371 void operator()(const T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \ 370 372 { \ 371 373 COUT(1) << "An error occurred in Functor.h:" << std::endl; \ … … 373 375 } \ 374 376 \ 375 virtual void evaluateParam(unsigned int index, MultiType Math& param) const \377 virtual void evaluateParam(unsigned int index, MultiType& param) const \ 376 378 { \ 377 379 FUNCTOR_EVALUATE_PARAM(numparams); \ … … 395 397 } \ 396 398 \ 397 void operator()(T* object, const MultiType Math& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \399 void operator()(T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \ 398 400 { \ 399 401 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \ 400 402 } \ 401 403 \ 402 void operator()(const T* object, const MultiType Math& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \404 void operator()(const T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \ 403 405 { \ 404 406 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \ 405 407 } \ 406 408 \ 407 virtual void evaluateParam(unsigned int index, MultiType Math& param) const \409 virtual void evaluateParam(unsigned int index, MultiType& param) const \ 408 410 { \ 409 411 FUNCTOR_EVALUATE_PARAM(numparams); \
Note: See TracChangeset
for help on using the changeset viewer.