- Timestamp:
- Mar 9, 2006, 2:43:47 AM (19 years ago)
- Location:
- trunk/src/lib/util
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/executor/executor.cc
r7199 r7200 108 108 { 109 109 if (*value[i] != MT_NULL) 110 this->defaultValue[i].setValueOf(*value[i]); 110 { 111 // printf("1:::: %s\n", MultiType::MultiTypeToString(this->defaultValue[i].getType())); 112 //this->defaultValue[i].debug(); 113 this->defaultValue[i].setValueOf(*value[i]); 114 //printf("2::::%s\n", MultiType::MultiTypeToString(this->defaultValue[i].getType())); 115 //this->defaultValue[i].debug(); 116 //this->defaultValue[i].setValueOf(*value[i]); 117 } 111 118 } 112 119 return this; -
trunk/src/lib/util/executor/executor.h
r7199 r7200 189 189 //! execute-macro for functions with one parameter 190 190 #define ExecutorExecute1(t1) \ 191 else if (this->paramCount == 1 && this->defaultValue[0] .getType()== t1##_PARAM) \191 else if (this->paramCount == 1 && this->defaultValue[0] == t1##_PARAM) \ 192 192 EXECUTOREXECUTER(_1_##t1)(t1##_FUNC((const char*)parameters, t1##_DEFGRAB(0))) 193 193 194 194 //! execute-macro for functions with two parameters 195 195 #define ExecutorExecute2(t1,t2) \ 196 else if (this->paramCount == 2 && this->defaultValue[0] .getType() == t1##_PARAM && this->defaultValue[1].getType()== t2##_PARAM) \196 else if (this->paramCount == 2 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM) \ 197 197 EXECUTOREXECUTER(_2_##t1##_##t2)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1))) 198 198 199 199 //! execute-macro for functions with three parameters 200 200 #define ExecutorExecute3(t1,t2,t3) \ 201 else if (this->paramCount == 3 && this->defaultValue[0] .getType() == t1##_PARAM && this->defaultValue[1].getType() == t2##_PARAM && this->defaultValue[2].getType()== t3##_PARAM) \201 else if (this->paramCount == 3 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM && this->defaultValue[2] == t3##_PARAM) \ 202 202 EXECUTOREXECUTER(_3_##t1##_##t2##_##t3)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2))) 203 203 204 204 //! execute-macro for functions with four parameters 205 205 #define ExecutorExecute4(t1,t2,t3,t4) \ 206 else if (this->paramCount == 4 && this->defaultValue[0] .getType() == t1##_PARAM && this->defaultValue[1].getType() == t2##_PARAM && this->defaultValue[2].getType() == t3##_PARAM && this->defaultValue[3].getType()== t4##_PARAM) \206 else if (this->paramCount == 4 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM && this->defaultValue[2] == t3##_PARAM && this->defaultValue[3] == t4##_PARAM) \ 207 207 EXECUTOREXECUTER(_4_##t1##_##t2##_##t3##_##t4)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)), t4##_FUNC(sub.getString(3), t4##_DEFGRAB(3))) \ 208 208 … … 210 210 //! execute-macro for functions with five parameters 211 211 #define ExecutorExecute5(t1,t2,t3,t4,t5) \ 212 else if (this->paramCount == 5 && this->defaultValue[0] .getType() == t1##_PARAM && this->defaultValue[1].getType() == t2##_PARAM && this->defaultValue[2].getType() == t3##_PARAM && this->defaultValue[3].getType() == t4##_PARAM && this->defaultValue[4].getType()== t5##_PARAM) \212 else if (this->paramCount == 5 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM && this->defaultValue[2] == t3##_PARAM && this->defaultValue[3] == t4##_PARAM && this->defaultValue[4] == t5##_PARAM) \ 213 213 EXECUTOREXECUTER(_5_##t1##_##t2##_##t3##_##t4##_##t5)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)), t4##_FUNC(sub.getString(3), t4##_DEFGRAB(3)), t5##_FUNC(sub.getString(4), t5##_DEFGRAB(4))) 214 214 … … 269 269 { 270 270 SubString sub((const char*) parameters, " \n\t,", '\\'); 271 printf("%s :: %s\n", this->getName(), (const char*) parameters); 271 272 //! FUNCTOR_LIST is the List of Executive Functions 272 273 #define FUNCTOR_LIST(x) ExecutorExecute ## x -
trunk/src/lib/util/multi_type.cc
r7199 r7200 36 36 MultiType::MultiType(MT_Type type) 37 37 { 38 this->init();39 38 this->type = type; 39 switch (this->type) 40 { 41 case MT_BOOL: 42 this->value.Bool = false; 43 break; 44 case MT_INT: 45 this->value.Int = 0; 46 break; 47 case MT_FLOAT: 48 this->value.Float = 0.0f; 49 break; 50 case MT_CHAR: 51 this->value.Char = '\0'; 52 break; 53 } 40 54 } 41 55 /** … … 45 59 MultiType::MultiType(bool value) 46 60 { 47 this->init();48 61 this->setBool(value); 49 62 } … … 55 68 MultiType::MultiType(int value) 56 69 { 57 this->init();58 70 this->setInt(value); 59 71 } … … 65 77 MultiType::MultiType(double value) 66 78 { 67 this->init();68 79 this->setFloat(value); 69 80 } … … 75 86 MultiType::MultiType(char value) 76 87 { 77 this->init();78 88 this->setChar(value); 79 89 } … … 85 95 MultiType::MultiType(const char* value) 86 96 { 87 this->init();88 97 this->setString(value); 89 98 } … … 95 104 MultiType::MultiType(const std::string& value) 96 105 { 97 this->init();98 106 this->setString(value); 99 107 } … … 160 168 161 169 /** 162 * @brief initializes the MultiType163 */164 void MultiType::init()165 {166 this->type = MT_NULL;167 this->value.Float = 0.0f;168 }169 170 171 /**172 170 * @brief sets the type of this MultiType and resets to the default value 173 171 * @param type the new Type … … 365 363 if (this->type & MT_BOOL) return (this->value.Bool)? "true" : "false"; 366 364 367 if (this->type & MT_CHAR)368 {369 char tmpString[2];370 tmpString[0] = this->value.Char;371 tmpString[1] = '\0';372 return tmpString;373 }374 365 else if (this->type & MT_INT) 375 366 { … … 382 373 char tmpString[64]; 383 374 sprintf(tmpString, "%f", this->value.Float); 375 return tmpString; 376 } 377 else if (this->type & MT_CHAR) 378 { 379 char tmpString[2]; 380 tmpString[0] = this->value.Char; 381 tmpString[1] = '\0'; 384 382 return tmpString; 385 383 } … … 431 429 case MT_BOOL: 432 430 this->setBool(false); 431 break; 433 432 case MT_INT: 434 433 this->setInt(0); … … 460 459 switch ( type ) 461 460 { 462 default:463 return "NONE";464 461 case MT_BOOL: 465 462 return "bool"; … … 473 470 return "string"; 474 471 } 472 return "NONE"; 475 473 } 476 474 … … 492 490 if (!strncmp(type, "string", 6)) 493 491 return MT_STRING; 494 } 492 493 return MT_NULL; 494 } -
trunk/src/lib/util/multi_type.h
r7199 r7200 98 98 99 99 private: 100 void init();101 102 103 private:104 100 union MultiTypeValue 105 101 {
Note: See TracChangeset
for help on using the changeset viewer.