Changeset 5659 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Nov 20, 2005, 11:31:18 PM (19 years ago)
- Location:
- trunk/src/lib/util
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/executor/executor.cc
r5641 r5659 59 59 // What Parameters we have got 60 60 for (unsigned int i = 0; i < paramCount; i++) 61 this->defaultValue[i].setType(va_arg(parameterList, int)); 61 { 62 int type = va_arg(parameterList, int); 63 this->defaultValue[i].setType(type); 64 } 62 65 } 63 66 … … 79 82 executor->defaultValue = new MultiType[this->paramCount]; 80 83 for (unsigned int i = 0; i < this->paramCount; i++) 81 executor->defaultValue[i] = this->defaultValue[i]; 84 { 85 executor->defaultValue[i] = this->defaultValue[i]; 86 // printf("1: %s 2: %s\n", MultiType::MultiTypeToString(this->defaultValue[i].getType()), MultiType::MultiTypeToString(executor->defaultValue[i].getType())); 87 } 82 88 } 83 89 -
trunk/src/lib/util/executor/executor_specials.h
r5652 r5659 28 28 */ 29 29 ExecutorXML(void(T::*function)(const TiXmlElement*), const TiXmlElement* root, const char* paramName) 30 : Executor(1 )30 : Executor(1, MT_EXT1) 31 31 { 32 32 PRINTF(4)("Loading %s from XML-element %p\n", paramName, root); -
trunk/src/lib/util/multi_type.cc
r5643 r5659 17 17 18 18 #include "multi_type.h" 19 #include "stdincl.h" 20 // #include <stddef.h> 21 // #include <stdlib.h> 22 // #include <string.h> 23 // #include <stdio.h> 19 20 //#include "stdincl.h" 21 #include <stddef.h> 22 #include <stdlib.h> 23 #include <string.h> 24 #include <stdio.h> 25 26 #ifdef DEBUG 27 #include "debug.h" 28 #endif 24 29 25 30 using namespace std; … … 80 85 this->init(); 81 86 this->setString(value); 87 } 88 89 MultiType::MultiType(const MultiType& multiType) 90 { 91 this->init(); 92 printf("test2"); 93 *this = multiType; 82 94 } 83 95 … … 96 108 * @returns a Copy of itself. (strings inside are copied as well) 97 109 */ 98 // MultiType MultiType::operator= (const MultiType& mt) 99 // { 100 // this->type = mt.type; 101 // this->value = mt.value; 102 // 103 // if (mt.type == MT_STRING && mt.storedString != NULL) 104 // { 105 // this->storedString = new char[strlen (mt.storedString)+1]; 106 // strcpy(this->storedString, mt.storedString); 107 // this->value.String = this->storedString; 108 // } 109 // else 110 // this->storedString = NULL; 111 // return *this; 112 // } 110 MultiType& MultiType::operator= (const MultiType& mt) 111 { 112 this->type = mt.type; 113 this->value = mt.value; 114 115 printf("test\n"); 116 if (mt.type == MT_STRING && mt.storedString != NULL) 117 { 118 this->setString(mt.storedString); 119 } 120 else 121 this->storedString = NULL; 122 return *this; 123 } 113 124 114 125 /** … … 119 130 this->type = MT_NULL; 120 131 this->storedString = NULL; 121 this->value. Bool = false;132 this->value.Float = 0.0f; 122 133 } 123 134 … … 130 141 { 131 142 if (this->type != type) 132 {133 143 this->type = (MT_Type)type; 134 135 if (this->type == MT_NULL)136 this->reset();137 }138 144 } 139 145 … … 336 342 void MultiType::debug() 337 343 { 338 printf("MultiType of Type: %s is: BOOL: %d, INT: %d, FLOAT: %f, CHAR: %c, STRING %s\n", 344 #ifdef DEBUG 345 PRINT(0) 346 #else 347 printf 348 #endif 349 ("MultiType of Type '%s' :: Values: BOOL: '%d', INT: '%d', FLOAT: '%f', CHAR: '%c', STRING '%s'\n", 339 350 MultiType::MultiTypeToString(this->type), 340 351 this->getBool(), … … 343 354 this->getChar(), 344 355 this->getString() 345 );356 ); 346 357 347 358 … … 353 364 void MultiType::reset() 354 365 { 355 switch (this->type) 356 { 357 default: 358 break; 366 switch ( this->type ) 367 { 359 368 case MT_BOOL: 360 369 this->setBool(false); … … 371 380 this->setString(""); 372 381 break; 382 default: 383 #ifdef DEBUG 384 PRINTF(2)("Unknown Type not reseting\n"); 385 #endif 386 break; 373 387 } 374 388 } … … 381 395 const char* MultiType::MultiTypeToString(MT_Type type) 382 396 { 383 switch ( type)397 switch ( type ) 384 398 { 385 399 default: -
trunk/src/lib/util/multi_type.h
r5644 r5659 39 39 MultiType(char value); 40 40 MultiType(const char* value); 41 MultiType(const MultiType& multiType); 41 42 virtual ~MultiType(); 42 43 43 // MultiTypeoperator= (const MultiType& mt);44 MultiType& operator= (const MultiType& mt); 44 45 45 46 void setType(int type); … … 80 81 81 82 private: 82 MT_Type type; 83 83 84 union MultiTypeValue 84 85 { … … 91 92 } value; 92 93 94 MT_Type type; 95 93 96 char* storedString; 94 97 };
Note: See TracChangeset
for help on using the changeset viewer.