- Timestamp:
- Mar 30, 2005, 11:40:16 AM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/defs/debug.h
r3663 r3668 58 58 // DEFINE MODULES \\ 59 59 #define DEBUG_MODULE_ORXONOX 0 60 #define DEBUG_MODULE_WORLD 060 #define DEBUG_MODULE_WORLD 3 61 61 #define DEBUG_MODULE_PNODE 0 62 62 #define DEBUG_MODULE_WORLD_ENTITY 0 -
orxonox/trunk/src/garbage_collector.cc
r3664 r3668 131 131 list->remove(entity); 132 132 /* second remove out of pnode tree */ 133 entity->remove(); 133 //entity->remove(); 134 //delete entity; 134 135 } 135 136 entity = iterator->nextElement(); -
orxonox/trunk/src/lib/coord/p_node.cc
r3662 r3668 336 336 if( pNode->parent != NULL ) 337 337 { 338 PRINTF( 2)("PNode::addChild() - reparenting node: removing it and adding it again\n");338 PRINTF(3)("PNode::addChild() - reparenting node: removing it and adding it again\n"); 339 339 pNode->parent->children->remove(pNode); 340 340 } … … 368 368 NullParent* nullParent = NullParent::getInstance(); 369 369 370 PNode* pn = this->children->enumerate(); 370 tIterator<PNode>* iterator = this->children->getIterator(); 371 PNode* pn = iterator->nextElement(); 372 371 373 while( pn != NULL) 372 374 { 373 375 //this->children->remove(pn); 374 376 nullParent->addChild(pn, pn->getMode()); 375 pn = this->children->nextElement(); 376 } 377 pn = iterator->nextElement(); 378 } 379 delete iterator; 380 //this->parent->removeChild(this); 377 381 } 378 382 -
orxonox/trunk/src/lib/util/list.h
r3661 r3668 75 75 this->currentEl = startElement; 76 76 this->firstEl = startElement; 77 this->counter = -1; 77 if( this->firstEl != NULL) 78 this->counter = -1; 79 else 80 this->counter = 0; 78 81 } 79 82 … … 89 92 inline T* tIterator<T>::nextElement () 90 93 { 94 /* 91 95 this->counter++; 92 96 if( this->counter == 0) 93 97 return this->firstEl->curr; 94 95 if( this->currentEl->next == NULL || this->currentEl == NULL) 98 */ 99 100 if( this->currentEl == NULL) 96 101 return NULL; 97 102 103 listElement<T>* tmp = this->currentEl; 98 104 this->currentEl = this->currentEl->next; 99 return t his->currentEl->curr;105 return tmp->curr; 100 106 } 101 107 … … 104 110 template<class T> class tList 105 111 { 106 107 112 public: 108 113 tList (); … … 188 193 else this->currentEl->next->prev = this->currentEl->prev; 189 194 190 te = this->currentEl->next; // for what am i doing this?195 //te = this->currentEl->next; // for what am i doing this? 191 196 delete this->currentEl; 192 this->currentEl = te; 197 //this->currentEl = te; 198 this->currentEl = NULL; 193 199 this->size--; 194 200 return; -
orxonox/trunk/src/orxonox.cc
r3662 r3668 367 367 dt = end - ini; 368 368 369 int type = -1;369 int type = 3; 370 370 /* type -1 == all 371 371 type 0 == framework 372 372 type 1 == vector 373 373 type 2 == quaternion 374 type 3 == lists 374 375 */ 375 376 if(type == 0 || type == -1) 376 377 { 377 378 /* framework test*/ 378 379 379 380 printf("Generating Objects:\t\t\t\t\t%i\n", ITERATIONS); 380 381 /* ************WorldEntity class test************** */ … … 510 511 rdtscl(end); 511 512 mittel += (end - ini - dt); 512 513 } 513 514 mi = mittel / (float)ITERATIONS; 514 515 printf(" Call function tick() of Prim:\t\t%11.2f\n", mi); 515 516 517 } 516 517 518 } 519 518 520 if(type == 1 || type == -1) 519 521 { … … 556 558 printf(" CrossMult of two vectors:\t\t%11.2f\n", mi); 557 559 558 if(type == 1 || type == -1) 559 { 560 /* quaternion test */ 561 printf("\nDoing some simple quaternion operations: \t\t%i\n", VECTOR_MAX); 562 /* vector test */ 563 Quaternion* a = new Quaternion(); 564 Quaternion* b = new Quaternion(); 565 Quaternion* c = new Quaternion(); 566 567 unsigned long mittel, ini, end; 568 float mi; 569 int i = 0; 570 // quaternion generieren mit spez konstruktor 571 mittel = 0; 572 Vector* qa = new Vector(4.6, 9.3, 0.4); 573 Vector* qb = new Vector(3.5, 6.1, 4.3); 574 for(i = 0; i < VECTOR_MAX; ++i) 575 { 576 rdtscl(ini); 577 578 Quaternion* qu = new Quaternion(*qa, *qb); 579 580 rdtscl(end); 581 delete qu; 582 mittel += (end - ini - dt); 583 } 584 delete a; 585 delete b; 586 mi = mittel / (float)VECTOR_MAX; 587 printf(" Gen. quatern. betw. two vectors:\t%11.2f\n", mi); 588 589 590 // multiplication 591 mittel = 0; 592 for(i = 0; i < VECTOR_MAX; ++i) 593 { 594 rdtscl(ini); 595 596 *c = *a * *b; 597 598 rdtscl(end); 599 mittel += (end - ini - dt); 600 } 601 mi = mittel / (float)VECTOR_MAX; 602 printf(" Multiplying two quat.(=rot): a * b\t%11.2f\n", mi); 603 604 605 606 // rotating a vector by a quaternion 607 mittel = 0; 608 for(i = 0; i < VECTOR_MAX; ++i) 609 { 610 rdtscl(ini); 611 612 *qa = a->apply(*qb); 613 614 rdtscl(end); 615 mittel += (end - ini - dt); 616 } 617 mi = mittel / (float)VECTOR_MAX; 618 printf(" Rot a vec by a quat: q->apply(v)\t%11.2f\n", mi); 619 620 621 622 // generate rotation matrix 623 mittel = 0; 624 float matrix[4][4]; 625 for(i = 0; i < VECTOR_MAX; ++i) 626 { 627 rdtscl(ini); 628 629 a->matrix(matrix); 630 631 rdtscl(end); 632 mittel += (end - ini - dt); 633 } 634 mi = mittel / (float)VECTOR_MAX; 635 printf(" Generate rot matrix: q->matrix(m)\t%11.2f\n", mi); 636 } 637 if( type == 3 || type == -1) 638 { 639 /* list tests*/ 640 printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX); 641 tList<char>* list = new tList<char>(); 642 char* name; 643 644 printf(" Adding[1..10] elements to list, found:\n"); 645 list->add("1"); 646 list->add("2"); 647 list->add("3"); 648 list->add("4"); 649 list->add("5"); 650 list->add("6"); 651 list->add("7"); 652 list->add("8"); 653 list->add("9"); 654 list->add("10"); 655 656 /*give list out */ 657 tIterator<char>* iterator = list->getIterator(); 560 } 561 if( type == 2 || type == -1) 562 { 563 /* quaternion test */ 564 printf("\nDoing some simple quaternion operations: \t\t%i\n", VECTOR_MAX); 565 /* vector test */ 566 Quaternion* a = new Quaternion(); 567 Quaternion* b = new Quaternion(); 568 Quaternion* c = new Quaternion(); 569 570 unsigned long mittel, ini, end; 571 float mi; 572 int i = 0; 573 // quaternion generieren mit spez konstruktor 574 mittel = 0; 575 Vector* qa = new Vector(4.6, 9.3, 0.4); 576 Vector* qb = new Vector(3.5, 6.1, 4.3); 577 for(i = 0; i < VECTOR_MAX; ++i) 578 { 579 rdtscl(ini); 580 581 Quaternion* qu = new Quaternion(*qa, *qb); 582 583 rdtscl(end); 584 delete qu; 585 mittel += (end - ini - dt); 586 } 587 delete a; 588 delete b; 589 mi = mittel / (float)VECTOR_MAX; 590 printf(" Gen. quatern. betw. two vectors:\t%11.2f\n", mi); 591 592 593 // multiplication 594 mittel = 0; 595 for(i = 0; i < VECTOR_MAX; ++i) 596 { 597 rdtscl(ini); 598 599 *c = *a * *b; 600 601 rdtscl(end); 602 mittel += (end - ini - dt); 603 } 604 mi = mittel / (float)VECTOR_MAX; 605 printf(" Multiplying two quat.(=rot): a * b\t%11.2f\n", mi); 606 607 608 609 // rotating a vector by a quaternion 610 mittel = 0; 611 for(i = 0; i < VECTOR_MAX; ++i) 612 { 613 rdtscl(ini); 614 615 *qa = a->apply(*qb); 616 617 rdtscl(end); 618 mittel += (end - ini - dt); 619 } 620 mi = mittel / (float)VECTOR_MAX; 621 printf(" Rot a vec by a quat: q->apply(v)\t%11.2f\n", mi); 622 623 624 625 // generate rotation matrix 626 mittel = 0; 627 float matrix[4][4]; 628 for(i = 0; i < VECTOR_MAX; ++i) 629 { 630 rdtscl(ini); 631 632 a->matrix(matrix); 633 634 rdtscl(end); 635 mittel += (end - ini - dt); 636 } 637 mi = mittel / (float)VECTOR_MAX; 638 printf(" Generate rot matrix: q->matrix(m)\t%11.2f\n", mi); 639 } 640 if( type == 3 || type == -1) 641 { 642 /* list tests*/ 643 printf("\nList operations tests: \t\t\t\t\t%i\n", LIST_MAX); 644 tList<char>* list = new tList<char>(); 645 char* name; 646 647 printf(" Adding[1..10] elements to list, found:\n"); 648 list->add("1"); 649 list->add("2"); 650 list->add("3"); 651 list->add("4"); 652 list->add("5"); 653 list->add("6"); 654 list->add("7"); 655 list->add("8"); 656 list->add("9"); 657 list->add("10"); 658 659 /*give list out */ 660 tIterator<char>* iterator = list->getIterator(); 661 name = iterator->nextElement(); 662 printf(" List Elements: \t\t"); 663 while( name != NULL) 664 { 665 printf("%s,", name); 658 666 name = iterator->nextElement(); 659 printf(" List Elements: \t\t");660 while( name != NULL) 661 { 662 printf("%s,", name); 663 name = iterator->nextElement(); 664 } 665 delete iterator;666 printf("\n");667 668 669 /*removing some elements from the list*/ 670 printf(" Removing elements [2,3,6,8,10], adding [11] now found:\n");671 list->remove("2");672 list->remove("3"); 673 list->remove("6");674 list->remove("8");675 list->remove("10");676 list->add("11"); 677 /*give list out */678 iterator = list->getIterator();667 } 668 delete iterator; 669 printf("\n"); 670 671 672 /*removing some elements from the list*/ 673 printf(" Removing elements [2,3,6,8,10], adding [11] now found:\n"); 674 list->remove("2"); 675 list->remove("3"); 676 list->remove("6"); 677 list->remove("8"); 678 list->remove("10"); 679 list->add("11"); 680 /*give list out */ 681 iterator = list->getIterator(); 682 name = iterator->nextElement(); 683 printf(" List Elements: \t\t"); 684 while( name != NULL) 685 { 686 printf("%s,", name); 679 687 name = iterator->nextElement(); 680 printf(" List Elements: \t\t"); 681 while( name != NULL) 682 { 683 printf("%s,", name); 684 name = iterator->nextElement(); 685 } 686 delete iterator; 687 printf("\n"); 688 689 delete list; 690 printf("\nChecking list performance:\t\t\t\t%i\n", LIST_MAX); 691 692 tList<int>* plist = new tList<int>(); 693 unsigned long mittel, ini, end; 694 float mi; 695 int i = 0; 696 mittel = 0; 697 for(i = 0; i < LIST_MAX; ++i) 698 { 699 rdtscl(ini); 700 701 plist->add(&i); 702 703 rdtscl(end); 704 mittel += (end - ini - dt); 705 } 706 mi = mittel / (float)LIST_MAX; 707 printf(" Adding reference to list:\t\t%11.2f\n", mi); 708 709 mittel = 0; 710 for(i = 0; i < LIST_MAX; ++i) 711 { 712 rdtscl(ini); 713 714 plist->remove(&i); 715 716 rdtscl(end); 717 mittel += (end - ini - dt); 718 } 719 mi = mittel / (float)LIST_MAX; 720 printf(" Removing 1st reference from list:\t%11.2f\n", mi); 721 722 723 724 } 688 } 689 delete iterator; 690 printf("\n"); 691 692 delete list; 693 printf("\nChecking list performance:\t\t\t\t%i\n", LIST_MAX); 694 695 tList<int>* plist = new tList<int>(); 696 unsigned long mittel, ini, end; 697 float mi; 698 int i = 0; 699 mittel = 0; 700 for(i = 0; i < LIST_MAX; ++i) 701 { 702 rdtscl(ini); 703 704 plist->add(&i); 705 706 rdtscl(end); 707 mittel += (end - ini - dt); 708 } 709 mi = mittel / (float)LIST_MAX; 710 printf(" Adding reference to list:\t\t%11.2f\n", mi); 711 712 mittel = 0; 713 for(i = 0; i < LIST_MAX; ++i) 714 { 715 rdtscl(ini); 716 717 plist->remove(&i); 718 719 rdtscl(end); 720 mittel += (end - ini - dt); 721 } 722 mi = mittel / (float)LIST_MAX; 723 printf(" Removing 1st reference from list:\t%11.2f\n", mi); 724 725 726 725 727 } 726 } 728 729 }
Note: See TracChangeset
for help on using the changeset viewer.