Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 797


Ignore:
Timestamp:
Feb 11, 2008, 3:29:16 AM (17 years ago)
Author:
landauf
Message:

config-values are working again, now with a totally reworked ConfigValueContainer using MultiTypes (this commit is just a bugfix, the major work was done before, see r792)

added << operator to std::ostream for all MultiTypes

Location:
code/branches/core/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core/src/orxonox/Orxonox.cc

    r793 r797  
    7676#include "GraphicsEngine.h"
    7777
     78#include "objects/WorldEntity.h"
     79#include "core/BaseObject.h"
     80#include "objects/Test.h"
     81#include "objects/test1.h"
     82#include "objects/test2.h"
     83#include "objects/test3.h"
     84
    7885#include "Orxonox.h"
    7986
     
    223230      break;
    224231    }
    225     startRenderLoop();
     232
     233        #define testandcout(code) \
     234          std::cout << #code << " " << code << "\n"
     235
     236/*
     237        std::cout << "Test 1\n";
     238        BaseObject* test1;
     239        test1 = new BaseObject();
     240        test1 = new BaseObject();
     241        test1 = new BaseObject();
     242
     243        std::cout << "Test 2\n";
     244        A1* test2;
     245        test2 = new A1();
     246        test2 = new A1();
     247        test2 = new A1();
     248
     249        std::cout << "Test 3\n";
     250        BaseObject* test3;
     251        test3 = new BaseObject();
     252        test3 = new BaseObject();
     253        test3 = new BaseObject();
     254
     255        std::cout << "Test 4\n";
     256        A3* test4;
     257        test4 = new A3();
     258        test4 = new A3();
     259        test4 = new A3();
     260*/
     261/*
     262        std::cout << "Test 5\n";
     263        A1* test5_01 = new A1();
     264        A2* test5_02 = new A2();
     265        A3* test5_03 = new A3();
     266        A1B1* test5_04 = new A1B1();
     267        A1B2* test5_05 = new A1B2();
     268        A2B1* test5_06 = new A2B1();
     269        A2B2* test5_07 = new A2B2();
     270        A3B1* test5_08 = new A3B1();
     271        A3B2* test5_09 = new A3B2();
     272        A1B1C1* test5_10 = new A1B1C1();
     273        A1B1C2* test5_11 = new A1B1C2();
     274        A1B2C1* test5_12 = new A1B2C1();
     275        A2B1C1* test5_13 = new A2B1C1();
     276        A2B2C1* test5_14 = new A2B2C1();
     277        A3B1C1* test5_15 = new A3B1C1();
     278        A3B1C2* test5_16 = new A3B1C2();
     279        A3B2C1* test5_17 = new A3B2C1();
     280        A3B2C2* test5_18 = new A3B2C2();
     281
     282        OrxonoxClass* test5;
     283        for (int i = 0; i <= 18; i++)
     284        {
     285          if (i == 0) test5 = new BaseObject;
     286          if (i == 1) test5 = test5_01;
     287          if (i == 2) test5 = test5_02;
     288          if (i == 3) test5 = test5_03;
     289          if (i == 4) test5 = test5_04;
     290          if (i == 5) test5 = test5_05;
     291          if (i == 6) test5 = test5_06;
     292          if (i == 7) test5 = test5_07;
     293          if (i == 8) test5 = test5_08;
     294          if (i == 9) test5 = test5_09;
     295          if (i == 10) test5 = test5_10;
     296          if (i == 11) test5 = test5_11;
     297          if (i == 12) test5 = test5_12;
     298          if (i == 13) test5 = test5_13;
     299          if (i == 14) test5 = test5_14;
     300          if (i == 15) test5 = test5_15;
     301          if (i == 16) test5 = test5_16;
     302          if (i == 17) test5 = test5_17;
     303          if (i == 18) test5 = test5_18;
     304
     305          std::cout << "\n";
     306          std::cout << test5->getIdentifier()->getName() << " (" << test5->getIdentifier()->getNetworkID() << "): parents:     " << test5->getIdentifier()->getParents().toString() << "\n";
     307          std::cout << test5->getIdentifier()->getName() << " (" << test5->getIdentifier()->getNetworkID() << "): children:    " << test5->getIdentifier()->getChildren().toString() << "\n";
     308        }
     309
     310        std::cout << "Class with ID 0: " << ID(0) << " " << ID(0)->getName() << "\n";
     311        std::cout << "Class with ID 1: " << ID(1) << " " << ID(1)->getName() << "\n";
     312        std::cout << "Class with ID 2: " << ID(2) << " " << ID(2)->getName() << "\n";
     313        std::cout << "Class with ID 3: " << ID(3) << " " << ID(3)->getName() << "\n";
     314        std::cout << "Class with ID 4: " << ID(4) << " " << ID(4)->getName() << "\n";
     315        std::cout << "Class with ID 100: " << ID(100) << "\n";
     316        std::cout << "ID of BaseObject: " << Class(BaseObject)->getNetworkID() << "\n";
     317
     318        std::cout << "\nChange ID of BaseObject to 100\n";
     319        Class(BaseObject)->setNetworkID(100);
     320        std::cout << "Class with ID 100: " << ID(100) << "\n";
     321        std::cout << "Class with ID 1: " << ID(1) << "\n";
     322        std::cout << "ID of BaseObject: " << Class(BaseObject)->getNetworkID() << "\n";
     323
     324        std::cout << "\nChange ID of BaseObject to 3\n";
     325        Class(BaseObject)->setNetworkID(3);
     326        std::cout << "Class with ID 100: " << ID(100) << "\n";
     327        std::cout << "Class with ID 1: " << ID(1) << "\n";
     328        std::cout << "Class with ID 3: " << ID(3) << "\n";
     329        std::cout << "ID of BaseObject: " << Class(BaseObject)->getNetworkID() << "\n";
     330        std::cout << "ID of Test1: " << Class(Test1)->getNetworkID() << "\n";
     331*/
     332/*
     333        std::cout << "\n";
     334        std::cout << "isA(XYZ)-Test:\n";
     335        std::cout << "test5_01 = A1, Erwartet: 1 0 0 1 0\n";
     336        testandcout(test5_01->isA(Class(A1)));
     337        testandcout(test5_01->isA(Class(A2)));
     338        testandcout(test5_01->isA(Class(A1B1)));
     339        testandcout(test5_01->isA(Class(BaseObject)));
     340        testandcout(test5_01->isA(Class(Interface1)));
     341
     342        std::cout << "\n";
     343        std::cout << "test5_02 = A2, Erwartet: 0 1 0 1 0\n";
     344        testandcout(test5_02->isA(Class(A1)));
     345        testandcout(test5_02->isA(Class(A2)));
     346        testandcout(test5_02->isA(Class(A1B1)));
     347        testandcout(test5_02->isA(Class(BaseObject)));
     348        testandcout(test5_02->isA(Class(Interface1)));
     349
     350        std::cout << "\n";
     351        std::cout << "test5_01 = A3, Erwartet: 0 0 0 1 1\n";
     352        testandcout(test5_03->isA(Class(A1)));
     353        testandcout(test5_03->isA(Class(A2)));
     354        testandcout(test5_03->isA(Class(A1B1)));
     355        testandcout(test5_03->isA(Class(BaseObject)));
     356        testandcout(test5_03->isA(Class(Interface1)));
     357
     358        std::cout << "\n";
     359        std::cout << "isDirectA(XYZ)-Test:\n";
     360        std::cout << "test5_01 = A1, Erwartet: 1 0 0 0 0\n";
     361        testandcout(test5_01->isDirectlyA(Class(A1)));
     362        testandcout(test5_01->isDirectlyA(Class(A2)));
     363        testandcout(test5_01->isDirectlyA(Class(A1B1)));
     364        testandcout(test5_01->isDirectlyA(Class(BaseObject)));
     365        testandcout(test5_01->isDirectlyA(Class(Interface1)));
     366
     367        std::cout << "\n";
     368        std::cout << "test5_02 = A2, Erwartet: 0 1 0 0 0\n";
     369        testandcout(test5_02->isDirectlyA(Class(A1)));
     370        testandcout(test5_02->isDirectlyA(Class(A2)));
     371        testandcout(test5_02->isDirectlyA(Class(A1B1)));
     372        testandcout(test5_02->isDirectlyA(Class(BaseObject)));
     373        testandcout(test5_02->isDirectlyA(Class(Interface1)));
     374
     375        std::cout << "\n";
     376        std::cout << "test5_03 = A3, Erwartet: 0 0 0 0 0\n";
     377        testandcout(test5_03->isDirectlyA(Class(A1)));
     378        testandcout(test5_03->isDirectlyA(Class(A2)));
     379        testandcout(test5_03->isDirectlyA(Class(A1B1)));
     380        testandcout(test5_03->isDirectlyA(Class(BaseObject)));
     381        testandcout(test5_03->isDirectlyA(Class(Interface1)));
     382
     383        std::cout << "\n";
     384        std::cout << "isChildOf(XYZ)-Test:\n";
     385        std::cout << "test5_04 = A1B1, Erwartet: 1 0 1 0 0 0 0\n";
     386        testandcout(test5_04->isChildOf(Class(A1)));
     387        testandcout(test5_04->isChildOf(Class(A2)));
     388        testandcout(test5_04->isChildOf(Class(BaseObject)));
     389        testandcout(test5_04->isChildOf(Class(Interface1)));
     390        testandcout(test5_04->isChildOf(Class(Interface2)));
     391        testandcout(test5_04->isChildOf(Class(A1B1C2)));
     392        testandcout(test5_04->isChildOf(Class(A1B1)));
     393
     394        std::cout << "\n";
     395        std::cout << "test5_06 = A2B1, Erwartet: 0 1 1 0 0 0 0\n";
     396        testandcout(test5_06->isChildOf(Class(A1)));
     397        testandcout(test5_06->isChildOf(Class(A2)));
     398        testandcout(test5_06->isChildOf(Class(BaseObject)));
     399        testandcout(test5_06->isChildOf(Class(Interface1)));
     400        testandcout(test5_06->isChildOf(Class(Interface2)));
     401        testandcout(test5_06->isChildOf(Class(A1B1C2)));
     402        testandcout(test5_06->isChildOf(Class(A1B1)));
     403
     404        std::cout << "\n";
     405        std::cout << "test5_07 = A2B2, Erwartet: 0 1 1 1 0 0\n";
     406        testandcout(test5_07->isChildOf(Class(A1)));
     407        testandcout(test5_07->isChildOf(Class(A2)));
     408        testandcout(test5_07->isChildOf(Class(BaseObject)));
     409        testandcout(test5_07->isChildOf(Class(Interface1)));
     410        testandcout(test5_07->isChildOf(Class(Interface2)));
     411        testandcout(test5_07->isChildOf(Class(A1B1C2)));
     412
     413        std::cout << "\n";
     414        std::cout << "test5_08 = A3B1, Erwartet: 0 0 1 1 0 0\n";
     415        testandcout(test5_08->isChildOf(Class(A1)));
     416        testandcout(test5_08->isChildOf(Class(A2)));
     417        testandcout(test5_08->isChildOf(Class(BaseObject)));
     418        testandcout(test5_08->isChildOf(Class(Interface1)));
     419        testandcout(test5_08->isChildOf(Class(Interface2)));
     420        testandcout(test5_08->isChildOf(Class(A1B1C2)));
     421
     422        std::cout << "\n";
     423        std::cout << "test5_09 = A3B2, Erwartet: 0 0 1 1 1 0\n";
     424        testandcout(test5_09->isChildOf(Class(A1)));
     425        testandcout(test5_09->isChildOf(Class(A2)));
     426        testandcout(test5_09->isChildOf(Class(BaseObject)));
     427        testandcout(test5_09->isChildOf(Class(Interface1)));
     428        testandcout(test5_09->isChildOf(Class(Interface2)));
     429        testandcout(test5_09->isChildOf(Class(A1B1C2)));
     430
     431        std::cout << "\n";
     432        std::cout << "isParentOf(XYZ)-Test:\n";
     433        std::cout << "test1 = BaseObject, Erwartet: 0 0 1 1 1 1 1\n";
     434        testandcout(test1->isParentOf(Class(BaseObject)));
     435        testandcout(test1->isParentOf(Class(Interface1)));
     436        testandcout(test1->isParentOf(Class(A1)));
     437        testandcout(test1->isParentOf(Class(A2)));
     438        testandcout(test1->isParentOf(Class(A1B1)));
     439        testandcout(test1->isParentOf(Class(A2B2)));
     440        testandcout(test1->isParentOf(Class(A3B1C2)));
     441
     442        std::cout << "\n";
     443        std::cout << "test5_01 = A1, Erwartet: 0 0 0 0 1 0 0\n";
     444        testandcout(test5_01->isParentOf(Class(BaseObject)));
     445        testandcout(test5_01->isParentOf(Class(Interface1)));
     446        testandcout(test5_01->isParentOf(Class(A1)));
     447        testandcout(test5_01->isParentOf(Class(A2)));
     448        testandcout(test5_01->isParentOf(Class(A1B1)));
     449        testandcout(test5_01->isParentOf(Class(A2B2)));
     450        testandcout(test5_01->isParentOf(Class(A3B1C2)));
     451
     452        std::cout << "\n";
     453        std::cout << "Interface1, Erwartet: 0 0 0 0 0 1 1\n";
     454        testandcout(Class(Interface1)->isParentOf(Class(BaseObject)));
     455        testandcout(Class(Interface1)->isParentOf(Class(Interface1)));
     456        testandcout(Class(Interface1)->isParentOf(Class(A1)));
     457        testandcout(Class(Interface1)->isParentOf(Class(A2)));
     458        testandcout(Class(Interface1)->isParentOf(Class(A1B1)));
     459        testandcout(Class(Interface1)->isParentOf(Class(A2B2)));
     460        testandcout(Class(Interface1)->isParentOf(Class(A3B1C2)));
     461*/
     462/*
     463        std::cout << "Test 6\n";
     464        std::cout << "1:\n";
     465        Identifier* test6_01 = Class(A1B1);
     466        std::cout << "2:\n";
     467        Identifier* test6_02 = Class(A1B1);
     468        std::cout << "3:\n";
     469        Identifier* test6_03 = Class(A1);
     470        std::cout << "4:\n";
     471        Identifier* test6_04 = Class(A1B1C1);
     472        std::cout << "5:\n";
     473        Identifier* test6_05 = Class(A1B1);
     474        std::cout << "6:\n";
     475        Identifier* test6_06 = Class(A1B1C1);
     476
     477        std::cout << "\n";
     478        std::cout << "BaseObject: parents:     " << Class(BaseObject)->getParents().toString() << "\n";
     479        std::cout << "BaseObject: children:    " << Class(BaseObject)->getChildren().toString() << "\n";
     480
     481        std::cout << "\n";
     482        std::cout << "A1: parents:     " << Class(A1)->getParents().toString() << "\n";
     483        std::cout << "A1: children:    " << Class(A1)->getChildren().toString() << "\n";
     484
     485        std::cout << "\n";
     486        std::cout << "A1B1: parents:     " << Class(A1B1)->getParents().toString() << "\n";
     487        std::cout << "A1B1: children:    " << Class(A1B1)->getChildren().toString() << "\n";
     488
     489        std::cout << "\n";
     490        std::cout << "A1B1C1: parents:     " << Class(A1B1C1)->getParents().toString() << "\n";
     491        std::cout << "A1B1C1: children:    " << Class(A1B1C1)->getChildren().toString() << "\n";
     492
     493        std::cout << "\n";
     494        std::cout << "A3B1C1 child of A3:  " << Class(A3B1C1)->isChildOf(Class(A3)) << "\n";
     495        std::cout << "\n";
     496        std::cout << "A2 parent of A2B1C1: " << Class(A2)->isParentOf(Class(A2B1C1)) << "\n";
     497*/
     498/*
     499        std::cout << "Test 7\n";
     500        std::cout << "1\n";
     501        SubclassIdentifier<A1B1> test7_01;
     502        test7_01 = Class(A1B1C1);
     503
     504        SubclassIdentifier<A1B1> test7_02;
     505        test7_02 = Class(A1B1);
     506
     507        std::cout << test7_01->getName() << "\n";
     508        std::cout << test7_02->getName() << "\n";
     509*/
     510/*
     511        std::cout << "2\n";
     512
     513        SubclassIdentifier<A1B1> test7_03;
     514        test7_03 = Class(A1);
     515
     516        SubclassIdentifier<A1B1> test7_04;
     517        test7_04 = Class(A1B2);
     518
     519        SubclassIdentifier<A1B1> test7_05;
     520        test7_05 = Class(A2);
     521*/
     522/*
     523        std::cout << "Test 8\n";
     524
     525        std::cout << "1\n";
     526        Test1* test8_01 = new Test1;
     527        Test3* test8_03 = new Test3;
     528        test8_03->usefullClassesIsATest(test8_01);
     529
     530        std::cout << "2\n";
     531        Test2* test8_02 = new Test2;
     532        test8_03->usefullClassesIsATest(test8_02);
     533
     534        std::cout << "3\n";
     535        test8_01->setUsefullClass1(Class(Test1));
     536        test8_01->setUsefullClass1(test8_02->getIdentifier());
     537        test8_01->setUsefullClass2(Class(Test2));
     538        test8_01->setUsefullClassOfTypeTest3(Class(Test3));
     539        test8_01->setUsefullClassOfTypeTest3(test8_03->getIdentifier());
     540
     541
     542        testandcout(test8_01->isA(Class(Test1)));
     543        testandcout(test8_01->isA(Class(Test2)));
     544        testandcout(test8_01->isA(Class(Test3)));
     545
     546        Test2* test8_04 = new Test2;
     547        testandcout(test8_02->isA(Class(Test1)));
     548        testandcout(test8_02->isA(Class(Test2)));
     549        testandcout(test8_02->isA(Class(Test3)));
     550
     551        Test3* test8_05 = new Test3;
     552        testandcout(test8_03->isA(Class(Test1)));
     553        testandcout(test8_03->isA(Class(Test2)));
     554        testandcout(test8_03->isA(Class(Test3)));
     555
     556        delete test8_01;
     557        delete test8_02;
     558        delete test8_03;
     559
     560
     561        std::cout << "Test 9\n";
     562        std::cout << "1\n";
     563        Identifier* test9_01 = Class(A3);
     564        BaseObject* test9_02 = test9_01->fabricate();
     565        std::cout << test9_02->getIdentifier()->getName() << "\n";
     566
     567        std::cout << "\n2\n";
     568        BaseObject* test9_03 = Class(A1B2)->fabricate();
     569        std::cout << test9_03->getIdentifier()->getName() << "\n";
     570
     571        std::cout << "\n3\n";
     572        SubclassIdentifier<A1> test9_04;
     573        test9_04 = Class(A1B1C1);
     574        A1* test9_05 = test9_04.fabricate();
     575        std::cout << test9_05->getIdentifier()->getName() << "\n";
     576
     577        std::cout << "\n4\n";
     578        BaseObject* test9_06 = ID("A2B2")->fabricate();
     579        std::cout << test9_06->getIdentifier()->getName() << "\n";
     580
     581        std::cout << "\n5\n";
     582        delete test9_02;
     583        delete test9_03;
     584        delete test9_05;
     585        delete test9_06;
     586*/
     587/*
     588        std::cout << "Test 10\n";
     589        Identifier* test10_01 = Class(A1B2);
     590        Identifier* test10_02 = Class(A2);
     591        Identifier* test10_03 = Class(A3B1C1);
     592
     593        BaseObject* test10_04 = test10_01->fabricate();
     594        BaseObject* test10_05 = test10_02->fabricate();
     595        BaseObject* test10_06 = test10_03->fabricate();
     596
     597        BaseObject* test10_07;
     598        for (int i = 0; i < 10; i++)
     599            test10_07 = ID("A1B1C1")->fabricate();
     600
     601        std::cout << "1\n";
     602        int count;
     603
     604        count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::start(); it != 0; ++it) { count++; }
     605        std::cout << "Anzahl BaseObjects: " << count << "\n";
     606        count = 0; for (Iterator<A1> it = ObjectList<A1>::start(); it != 0; ++it) { count++; }
     607        std::cout << "Anzahl A1: " << count << "\n";
     608        count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::start(); it; ++it) { count++; }
     609        std::cout << "Anzahl A1B1: " << count << "\n";
     610        count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::start(); it; ++it) { count++; }
     611        std::cout << "Anzahl A1B1C1: " << count << "\n";
     612        count = 0; for (Iterator<A2> it = ObjectList<A2>::start(); it; ++it) { count++; }
     613        std::cout << "Anzahl A2: " << count << "\n";
     614
     615        std::cout << "2\n";
     616        BaseObject* test10_08;
     617        BaseObject* test10_09;
     618        BaseObject* test10_10;
     619        for (int i = 0; i < 10; i++)
     620        {
     621            test10_08 = ID("A2B1C1")->fabricate();
     622            std::string objName = "A2B1C1#";
     623            objName += '0' + i;
     624            test10_08->setName(objName);
     625
     626            if (i == 0)
     627                test10_09 = test10_08;
     628
     629            if (i == 5)
     630                test10_10 = test10_08;
     631        }
     632
     633        count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::start(); it != 0; ++it) { count++; }
     634        std::cout << "Anzahl BaseObjects: " << count << "\n";
     635        count = 0; for (Iterator<A1> it = ObjectList<A1>::start(); it != 0; ++it) { count++; }
     636        std::cout << "Anzahl A1: " << count << "\n";
     637        count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::start(); it; ++it) { count++; }
     638        std::cout << "Anzahl A1B1: " << count << "\n";
     639        count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::start(); it; ++it) { count++; }
     640        std::cout << "Anzahl A1B1C1: " << count << "\n";
     641        count = 0; for (Iterator<A2> it = ObjectList<A2>::start(); it; ++it) { count++; }
     642        std::cout << "Anzahl A2: " << count << "\n";
     643
     644        for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::start(); it; ++it)
     645            std::cout << "Name: " << it->getName() << "\n";
     646
     647        std::cout << "3\n";
     648        for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::end(); it; --it)
     649            std::cout << "Name: " << it->getName() << "\n";
     650
     651        std::cout << "4\n";
     652        delete test10_08;
     653
     654        count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::start(); it != 0; ++it) { count++; }
     655        std::cout << "Anzahl BaseObjects: " << count << "\n";
     656        count = 0; for (Iterator<A1> it = ObjectList<A1>::start(); it != 0; ++it) { count++; }
     657        std::cout << "Anzahl A1: " << count << "\n";
     658        count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::start(); it; ++it) { count++; }
     659        std::cout << "Anzahl A1B1: " << count << "\n";
     660        count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::start(); it; ++it) { count++; }
     661        std::cout << "Anzahl A1B1C1: " << count << "\n";
     662        count = 0; for (Iterator<A2> it = ObjectList<A2>::start(); it; ++it) { count++; }
     663        std::cout << "Anzahl A2: " << count << "\n";
     664
     665        std::cout << "5\n";
     666        for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::start(); it; ++it)
     667            std::cout << "Name: " << it->getName() << "\n";
     668
     669        std::cout << "6\n";
     670        for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::end(); it; --it)
     671            std::cout << "Name: " << it->getName() << "\n";
     672
     673        std::cout << "7\n";
     674        delete test10_09;
     675
     676        count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::end(); it != 0; --it) { count++; }
     677        std::cout << "Anzahl BaseObjects: " << count << "\n";
     678        count = 0; for (Iterator<A1> it = ObjectList<A1>::end(); it != 0; --it) { count++; }
     679        std::cout << "Anzahl A1: " << count << "\n";
     680        count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::end(); it; --it) { count++; }
     681        std::cout << "Anzahl A1B1: " << count << "\n";
     682        count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::end(); it; --it) { count++; }
     683        std::cout << "Anzahl A1B1C1: " << count << "\n";
     684        count = 0; for (Iterator<A2> it = ObjectList<A2>::end(); it; --it) { count++; }
     685        std::cout << "Anzahl A2: " << count << "\n";
     686
     687        std::cout << "8\n";
     688        for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::start(); it; ++it)
     689            std::cout << "Name: " << it->getName() << "\n";
     690
     691        std::cout << "9\n";
     692        for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::end(); it; --it)
     693            std::cout << "Name: " << it->getName() << "\n";
     694
     695        std::cout << "10\n";
     696        delete test10_10;
     697
     698        count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::start(); it != 0; ++it) { count++; }
     699        std::cout << "Anzahl BaseObjects: " << count << "\n";
     700        count = 0; for (Iterator<A1> it = ObjectList<A1>::start(); it != 0; ++it) { count++; }
     701        std::cout << "Anzahl A1: " << count << "\n";
     702        count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::start(); it; ++it) { count++; }
     703        std::cout << "Anzahl A1B1: " << count << "\n";
     704        count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::start(); it; ++it) { count++; }
     705        std::cout << "Anzahl A1B1C1: " << count << "\n";
     706        count = 0; for (Iterator<A2> it = ObjectList<A2>::start(); it; ++it) { count++; }
     707        std::cout << "Anzahl A2: " << count << "\n";
     708
     709        std::cout << "11\n";
     710        for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::start(); it; ++it)
     711            std::cout << "Name: " << it->getName() << "\n";
     712
     713        std::cout << "12\n";
     714        for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::end(); it; --it)
     715            std::cout << "Name: " << it->getName() << "\n";
     716
     717        std::cout << "13\n";
     718*/
     719        std::cout << "Test 11\n";
     720/*
     721        std::cout << "1\n";
     722        count = 0; for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) { count++; }
     723        std::cout << "AnzahlTickable: " << count << "\n";
     724
     725        Test1* test11_1;
     726        for (int i = 0; i < 3; i++)
     727            test11_1 = new Test1;
     728
     729        count = 0; for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) { count++; }
     730        std::cout << "AnzahlTickable: " << count << "\n";
     731
     732        for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it)
     733            it->tick(0);
     734
     735        std::cout << "2\n";
     736        Test2* test11_2 = new Test2;
     737*/
     738
     739        std::cout << "3\n";
     740        Test3* test11_3 = new Test3;
     741        test11_3->configOutput();
     742
     743        std::cout << "4\n";
     744/*
     745        std::cout << "Test 12\n";
     746        std::cout << "1\n";
     747
     748        WorldEntity* test12_1 = new WorldEntity;
     749
     750        std::cout << sizeof(WorldEntity) << std::endl;
     751
     752        std::cout << "2\n";
     753*/
     754
     755//    startRenderLoop();
    226756  }
    227757
  • code/branches/core/src/orxonox/core/ConfigValueContainer.cc

    r794 r797  
    5252        this->searchConfigFileLine();                                               // Search the entry in the config-file
    5353
    54         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
     54        std::string valueString = this->parseValueString(!(defvalue.isA(MT_string) || defvalue.isA(MT_constchar)));     // Parses the value string from the config-file-entry
    5555        if (!this->parseString(valueString, defvalue))                              // Try to convert the string to a value
    5656            this->resetConfigFileEntry();                                           // The conversion failed
     
    6565    bool ConfigValueContainer::valueToString(std::string* output, MultiTypeMath& input)
    6666    {
    67         if (this->value_.getType() == MT_int)
     67        if (input.getType() == MT_int)
    6868            return ConvertValue(output, input.getInt(), std::string("0"));
    69         else if (this->value_.getType() == MT_uint)
     69        else if (input.getType() == MT_uint)
    7070            return ConvertValue(output, input.getUnsignedInt(), std::string("0"));
    71         else if (this->value_.getType() == MT_char)
    72             return ConvertValue(output, input.getChar(), std::string("0"));
    73         else if (this->value_.getType() == MT_uchar)
    74             return ConvertValue(output, input.getUnsignedChar(), std::string("0"));
    75         else if (this->value_.getType() == MT_short)
     71        else if (input.getType() == MT_char)
     72            return ConvertValue(output, (int)input.getChar(), std::string("0"));
     73        else if (input.getType() == MT_uchar)
     74            return ConvertValue(output, (unsigned int)input.getUnsignedChar(), std::string("0"));
     75        else if (input.getType() == MT_short)
    7676            return ConvertValue(output, input.getShort(), std::string("0"));
    77         else if (this->value_.getType() == MT_ushort)
     77        else if (input.getType() == MT_ushort)
    7878            return ConvertValue(output, input.getUnsignedShort(), std::string("0"));
    79         else if (this->value_.getType() == MT_long)
     79        else if (input.getType() == MT_long)
    8080            return ConvertValue(output, input.getLong(), std::string("0"));
    81         else if (this->value_.getType() == MT_ulong)
     81        else if (input.getType() == MT_ulong)
    8282            return ConvertValue(output, input.getUnsignedLong(), std::string("0"));
    83         else if (this->value_.getType() == MT_float)
     83        else if (input.getType() == MT_float)
    8484            return ConvertValue(output, input.getFloat(), std::string("0.000000"));
    85         else if (this->value_.getType() == MT_double)
     85        else if (input.getType() == MT_double)
    8686            return ConvertValue(output, input.getDouble(), std::string("0.000000"));
    87         else if (this->value_.getType() == MT_longdouble)
     87        else if (input.getType() == MT_longdouble)
    8888            return ConvertValue(output, input.getChar(), std::string("0.000000"));
    89         else if (this->value_.getType() == MT_bool)
     89        else if (input.getType() == MT_bool)
    9090        {
    9191            if (input.getBool())
     
    9696            return true;
    9797        }
    98         else if (this->value_.getType() == MT_constchar)
     98        else if (input.getType() == MT_constchar)
    9999        {
    100100            (*output) = "\"" + input.getString() + "\"";
    101101            return true;
    102102        }
    103         else if (this->value_.getType() == MT_string)
     103        else if (input.getType() == MT_string)
    104104        {
    105105            (*output) = "\"" + input.getString() + "\"";
    106106            return true;
    107107        }
    108         else if (this->value_.getType() == MT_vector2)
     108        else if (input.getType() == MT_vector2)
    109109        {
    110110            std::ostringstream ostream;
     
    120120            }
    121121        }
    122         else if (this->value_.getType() == MT_vector3)
     122        else if (input.getType() == MT_vector3)
    123123        {
    124124            std::ostringstream ostream;
     
    134134            }
    135135        }
    136         else if (this->value_.getType() == MT_colourvalue)
     136        else if (input.getType() == MT_colourvalue)
    137137        {
    138138            std::ostringstream ostream;
     
    148148            }
    149149        }
    150         else if (this->value_.getType() == MT_quaternion)
     150        else if (input.getType() == MT_quaternion)
    151151        {
    152152            std::ostringstream ostream;
     
    162162            }
    163163        }
    164         else if (this->value_.getType() == MT_radian)
     164        else if (input.getType() == MT_radian)
    165165            return ConvertValue(output, input.getRadian(), std::string("0.000000"));
    166         else if (this->value_.getType() == MT_degree)
     166        else if (input.getType() == MT_degree)
    167167            return ConvertValue(output, input.getDegree(), std::string("0.000000"));
    168168
     
    177177    bool ConfigValueContainer::parseString(const std::string& input, MultiTypeMath& defvalue)
    178178    {
    179         if (this->value_.getType() == MT_int)
     179        if (defvalue.getType() == MT_int)
    180180            return this->parseString(input, defvalue.getInt());
    181         else if (this->value_.getType() == MT_uint)
     181        else if (defvalue.getType() == MT_uint)
    182182            return this->parseString(input, defvalue.getUnsignedInt());
    183         else if (this->value_.getType() == MT_char)
     183        else if (defvalue.getType() == MT_char)
    184184            return this->parseString(input, defvalue.getChar());
    185         else if (this->value_.getType() == MT_uchar)
     185        else if (defvalue.getType() == MT_uchar)
    186186            return this->parseString(input, defvalue.getUnsignedChar());
    187         else if (this->value_.getType() == MT_short)
     187        else if (defvalue.getType() == MT_short)
    188188            return this->parseString(input, defvalue.getShort());
    189         else if (this->value_.getType() == MT_ushort)
     189        else if (defvalue.getType() == MT_ushort)
    190190            return this->parseString(input, defvalue.getUnsignedShort());
    191         else if (this->value_.getType() == MT_long)
     191        else if (defvalue.getType() == MT_long)
    192192            return this->parseString(input, defvalue.getLong());
    193         else if (this->value_.getType() == MT_ulong)
     193        else if (defvalue.getType() == MT_ulong)
    194194            return this->parseString(input, defvalue.getUnsignedLong());
    195         else if (this->value_.getType() == MT_float)
     195        else if (defvalue.getType() == MT_float)
    196196            return this->parseString(input, defvalue.getFloat());
    197         else if (this->value_.getType() == MT_double)
     197        else if (defvalue.getType() == MT_double)
    198198            return this->parseString(input, defvalue.getDouble());
    199         else if (this->value_.getType() == MT_longdouble)
     199        else if (defvalue.getType() == MT_longdouble)
    200200            return this->parseString(input, defvalue.getLongDouble());
    201         else if (this->value_.getType() == MT_bool)
     201        else if (defvalue.getType() == MT_bool)
    202202            return this->parseString(input, defvalue.getBool());
    203         else if (this->value_.getType() == MT_constchar)
     203        else if (defvalue.getType() == MT_constchar)
    204204            return this->parseString(input, defvalue.getString());
    205         else if (this->value_.getType() == MT_string)
     205        else if (defvalue.getType() == MT_string)
    206206            return this->parseString(input, defvalue.getString());
    207         else if (this->value_.getType() == MT_vector2)
     207        else if (defvalue.getType() == MT_vector2)
    208208            return this->parseString(input, defvalue.getVector2());
    209         else if (this->value_.getType() == MT_vector3)
     209        else if (defvalue.getType() == MT_vector3)
    210210            return this->parseString(input, defvalue.getVector3());
    211         else if (this->value_.getType() == MT_colourvalue)
     211        else if (defvalue.getType() == MT_colourvalue)
    212212            return this->parseString(input, defvalue.getColourValue());
    213         else if (this->value_.getType() == MT_quaternion)
     213        else if (defvalue.getType() == MT_quaternion)
    214214            return this->parseString(input, defvalue.getQuaternion());
    215         else if (this->value_.getType() == MT_radian)
     215        else if (defvalue.getType() == MT_radian)
    216216            return this->parseString(input, defvalue.getRadian());
    217         else if (this->value_.getType() == MT_degree)
     217        else if (defvalue.getType() == MT_degree)
    218218            return this->parseString(input, defvalue.getDegree());
    219219
  • code/branches/core/src/orxonox/core/ConfigValueContainer.h

    r796 r797  
    9292            inline ConfigValueContainer& getValue(bool* value)           { this->value_.getValue(value); return *this; }
    9393            inline ConfigValueContainer& getValue(std::string* value)    { this->value_.getValue(value); return *this; }
     94            inline ConfigValueContainer& getValue(const char** value)    { this->value_.getValue(value); return *this; }
    9495            inline ConfigValueContainer& getValue(Vector2* value)        { this->value_.getValue(value); return *this; }
    9596            inline ConfigValueContainer& getValue(Vector3* value)        { this->value_.getValue(value); return *this; }
  • code/branches/core/src/orxonox/objects/test3.cc

    r793 r797  
    5151        SetConfigValue(value_bool_, 1);
    5252        SetConfigValue(value_string_, "This is a test");
    53 //        SetConfigValue(value_constchar_, "This is another test");
     53        SetConfigValue(value_constchar_, "This is another test");
    5454        SetConfigValue(value_vector2_, Vector2(101, 202));
    5555        SetConfigValue(value_vector3_, Vector3(13, 26, 39));
     
    6363    void Test3::configOutput()
    6464    {
    65         std::cout << this->value_int_ << std::endl;
    66         std::cout << this->value_uint_ << std::endl;
    67         std::cout << (int)this->value_char_ << std::endl;
    68         std::cout << (int)this->value_uchar_ << std::endl;
    69         std::cout << this->value_float_ << std::endl;
    70         std::cout << this->value_double_ << std::endl;
    71         std::cout << this->value_bool_ << std::endl;
    72         std::cout << this->value_string_ << std::endl;
    73         std::cout << this->value_constchar_ << std::endl;
    74         std::cout << this->value_vector2_ << std::endl;
    75         std::cout << this->value_vector3_ << std::endl;
    76         std::cout << this->value_colourvalue_ << std::endl;
     65        std::cout << "int:         " << this->value_int_ << std::endl;
     66        std::cout << "uint:        " << this->value_uint_ << std::endl;
     67        std::cout << "char:        " << (int)this->value_char_ << std::endl;
     68        std::cout << "uchar:       " << (int)this->value_uchar_ << std::endl;
     69        std::cout << "float:       " << this->value_float_ << std::endl;
     70        std::cout << "double:      " << this->value_double_ << std::endl;
     71        std::cout << "bool:        " << this->value_bool_ << std::endl;
     72        std::cout << "string:      " << this->value_string_ << std::endl;
     73        std::cout << "constchar:   " << this->value_constchar_ << std::endl;
     74        std::cout << "vector2:     " << this->value_vector2_ << std::endl;
     75        std::cout << "vector3:     " << this->value_vector3_ << std::endl;
     76        std::cout << "colourvalue: " << this->value_colourvalue_ << std::endl;
    7777    }
    7878
  • code/branches/core/src/util/MultiTypeMath.cc

    r794 r797  
    105105    this->value_ = mtm.value_;
    106106}
     107
     108std::ostream& operator<<(std::ostream& out, MultiTypeMath& mtm)
     109{
     110    if (mtm.isA(MT_vector2))
     111        out << mtm.getVector2();
     112    else if (mtm.isA(MT_vector3))
     113        out << mtm.getVector3();
     114    else if (mtm.isA(MT_colourvalue))
     115        out << mtm.getColourValue();
     116    else if (mtm.isA(MT_quaternion))
     117        out << mtm.getQuaternion();
     118    else if (mtm.isA(MT_radian))
     119        out << mtm.getRadian();
     120    else if (mtm.isA(MT_degree))
     121        out << mtm.getDegree();
     122    else
     123        out << ((MultiTypeString)mtm);
     124
     125    return out;
     126}
  • code/branches/core/src/util/MultiTypeMath.h

    r794 r797  
    121121};
    122122
     123std::ostream& operator<<(std::ostream& out, MultiTypeMath& mtm);
     124
    123125#endif /* _MultiTypeMath_H__ */
  • code/branches/core/src/util/MultiTypePrimitive.cc

    r792 r797  
    145145    this->value_ = mtp.value_;
    146146}
     147
     148std::ostream& operator<<(std::ostream& out, const MultiTypePrimitive& mtp)
     149{
     150    if (mtp.isA(MT_int))
     151        out << mtp.getInt();
     152    else if (mtp.isA(MT_uint))
     153        out << mtp.getUnsignedInt();
     154    else if (mtp.isA(MT_char))
     155        out << mtp.getChar();
     156    else if (mtp.isA(MT_uchar))
     157        out << mtp.getUnsignedChar();
     158    else if (mtp.isA(MT_short))
     159        out << mtp.getShort();
     160    else if (mtp.isA(MT_ushort))
     161        out << mtp.getUnsignedShort();
     162    else if (mtp.isA(MT_long))
     163        out << mtp.getLong();
     164    else if (mtp.isA(MT_ulong))
     165        out << mtp.getUnsignedLong();
     166    else if (mtp.isA(MT_float))
     167        out << mtp.getFloat();
     168    else if (mtp.isA(MT_double))
     169        out << mtp.getDouble();
     170    else if (mtp.isA(MT_longdouble))
     171        out << mtp.getLongDouble();
     172    else if (mtp.isA(MT_bool))
     173        out << mtp.getBool();
     174
     175    return out;
     176}
  • code/branches/core/src/util/MultiTypePrimitive.h

    r794 r797  
    2929#ifndef _MultiTypePrimitive_H__
    3030#define _MultiTypePrimitive_H__
     31
     32#include <ostream>
    3133
    3234#include "UtilPrereqs.h"
     
    142144};
    143145
     146std::ostream& operator<<(std::ostream& out, const MultiTypePrimitive& mtp);
     147
    144148#endif /* _MultiTypePrimitive_H__ */
  • code/branches/core/src/util/MultiTypeString.cc

    r794 r797  
    8181    this->value_ = mts.value_;
    8282}
     83
     84std::ostream& operator<<(std::ostream& out, MultiTypeString& mts)
     85{
     86    if (mts.isA(MT_constchar))
     87        out << mts.getConstChar();
     88    else if (mts.isA(MT_string))
     89        out << mts.getString();
     90    else
     91        out << ((MultiTypePrimitive)mts);
     92
     93    return out;
     94}
  • code/branches/core/src/util/MultiTypeString.h

    r794 r797  
    7676        void setValue(const MultiTypeString& mtp);
    7777
    78         inline std::string& getString() { return this->string_; }
     78        inline std::string& getString()    { return this->string_; }
     79        inline const char*  getConstChar() { return this->string_.c_str(); }
    7980
    8081        using MultiTypePrimitive::getValue;
    81         inline void getValue(std::string* variable) const { (*variable) = std::string(this->string_); }
     82        inline void getValue(std::string* variable) const { (*variable) = this->string_; }
     83        inline void getValue(const char** variable) const { (*variable) = this->string_.c_str(); }
    8284
    8385    protected:
     
    8587};
    8688
     89std::ostream& operator<<(std::ostream& out, MultiTypeString& mts);
     90
    8791#endif /* _MultiTypeString_H__ */
Note: See TracChangeset for help on using the changeset viewer.