- Timestamp:
- Feb 11, 2008, 3:29:16 AM (17 years ago)
- Location:
- code/branches/core/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core/src/orxonox/Orxonox.cc
r793 r797 76 76 #include "GraphicsEngine.h" 77 77 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 78 85 #include "Orxonox.h" 79 86 … … 223 230 break; 224 231 } 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(); 226 756 } 227 757 -
code/branches/core/src/orxonox/core/ConfigValueContainer.cc
r794 r797 52 52 this->searchConfigFileLine(); // Search the entry in the config-file 53 53 54 std::string valueString = this->parseValueString( );// Parses the value string from the config-file-entry54 std::string valueString = this->parseValueString(!(defvalue.isA(MT_string) || defvalue.isA(MT_constchar))); // Parses the value string from the config-file-entry 55 55 if (!this->parseString(valueString, defvalue)) // Try to convert the string to a value 56 56 this->resetConfigFileEntry(); // The conversion failed … … 65 65 bool ConfigValueContainer::valueToString(std::string* output, MultiTypeMath& input) 66 66 { 67 if ( this->value_.getType() == MT_int)67 if (input.getType() == MT_int) 68 68 return ConvertValue(output, input.getInt(), std::string("0")); 69 else if ( this->value_.getType() == MT_uint)69 else if (input.getType() == MT_uint) 70 70 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) 76 76 return ConvertValue(output, input.getShort(), std::string("0")); 77 else if ( this->value_.getType() == MT_ushort)77 else if (input.getType() == MT_ushort) 78 78 return ConvertValue(output, input.getUnsignedShort(), std::string("0")); 79 else if ( this->value_.getType() == MT_long)79 else if (input.getType() == MT_long) 80 80 return ConvertValue(output, input.getLong(), std::string("0")); 81 else if ( this->value_.getType() == MT_ulong)81 else if (input.getType() == MT_ulong) 82 82 return ConvertValue(output, input.getUnsignedLong(), std::string("0")); 83 else if ( this->value_.getType() == MT_float)83 else if (input.getType() == MT_float) 84 84 return ConvertValue(output, input.getFloat(), std::string("0.000000")); 85 else if ( this->value_.getType() == MT_double)85 else if (input.getType() == MT_double) 86 86 return ConvertValue(output, input.getDouble(), std::string("0.000000")); 87 else if ( this->value_.getType() == MT_longdouble)87 else if (input.getType() == MT_longdouble) 88 88 return ConvertValue(output, input.getChar(), std::string("0.000000")); 89 else if ( this->value_.getType() == MT_bool)89 else if (input.getType() == MT_bool) 90 90 { 91 91 if (input.getBool()) … … 96 96 return true; 97 97 } 98 else if ( this->value_.getType() == MT_constchar)98 else if (input.getType() == MT_constchar) 99 99 { 100 100 (*output) = "\"" + input.getString() + "\""; 101 101 return true; 102 102 } 103 else if ( this->value_.getType() == MT_string)103 else if (input.getType() == MT_string) 104 104 { 105 105 (*output) = "\"" + input.getString() + "\""; 106 106 return true; 107 107 } 108 else if ( this->value_.getType() == MT_vector2)108 else if (input.getType() == MT_vector2) 109 109 { 110 110 std::ostringstream ostream; … … 120 120 } 121 121 } 122 else if ( this->value_.getType() == MT_vector3)122 else if (input.getType() == MT_vector3) 123 123 { 124 124 std::ostringstream ostream; … … 134 134 } 135 135 } 136 else if ( this->value_.getType() == MT_colourvalue)136 else if (input.getType() == MT_colourvalue) 137 137 { 138 138 std::ostringstream ostream; … … 148 148 } 149 149 } 150 else if ( this->value_.getType() == MT_quaternion)150 else if (input.getType() == MT_quaternion) 151 151 { 152 152 std::ostringstream ostream; … … 162 162 } 163 163 } 164 else if ( this->value_.getType() == MT_radian)164 else if (input.getType() == MT_radian) 165 165 return ConvertValue(output, input.getRadian(), std::string("0.000000")); 166 else if ( this->value_.getType() == MT_degree)166 else if (input.getType() == MT_degree) 167 167 return ConvertValue(output, input.getDegree(), std::string("0.000000")); 168 168 … … 177 177 bool ConfigValueContainer::parseString(const std::string& input, MultiTypeMath& defvalue) 178 178 { 179 if ( this->value_.getType() == MT_int)179 if (defvalue.getType() == MT_int) 180 180 return this->parseString(input, defvalue.getInt()); 181 else if ( this->value_.getType() == MT_uint)181 else if (defvalue.getType() == MT_uint) 182 182 return this->parseString(input, defvalue.getUnsignedInt()); 183 else if ( this->value_.getType() == MT_char)183 else if (defvalue.getType() == MT_char) 184 184 return this->parseString(input, defvalue.getChar()); 185 else if ( this->value_.getType() == MT_uchar)185 else if (defvalue.getType() == MT_uchar) 186 186 return this->parseString(input, defvalue.getUnsignedChar()); 187 else if ( this->value_.getType() == MT_short)187 else if (defvalue.getType() == MT_short) 188 188 return this->parseString(input, defvalue.getShort()); 189 else if ( this->value_.getType() == MT_ushort)189 else if (defvalue.getType() == MT_ushort) 190 190 return this->parseString(input, defvalue.getUnsignedShort()); 191 else if ( this->value_.getType() == MT_long)191 else if (defvalue.getType() == MT_long) 192 192 return this->parseString(input, defvalue.getLong()); 193 else if ( this->value_.getType() == MT_ulong)193 else if (defvalue.getType() == MT_ulong) 194 194 return this->parseString(input, defvalue.getUnsignedLong()); 195 else if ( this->value_.getType() == MT_float)195 else if (defvalue.getType() == MT_float) 196 196 return this->parseString(input, defvalue.getFloat()); 197 else if ( this->value_.getType() == MT_double)197 else if (defvalue.getType() == MT_double) 198 198 return this->parseString(input, defvalue.getDouble()); 199 else if ( this->value_.getType() == MT_longdouble)199 else if (defvalue.getType() == MT_longdouble) 200 200 return this->parseString(input, defvalue.getLongDouble()); 201 else if ( this->value_.getType() == MT_bool)201 else if (defvalue.getType() == MT_bool) 202 202 return this->parseString(input, defvalue.getBool()); 203 else if ( this->value_.getType() == MT_constchar)203 else if (defvalue.getType() == MT_constchar) 204 204 return this->parseString(input, defvalue.getString()); 205 else if ( this->value_.getType() == MT_string)205 else if (defvalue.getType() == MT_string) 206 206 return this->parseString(input, defvalue.getString()); 207 else if ( this->value_.getType() == MT_vector2)207 else if (defvalue.getType() == MT_vector2) 208 208 return this->parseString(input, defvalue.getVector2()); 209 else if ( this->value_.getType() == MT_vector3)209 else if (defvalue.getType() == MT_vector3) 210 210 return this->parseString(input, defvalue.getVector3()); 211 else if ( this->value_.getType() == MT_colourvalue)211 else if (defvalue.getType() == MT_colourvalue) 212 212 return this->parseString(input, defvalue.getColourValue()); 213 else if ( this->value_.getType() == MT_quaternion)213 else if (defvalue.getType() == MT_quaternion) 214 214 return this->parseString(input, defvalue.getQuaternion()); 215 else if ( this->value_.getType() == MT_radian)215 else if (defvalue.getType() == MT_radian) 216 216 return this->parseString(input, defvalue.getRadian()); 217 else if ( this->value_.getType() == MT_degree)217 else if (defvalue.getType() == MT_degree) 218 218 return this->parseString(input, defvalue.getDegree()); 219 219 -
code/branches/core/src/orxonox/core/ConfigValueContainer.h
r796 r797 92 92 inline ConfigValueContainer& getValue(bool* value) { this->value_.getValue(value); return *this; } 93 93 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; } 94 95 inline ConfigValueContainer& getValue(Vector2* value) { this->value_.getValue(value); return *this; } 95 96 inline ConfigValueContainer& getValue(Vector3* value) { this->value_.getValue(value); return *this; } -
code/branches/core/src/orxonox/objects/test3.cc
r793 r797 51 51 SetConfigValue(value_bool_, 1); 52 52 SetConfigValue(value_string_, "This is a test"); 53 //SetConfigValue(value_constchar_, "This is another test");53 SetConfigValue(value_constchar_, "This is another test"); 54 54 SetConfigValue(value_vector2_, Vector2(101, 202)); 55 55 SetConfigValue(value_vector3_, Vector3(13, 26, 39)); … … 63 63 void Test3::configOutput() 64 64 { 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; 77 77 } 78 78 -
code/branches/core/src/util/MultiTypeMath.cc
r794 r797 105 105 this->value_ = mtm.value_; 106 106 } 107 108 std::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 121 121 }; 122 122 123 std::ostream& operator<<(std::ostream& out, MultiTypeMath& mtm); 124 123 125 #endif /* _MultiTypeMath_H__ */ -
code/branches/core/src/util/MultiTypePrimitive.cc
r792 r797 145 145 this->value_ = mtp.value_; 146 146 } 147 148 std::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 29 29 #ifndef _MultiTypePrimitive_H__ 30 30 #define _MultiTypePrimitive_H__ 31 32 #include <ostream> 31 33 32 34 #include "UtilPrereqs.h" … … 142 144 }; 143 145 146 std::ostream& operator<<(std::ostream& out, const MultiTypePrimitive& mtp); 147 144 148 #endif /* _MultiTypePrimitive_H__ */ -
code/branches/core/src/util/MultiTypeString.cc
r794 r797 81 81 this->value_ = mts.value_; 82 82 } 83 84 std::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 76 76 void setValue(const MultiTypeString& mtp); 77 77 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(); } 79 80 80 81 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(); } 82 84 83 85 protected: … … 85 87 }; 86 88 89 std::ostream& operator<<(std::ostream& out, MultiTypeString& mts); 90 87 91 #endif /* _MultiTypeString_H__ */
Note: See TracChangeset
for help on using the changeset viewer.