Changeset 1716 for code/branches/core3/src/core/Functor.h
- Timestamp:
- Sep 6, 2008, 4:21:56 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/core/Functor.h
r1592 r1716 33 33 #include "CorePrereqs.h" 34 34 35 #include "util/MultiType Math.h"35 #include "util/MultiType.h" 36 36 #include "util/Debug.h" 37 37 … … 95 95 virtual ~Functor() {} 96 96 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;97 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 98 99 99 inline unsigned int getParamCount() const { return this->numParams_; } 100 100 inline bool hasReturnvalue() const { return this->hasReturnValue_; } 101 101 inline FunctionType getType() const { return this->type_; } 102 inline MultiType MathgetReturnvalue() const { return this->returnedValue_; }102 inline MultiType getReturnvalue() const { return this->returnedValue_; } 103 103 104 104 std::string getTypenameParam(unsigned int param) const { return (param >= 0 && param < 5) ? this->typeParam_[param] : ""; } 105 105 std::string getTypenameReturnvalue() const { return this->typeReturnvalue_; } 106 106 107 virtual void evaluateParam(unsigned int index, MultiType Math& param) const = 0;107 virtual void evaluateParam(unsigned int index, MultiType& param) const = 0; 108 108 109 109 protected: … … 111 111 bool hasReturnValue_; 112 112 FunctionType type_; 113 MultiType MathreturnedValue_;113 MultiType returnedValue_; 114 114 115 115 std::string typeReturnvalue_; … … 121 121 public: 122 122 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;123 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 124 }; 125 125 … … 136 136 virtual ~FunctorMember() {} 137 137 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)138 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; 139 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; 140 141 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 142 { 143 143 if (this->bConstObject_) … … 280 280 281 281 282 282 /* 283 283 #define FUNCTOR_EVALUATE_PARAM(numparams) FUNCTOR_EVALUATE_PARAM##numparams 284 284 #define FUNCTOR_EVALUATE_PARAM0 … … 303 303 else if (index == 3) { P4 temp = param; param = temp; } \ 304 304 else if (index == 4) { P5 temp = param; param = temp; } 305 305 */ 306 #define FUNCTOR_EVALUATE_PARAM(numparams) FUNCTOR_EVALUATE_PARAM##numparams 307 #define FUNCTOR_EVALUATE_PARAM0 308 #define FUNCTOR_EVALUATE_PARAM1 \ 309 if (index == 0) { param.convert<P1>(); } 310 #define FUNCTOR_EVALUATE_PARAM2 \ 311 if (index == 0) { param.convert<P1>(); } \ 312 else if (index == 1) { param.convert<P2>(); } 313 #define FUNCTOR_EVALUATE_PARAM3 \ 314 if (index == 0) { param.convert<P1>(); } \ 315 else if (index == 1) { param.convert<P2>(); } \ 316 else if (index == 2) { param.convert<P3>(); } 317 #define FUNCTOR_EVALUATE_PARAM4 \ 318 if (index == 0) { param.convert<P1>(); } \ 319 else if (index == 1) { param.convert<P2>(); } \ 320 else if (index == 2) { param.convert<P3>(); } \ 321 else if (index == 3) { param.convert<P4>(); } 322 #define FUNCTOR_EVALUATE_PARAM5 \ 323 if (index == 0) { param.convert<P1>(); } \ 324 else if (index == 1) { param.convert<P2>(); } \ 325 else if (index == 2) { param.convert<P3>(); } \ 326 else if (index == 3) { param.convert<P4>(); } \ 327 else if (index == 4) { param.convert<P5>(); } 306 328 307 329 … … 324 346 } \ 325 347 \ 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) \348 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 349 { \ 328 350 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \ 329 351 } \ 330 352 \ 331 virtual void evaluateParam(unsigned int index, MultiType Math& param) const \353 virtual void evaluateParam(unsigned int index, MultiType& param) const \ 332 354 { \ 333 355 FUNCTOR_EVALUATE_PARAM(numparams); \ … … 362 384 } \ 363 385 \ 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) \386 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 387 { \ 366 388 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \ 367 389 } \ 368 390 \ 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) \391 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 392 { \ 371 393 COUT(1) << "An error occurred in Functor.h:" << std::endl; \ … … 373 395 } \ 374 396 \ 375 virtual void evaluateParam(unsigned int index, MultiType Math& param) const \397 virtual void evaluateParam(unsigned int index, MultiType& param) const \ 376 398 { \ 377 399 FUNCTOR_EVALUATE_PARAM(numparams); \ … … 395 417 } \ 396 418 \ 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) \419 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 420 { \ 399 421 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \ 400 422 } \ 401 423 \ 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) \424 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 425 { \ 404 426 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \ 405 427 } \ 406 428 \ 407 virtual void evaluateParam(unsigned int index, MultiType Math& param) const \429 virtual void evaluateParam(unsigned int index, MultiType& param) const \ 408 430 { \ 409 431 FUNCTOR_EVALUATE_PARAM(numparams); \
Note: See TracChangeset
for help on using the changeset viewer.