Changeset 874 for code/branches/core2/src
- Timestamp:
- Mar 9, 2008, 5:32:54 PM (17 years ago)
- Location:
- code/branches/core2/src/orxonox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/Orxonox.cc
r873 r874 76 76 //#include "objects/weapon/BulletManager.h" 77 77 #include "GraphicsEngine.h" 78 79 #include "core/ClassTreeMask.h" 80 #include "objects/WorldEntity.h" 81 #include "core/DebugLevel.h" 82 #include "core/BaseObject.h" 83 #include "objects/Test.h" 84 #include "objects/test1.h" 85 #include "objects/test2.h" 86 #include "objects/test3.h" 78 87 79 88 #include "Orxonox.h" … … 224 233 break; 225 234 } 235 236 #define testandcout(code) \ 237 std::cout << #code << " " << code << "\n" 238 /* 239 std::cout << "Test 1\n"; 240 BaseObject* test1; 241 test1 = new BaseObject(); 242 test1 = new BaseObject(); 243 test1 = new BaseObject(); 244 245 std::cout << "Test 2\n"; 246 A1* test2; 247 test2 = new A1(); 248 test2 = new A1(); 249 test2 = new A1(); 250 251 std::cout << "Test 3\n"; 252 BaseObject* test3; 253 test3 = new BaseObject(); 254 test3 = new BaseObject(); 255 test3 = new BaseObject(); 256 257 std::cout << "Test 4\n"; 258 A3* test4; 259 test4 = new A3(); 260 test4 = new A3(); 261 test4 = new A3(); 262 263 264 std::cout << "Test 5\n"; 265 A1* test5_01 = new A1(); 266 A2* test5_02 = new A2(); 267 A3* test5_03 = new A3(); 268 A1B1* test5_04 = new A1B1(); 269 A1B2* test5_05 = new A1B2(); 270 A2B1* test5_06 = new A2B1(); 271 A2B2* test5_07 = new A2B2(); 272 A3B1* test5_08 = new A3B1(); 273 A3B2* test5_09 = new A3B2(); 274 A1B1C1* test5_10 = new A1B1C1(); 275 A1B1C2* test5_11 = new A1B1C2(); 276 A1B2C1* test5_12 = new A1B2C1(); 277 A2B1C1* test5_13 = new A2B1C1(); 278 A2B2C1* test5_14 = new A2B2C1(); 279 A3B1C1* test5_15 = new A3B1C1(); 280 A3B1C2* test5_16 = new A3B1C2(); 281 A3B2C1* test5_17 = new A3B2C1(); 282 A3B2C2* test5_18 = new A3B2C2(); 283 */ 284 /* 285 OrxonoxClass* test5 = 0; 286 for (int i = 0; i <= 18; i++) 287 { 288 if (i == 0) test5 = new BaseObject; 289 if (i == 1) test5 = test5_01; 290 if (i == 2) test5 = test5_02; 291 if (i == 3) test5 = test5_03; 292 if (i == 4) test5 = test5_04; 293 if (i == 5) test5 = test5_05; 294 if (i == 6) test5 = test5_06; 295 if (i == 7) test5 = test5_07; 296 if (i == 8) test5 = test5_08; 297 if (i == 9) test5 = test5_09; 298 if (i == 10) test5 = test5_10; 299 if (i == 11) test5 = test5_11; 300 if (i == 12) test5 = test5_12; 301 if (i == 13) test5 = test5_13; 302 if (i == 14) test5 = test5_14; 303 if (i == 15) test5 = test5_15; 304 if (i == 16) test5 = test5_16; 305 if (i == 17) test5 = test5_17; 306 if (i == 18) test5 = test5_18; 307 308 std::cout << "\n"; 309 std::cout << test5->getIdentifier()->getName() << " (" << test5->getIdentifier()->getNetworkID() << "): parents: " << test5->getIdentifier()->getParents() << "\n"; 310 std::cout << test5->getIdentifier()->getName() << " (" << test5->getIdentifier()->getNetworkID() << "): children: " << test5->getIdentifier()->getChildren() << "\n"; 311 std::cout << test5->getIdentifier()->getName() << " (" << test5->getIdentifier()->getNetworkID() << "): direct parents: " << test5->getIdentifier()->getDirectParents() << "\n"; 312 std::cout << test5->getIdentifier()->getName() << " (" << test5->getIdentifier()->getNetworkID() << "): direct children: " << test5->getIdentifier()->getDirectChildren() << "\n"; 313 } 314 */ 315 /* 316 for (std::map<std::string, Identifier*>::const_iterator it = Factory::getFactoryBegin(); it != Factory::getFactoryEnd(); ++it) 317 std::cout << "Class with ID " << (*it).second->getNetworkID() << ": " << ID((*it).second->getNetworkID()) << " / " << ID((*it).second->getNetworkID())->getName() << std::endl; 318 319 std::cout << "Class with ID 100: " << ID(100) << "\n"; 320 std::cout << "ID of BaseObject: " << Class(BaseObject)->getNetworkID() << "\n"; 321 322 std::cout << "\nChange ID of BaseObject to 100\n"; 323 Class(BaseObject)->setNetworkID(100); 324 std::cout << "Class with ID 100: " << ID(100) << "\n"; 325 std::cout << "Class with ID 1: " << ID(1) << "\n"; 326 std::cout << "ID of BaseObject: " << Class(BaseObject)->getNetworkID() << "\n"; 327 328 std::cout << "\nChange ID of BaseObject to 3\n"; 329 Class(BaseObject)->setNetworkID(3); 330 std::cout << "Class with ID 100: " << ID(100) << "\n"; 331 std::cout << "Class with ID 1: " << ID(1) << "\n"; 332 std::cout << "Class with ID 3: " << ID(3) << "\n"; 333 std::cout << "ID of BaseObject: " << Class(BaseObject)->getNetworkID() << "\n"; 334 std::cout << "ID of Test1: " << Class(Test1)->getNetworkID() << "\n"; 335 */ 336 /* 337 std::cout << "\n"; 338 std::cout << "isA(XYZ)-Test:\n"; 339 std::cout << "test5_01 = A1, Erwartet: 1 0 0 1 0\n"; 340 testandcout(test5_01->isA(Class(A1))); 341 testandcout(test5_01->isA(Class(A2))); 342 testandcout(test5_01->isA(Class(A1B1))); 343 testandcout(test5_01->isA(Class(BaseObject))); 344 testandcout(test5_01->isA(Class(Interface1))); 345 346 std::cout << "\n"; 347 std::cout << "test5_02 = A2, Erwartet: 0 1 0 1 0\n"; 348 testandcout(test5_02->isA(Class(A1))); 349 testandcout(test5_02->isA(Class(A2))); 350 testandcout(test5_02->isA(Class(A1B1))); 351 testandcout(test5_02->isA(Class(BaseObject))); 352 testandcout(test5_02->isA(Class(Interface1))); 353 354 std::cout << "\n"; 355 std::cout << "test5_01 = A3, Erwartet: 0 0 0 1 1\n"; 356 testandcout(test5_03->isA(Class(A1))); 357 testandcout(test5_03->isA(Class(A2))); 358 testandcout(test5_03->isA(Class(A1B1))); 359 testandcout(test5_03->isA(Class(BaseObject))); 360 testandcout(test5_03->isA(Class(Interface1))); 361 362 std::cout << "\n"; 363 std::cout << "isDirectA(XYZ)-Test:\n"; 364 std::cout << "test5_01 = A1, Erwartet: 1 0 0 0 0\n"; 365 testandcout(test5_01->isExactlyA(Class(A1))); 366 testandcout(test5_01->isExactlyA(Class(A2))); 367 testandcout(test5_01->isExactlyA(Class(A1B1))); 368 testandcout(test5_01->isExactlyA(Class(BaseObject))); 369 testandcout(test5_01->isExactlyA(Class(Interface1))); 370 371 std::cout << "\n"; 372 std::cout << "test5_02 = A2, Erwartet: 0 1 0 0 0\n"; 373 testandcout(test5_02->isExactlyA(Class(A1))); 374 testandcout(test5_02->isExactlyA(Class(A2))); 375 testandcout(test5_02->isExactlyA(Class(A1B1))); 376 testandcout(test5_02->isExactlyA(Class(BaseObject))); 377 testandcout(test5_02->isExactlyA(Class(Interface1))); 378 379 std::cout << "\n"; 380 std::cout << "test5_03 = A3, Erwartet: 0 0 0 0 0\n"; 381 testandcout(test5_03->isExactlyA(Class(A1))); 382 testandcout(test5_03->isExactlyA(Class(A2))); 383 testandcout(test5_03->isExactlyA(Class(A1B1))); 384 testandcout(test5_03->isExactlyA(Class(BaseObject))); 385 testandcout(test5_03->isExactlyA(Class(Interface1))); 386 387 std::cout << "\n"; 388 std::cout << "isChildOf(XYZ)-Test:\n"; 389 std::cout << "test5_04 = A1B1, Erwartet: 1 0 1 0 0 0 0\n"; 390 testandcout(test5_04->isChildOf(Class(A1))); 391 testandcout(test5_04->isChildOf(Class(A2))); 392 testandcout(test5_04->isChildOf(Class(BaseObject))); 393 testandcout(test5_04->isChildOf(Class(Interface1))); 394 testandcout(test5_04->isChildOf(Class(Interface2))); 395 testandcout(test5_04->isChildOf(Class(A1B1C2))); 396 testandcout(test5_04->isChildOf(Class(A1B1))); 397 398 std::cout << "\n"; 399 std::cout << "test5_06 = A2B1, Erwartet: 0 1 1 0 0 0 0\n"; 400 testandcout(test5_06->isChildOf(Class(A1))); 401 testandcout(test5_06->isChildOf(Class(A2))); 402 testandcout(test5_06->isChildOf(Class(BaseObject))); 403 testandcout(test5_06->isChildOf(Class(Interface1))); 404 testandcout(test5_06->isChildOf(Class(Interface2))); 405 testandcout(test5_06->isChildOf(Class(A1B1C2))); 406 testandcout(test5_06->isChildOf(Class(A1B1))); 407 408 std::cout << "\n"; 409 std::cout << "test5_07 = A2B2, Erwartet: 0 1 1 1 0 0\n"; 410 testandcout(test5_07->isChildOf(Class(A1))); 411 testandcout(test5_07->isChildOf(Class(A2))); 412 testandcout(test5_07->isChildOf(Class(BaseObject))); 413 testandcout(test5_07->isChildOf(Class(Interface1))); 414 testandcout(test5_07->isChildOf(Class(Interface2))); 415 testandcout(test5_07->isChildOf(Class(A1B1C2))); 416 417 std::cout << "\n"; 418 std::cout << "test5_08 = A3B1, Erwartet: 0 0 1 1 0 0\n"; 419 testandcout(test5_08->isChildOf(Class(A1))); 420 testandcout(test5_08->isChildOf(Class(A2))); 421 testandcout(test5_08->isChildOf(Class(BaseObject))); 422 testandcout(test5_08->isChildOf(Class(Interface1))); 423 testandcout(test5_08->isChildOf(Class(Interface2))); 424 testandcout(test5_08->isChildOf(Class(A1B1C2))); 425 426 std::cout << "\n"; 427 std::cout << "test5_09 = A3B2, Erwartet: 0 0 1 1 1 0\n"; 428 testandcout(test5_09->isChildOf(Class(A1))); 429 testandcout(test5_09->isChildOf(Class(A2))); 430 testandcout(test5_09->isChildOf(Class(BaseObject))); 431 testandcout(test5_09->isChildOf(Class(Interface1))); 432 testandcout(test5_09->isChildOf(Class(Interface2))); 433 testandcout(test5_09->isChildOf(Class(A1B1C2))); 434 435 std::cout << "\n"; 436 std::cout << "isDirectChildOf(XYZ)-Test:\n"; 437 std::cout << "test5_04 = A1B1, Erwartet: 1 0 0 0 0 0 0\n"; 438 testandcout(test5_04->isDirectChildOf(Class(A1))); 439 testandcout(test5_04->isDirectChildOf(Class(A2))); 440 testandcout(test5_04->isDirectChildOf(Class(BaseObject))); 441 testandcout(test5_04->isDirectChildOf(Class(Interface1))); 442 testandcout(test5_04->isDirectChildOf(Class(Interface2))); 443 testandcout(test5_04->isDirectChildOf(Class(A1B1C2))); 444 testandcout(test5_04->isDirectChildOf(Class(A1B1))); 445 446 std::cout << "\n"; 447 std::cout << "test5_06 = A2B1, Erwartet: 0 1 0 0 0 0 0\n"; 448 testandcout(test5_06->isDirectChildOf(Class(A1))); 449 testandcout(test5_06->isDirectChildOf(Class(A2))); 450 testandcout(test5_06->isDirectChildOf(Class(BaseObject))); 451 testandcout(test5_06->isDirectChildOf(Class(Interface1))); 452 testandcout(test5_06->isDirectChildOf(Class(Interface2))); 453 testandcout(test5_06->isDirectChildOf(Class(A1B1C2))); 454 testandcout(test5_06->isDirectChildOf(Class(A1B1))); 455 456 std::cout << "\n"; 457 std::cout << "test5_07 = A2B2, Erwartet: 0 1 0 1 0 0\n"; 458 testandcout(test5_07->isDirectChildOf(Class(A1))); 459 testandcout(test5_07->isDirectChildOf(Class(A2))); 460 testandcout(test5_07->isDirectChildOf(Class(BaseObject))); 461 testandcout(test5_07->isDirectChildOf(Class(Interface1))); 462 testandcout(test5_07->isDirectChildOf(Class(Interface2))); 463 testandcout(test5_07->isDirectChildOf(Class(A1B1C2))); 464 465 std::cout << "\n"; 466 std::cout << "test5_08 = A3B1, Erwartet: 0 0 0 0 0 0\n"; 467 testandcout(test5_08->isDirectChildOf(Class(A1))); 468 testandcout(test5_08->isDirectChildOf(Class(A2))); 469 testandcout(test5_08->isDirectChildOf(Class(BaseObject))); 470 testandcout(test5_08->isDirectChildOf(Class(Interface1))); 471 testandcout(test5_08->isDirectChildOf(Class(Interface2))); 472 testandcout(test5_08->isDirectChildOf(Class(A1B1C2))); 473 474 std::cout << "\n"; 475 std::cout << "test5_09 = A3B2, Erwartet: 0 0 0 0 1 0\n"; 476 testandcout(test5_09->isDirectChildOf(Class(A1))); 477 testandcout(test5_09->isDirectChildOf(Class(A2))); 478 testandcout(test5_09->isDirectChildOf(Class(BaseObject))); 479 testandcout(test5_09->isDirectChildOf(Class(Interface1))); 480 testandcout(test5_09->isDirectChildOf(Class(Interface2))); 481 testandcout(test5_09->isDirectChildOf(Class(A1B1C2))); 482 483 std::cout << "\n"; 484 485 std::cout << "isParentOf(XYZ)-Test:\n"; 486 std::cout << "test1 = BaseObject, Erwartet: 0 0 1 1 1 1 1\n"; 487 testandcout(test1->isParentOf(Class(BaseObject))); 488 testandcout(test1->isParentOf(Class(Interface1))); 489 testandcout(test1->isParentOf(Class(A1))); 490 testandcout(test1->isParentOf(Class(A2))); 491 testandcout(test1->isParentOf(Class(A1B1))); 492 testandcout(test1->isParentOf(Class(A2B2))); 493 testandcout(test1->isParentOf(Class(A3B1C2))); 494 495 std::cout << "\n"; 496 std::cout << "test5_01 = A1, Erwartet: 0 0 0 0 1 0 0\n"; 497 testandcout(test5_01->isParentOf(Class(BaseObject))); 498 testandcout(test5_01->isParentOf(Class(Interface1))); 499 testandcout(test5_01->isParentOf(Class(A1))); 500 testandcout(test5_01->isParentOf(Class(A2))); 501 testandcout(test5_01->isParentOf(Class(A1B1))); 502 testandcout(test5_01->isParentOf(Class(A2B2))); 503 testandcout(test5_01->isParentOf(Class(A3B1C2))); 504 505 std::cout << "\n"; 506 std::cout << "Interface1, Erwartet: 0 0 0 0 0 1 1\n"; 507 testandcout(Class(Interface1)->isParentOf(Class(BaseObject))); 508 testandcout(Class(Interface1)->isParentOf(Class(Interface1))); 509 testandcout(Class(Interface1)->isParentOf(Class(A1))); 510 testandcout(Class(Interface1)->isParentOf(Class(A2))); 511 testandcout(Class(Interface1)->isParentOf(Class(A1B1))); 512 testandcout(Class(Interface1)->isParentOf(Class(A2B2))); 513 testandcout(Class(Interface1)->isParentOf(Class(A3B1C2))); 514 515 std::cout << "\n"; 516 std::cout << "isDirectParentOf(XYZ)-Test:\n"; 517 std::cout << "test1 = BaseObject, Erwartet: 0 0 1 1 0 0 0\n"; 518 testandcout(test1->isDirectParentOf(Class(BaseObject))); 519 testandcout(test1->isDirectParentOf(Class(Interface1))); 520 testandcout(test1->isDirectParentOf(Class(A1))); 521 testandcout(test1->isDirectParentOf(Class(A2))); 522 testandcout(test1->isDirectParentOf(Class(A1B1))); 523 testandcout(test1->isDirectParentOf(Class(A2B2))); 524 testandcout(test1->isDirectParentOf(Class(A3B1C2))); 525 526 std::cout << "\n"; 527 std::cout << "test5_01 = A1, Erwartet: 0 0 0 0 1 0 0\n"; 528 testandcout(test5_01->isDirectParentOf(Class(BaseObject))); 529 testandcout(test5_01->isDirectParentOf(Class(Interface1))); 530 testandcout(test5_01->isDirectParentOf(Class(A1))); 531 testandcout(test5_01->isDirectParentOf(Class(A2))); 532 testandcout(test5_01->isDirectParentOf(Class(A1B1))); 533 testandcout(test5_01->isDirectParentOf(Class(A2B2))); 534 testandcout(test5_01->isDirectParentOf(Class(A3B1C2))); 535 536 std::cout << "\n"; 537 std::cout << "Interface1, Erwartet: 0 0 0 0 0 1 0\n"; 538 testandcout(Class(Interface1)->isDirectParentOf(Class(BaseObject))); 539 testandcout(Class(Interface1)->isDirectParentOf(Class(Interface1))); 540 testandcout(Class(Interface1)->isDirectParentOf(Class(A1))); 541 testandcout(Class(Interface1)->isDirectParentOf(Class(A2))); 542 testandcout(Class(Interface1)->isDirectParentOf(Class(A1B1))); 543 testandcout(Class(Interface1)->isDirectParentOf(Class(A2B2))); 544 testandcout(Class(Interface1)->isDirectParentOf(Class(A3B1C2))); 545 */ 546 /* 547 std::cout << "Test 6\n"; 548 std::cout << "1\n"; 549 Identifier* test6_01 = Class(A1B1); 550 std::cout << "2\n"; 551 Identifier* test6_02 = Class(A1B1); 552 std::cout << "3\n"; 553 Identifier* test6_03 = Class(A1); 554 std::cout << "4\n"; 555 Identifier* test6_04 = Class(A1B1C1); 556 std::cout << "5\n"; 557 Identifier* test6_05 = Class(A1B1); 558 std::cout << "6\n"; 559 Identifier* test6_06 = Class(A1B1C1); 560 561 std::cout << "7\n"; 562 563 std::cout << "\n"; 564 std::cout << "BaseObject: parents: " << Class(BaseObject)->getParents() << "\n"; 565 std::cout << "BaseObject: children: " << Class(BaseObject)->getChildren() << "\n"; 566 std::cout << "BaseObject: direct parents: " << Class(BaseObject)->getDirectParents() << "\n"; 567 std::cout << "BaseObject: direct children: " << Class(BaseObject)->getDirectChildren() << "\n"; 568 569 std::cout << "\n"; 570 std::cout << "A1: parents: " << Class(A1)->getParents() << "\n"; 571 std::cout << "A1: children: " << Class(A1)->getChildren() << "\n"; 572 std::cout << "A1: direct parents: " << Class(A1)->getDirectParents() << "\n"; 573 std::cout << "A1: direct children: " << Class(A1)->getDirectChildren() << "\n"; 574 575 std::cout << "\n"; 576 std::cout << "A1B1: parents: " << Class(A1B1)->getParents() << "\n"; 577 std::cout << "A1B1: children: " << Class(A1B1)->getChildren() << "\n"; 578 std::cout << "A1B1: direct parents: " << Class(A1B1)->getDirectParents() << "\n"; 579 std::cout << "A1B1: direct children: " << Class(A1B1)->getDirectChildren() << "\n"; 580 581 std::cout << "\n"; 582 std::cout << "A1B1C1: parents: " << Class(A1B1C1)->getParents() << "\n"; 583 std::cout << "A1B1C1: children: " << Class(A1B1C1)->getChildren() << "\n"; 584 std::cout << "A1B1C1: direct parents: " << Class(A1B1C1)->getDirectParents() << "\n"; 585 std::cout << "A1B1C1: direct children: " << Class(A1B1C1)->getDirectChildren() << "\n"; 586 587 std::cout << "\n"; 588 std::cout << "A3B1C1 child of A3: " << Class(A3B1C1)->isChildOf(Class(A3)) << "\n"; 589 std::cout << "\n"; 590 std::cout << "A2 parent of A2B1C1: " << Class(A2)->isParentOf(Class(A2B1C1)) << "\n"; 591 592 std::cout << "8\n"; 593 */ 594 /* 595 std::cout << "Test 7\n"; 596 std::cout << "1\n"; 597 SubclassIdentifier<A1B1> test7_01; 598 test7_01 = Class(A1B1C1); 599 600 SubclassIdentifier<A1B1> test7_02; 601 test7_02 = Class(A1B1); 602 603 std::cout << test7_01->getName() << "\n"; 604 std::cout << test7_02->getName() << "\n"; 605 */ 606 /* 607 // ## WARNING - CRASH! ## 608 std::cout << "2\n"; 609 610 SubclassIdentifier<A1B1> test7_03; 611 test7_03 = Class(A1); 612 613 SubclassIdentifier<A1B1> test7_04; 614 test7_04 = Class(A1B2); 615 616 SubclassIdentifier<A1B1> test7_05; 617 test7_05 = Class(A2); 618 // ## END WARNING - CRASH! ## 619 */ 620 /* 621 std::cout << "Test 8\n"; 622 623 std::cout << "1\n"; 624 Test1* test8_01 = new Test1; 625 Test3* test8_03 = new Test3; 626 test8_03->usefullClassesIsATest(test8_01); 627 628 std::cout << "2\n"; 629 Test2* test8_02 = new Test2; 630 test8_03->usefullClassesIsATest(test8_02); 631 632 std::cout << "3\n"; 633 test8_01->setUsefullClass1(Class(Test1)); 634 test8_01->setUsefullClass1(test8_02->getIdentifier()); 635 test8_01->setUsefullClass2(Class(Test2)); 636 test8_01->setUsefullClassOfTypeTest3(Class(Test3)); 637 test8_01->setUsefullClassOfTypeTest3(test8_03->getIdentifier()); 638 639 640 testandcout(test8_01->isA(Class(Test1))); 641 testandcout(test8_01->isA(Class(Test2))); 642 testandcout(test8_01->isA(Class(Test3))); 643 644 Test2* test8_04 = new Test2; 645 testandcout(test8_02->isA(Class(Test1))); 646 testandcout(test8_02->isA(Class(Test2))); 647 testandcout(test8_02->isA(Class(Test3))); 648 649 Test3* test8_05 = new Test3; 650 testandcout(test8_03->isA(Class(Test1))); 651 testandcout(test8_03->isA(Class(Test2))); 652 testandcout(test8_03->isA(Class(Test3))); 653 654 delete test8_01; 655 delete test8_02; 656 delete test8_03; 657 */ 658 /* 659 std::cout << "Test 9\n"; 660 std::cout << "1\n"; 661 Identifier* test9_01 = Class(A3); 662 BaseObject* test9_02 = test9_01->fabricate(); 663 std::cout << test9_02->getIdentifier()->getName() << "\n"; 664 665 std::cout << "\n2\n"; 666 BaseObject* test9_03 = Class(A1B2)->fabricate(); 667 std::cout << test9_03->getIdentifier()->getName() << "\n"; 668 669 std::cout << "\n3\n"; 670 SubclassIdentifier<A1> test9_04; 671 test9_04 = Class(A1B1C1); 672 A1* test9_05 = test9_04.fabricate(); 673 std::cout << test9_05->getIdentifier()->getName() << "\n"; 674 675 std::cout << "\n4\n"; 676 BaseObject* test9_06 = ID("A2B2")->fabricate(); 677 std::cout << test9_06->getIdentifier()->getName() << "\n"; 678 679 std::cout << "\n5\n"; 680 delete test9_02; 681 delete test9_03; 682 delete test9_05; 683 delete test9_06; 684 */ 685 /* 686 std::cout << "Test 10\n"; 687 Identifier* test10_01 = Class(A1B2); 688 Identifier* test10_02 = Class(A2); 689 Identifier* test10_03 = Class(A3B1C1); 690 691 BaseObject* test10_04 = test10_01->fabricate(); 692 BaseObject* test10_05 = test10_02->fabricate(); 693 BaseObject* test10_06 = test10_03->fabricate(); 694 695 BaseObject* test10_07; 696 for (int i = 0; i < 10; i++) 697 test10_07 = ID("A1B1C1")->fabricate(); 698 699 std::cout << "1\n"; 700 int count; 701 702 count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::start(); it; ++it) { count++; } 703 std::cout << "Anzahl BaseObjects: " << count << "\n"; 704 count = 0; for (Iterator<A1> it = ObjectList<A1>::start(); it; ++it) { count++; } 705 std::cout << "Anzahl A1: " << count << "\n"; 706 count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::start(); it; ++it) { count++; } 707 std::cout << "Anzahl A1B1: " << count << "\n"; 708 count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::start(); it; ++it) { count++; } 709 std::cout << "Anzahl A1B1C1: " << count << "\n"; 710 count = 0; for (Iterator<A2> it = ObjectList<A2>::start(); it; ++it) { count++; } 711 std::cout << "Anzahl A2: " << count << "\n"; 712 713 std::cout << "2\n"; 714 BaseObject* test10_08; 715 BaseObject* test10_09 = 0; 716 BaseObject* test10_10 = 0; 717 for (int i = 0; i < 10; i++) 718 { 719 test10_08 = ID("A2B1C1")->fabricate(); 720 std::string objName = "A2B1C1#"; 721 objName += '0' + i; 722 test10_08->setName(objName); 723 724 if (i == 0) 725 test10_09 = test10_08; 726 727 if (i == 5) 728 test10_10 = test10_08; 729 } 730 731 count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::start(); it; ++it) { count++; } 732 std::cout << "Anzahl BaseObjects: " << count << "\n"; 733 count = 0; for (Iterator<A1> it = ObjectList<A1>::start(); it; ++it) { count++; } 734 std::cout << "Anzahl A1: " << count << "\n"; 735 count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::start(); it; ++it) { count++; } 736 std::cout << "Anzahl A1B1: " << count << "\n"; 737 count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::start(); it; ++it) { count++; } 738 std::cout << "Anzahl A1B1C1: " << count << "\n"; 739 count = 0; for (Iterator<A2> it = ObjectList<A2>::start(); it; ++it) { count++; } 740 std::cout << "Anzahl A2: " << count << "\n"; 741 742 for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::start(); it; ++it) 743 std::cout << "Name: " << it->getName() << "\n"; 744 745 std::cout << "3\n"; 746 for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::end(); it; --it) 747 std::cout << "Name: " << it->getName() << "\n"; 748 749 std::cout << "4\n"; 750 delete test10_08; 751 752 count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::start(); it; ++it) { count++; } 753 std::cout << "Anzahl BaseObjects: " << count << "\n"; 754 count = 0; for (Iterator<A1> it = ObjectList<A1>::start(); it; ++it) { count++; } 755 std::cout << "Anzahl A1: " << count << "\n"; 756 count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::start(); it; ++it) { count++; } 757 std::cout << "Anzahl A1B1: " << count << "\n"; 758 count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::start(); it; ++it) { count++; } 759 std::cout << "Anzahl A1B1C1: " << count << "\n"; 760 count = 0; for (Iterator<A2> it = ObjectList<A2>::start(); it; ++it) { count++; } 761 std::cout << "Anzahl A2: " << count << "\n"; 762 763 std::cout << "5\n"; 764 for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::start(); it; ++it) 765 std::cout << "Name: " << it->getName() << "\n"; 766 767 std::cout << "6\n"; 768 for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::end(); it; --it) 769 std::cout << "Name: " << it->getName() << "\n"; 770 771 std::cout << "7\n"; 772 delete test10_09; 773 774 count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::end(); it; --it) { count++; } 775 std::cout << "Anzahl BaseObjects: " << count << "\n"; 776 count = 0; for (Iterator<A1> it = ObjectList<A1>::end(); it; --it) { count++; } 777 std::cout << "Anzahl A1: " << count << "\n"; 778 count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::end(); it; --it) { count++; } 779 std::cout << "Anzahl A1B1: " << count << "\n"; 780 count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::end(); it; --it) { count++; } 781 std::cout << "Anzahl A1B1C1: " << count << "\n"; 782 count = 0; for (Iterator<A2> it = ObjectList<A2>::end(); it; --it) { count++; } 783 std::cout << "Anzahl A2: " << count << "\n"; 784 785 std::cout << "8\n"; 786 for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::start(); it; ++it) 787 std::cout << "Name: " << it->getName() << "\n"; 788 789 std::cout << "9\n"; 790 for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::end(); it; --it) 791 std::cout << "Name: " << it->getName() << "\n"; 792 793 std::cout << "10\n"; 794 delete test10_10; 795 796 count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::start(); it; ++it) { count++; } 797 std::cout << "Anzahl BaseObjects: " << count << "\n"; 798 count = 0; for (Iterator<A1> it = ObjectList<A1>::start(); it; ++it) { count++; } 799 std::cout << "Anzahl A1: " << count << "\n"; 800 count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::start(); it; ++it) { count++; } 801 std::cout << "Anzahl A1B1: " << count << "\n"; 802 count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::start(); it; ++it) { count++; } 803 std::cout << "Anzahl A1B1C1: " << count << "\n"; 804 count = 0; for (Iterator<A2> it = ObjectList<A2>::start(); it; ++it) { count++; } 805 std::cout << "Anzahl A2: " << count << "\n"; 806 807 std::cout << "11\n"; 808 for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::start(); it; ++it) 809 std::cout << "Name: " << it->getName() << "\n"; 810 811 std::cout << "12\n"; 812 for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::end(); it; --it) 813 std::cout << "Name: " << it->getName() << "\n"; 814 815 std::cout << "13\n"; 816 */ 817 /* 818 std::cout << "Test 11\n"; 819 std::cout << "1\n"; 820 int count2 = 0; for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) { count2++; } 821 std::cout << "AnzahlTickable: " << count2 << "\n"; 822 823 Test1* test11_1; 824 for (int i = 0; i < 3; i++) 825 test11_1 = new Test1; 826 827 count2 = 0; for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) { count2++; } 828 std::cout << "AnzahlTickable: " << count2 << "\n"; 829 830 for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) 831 it->tick(0); 832 833 std::cout << "2\n"; 834 Test2* test11_2 = new Test2; 835 836 837 std::cout << "3\n"; 838 Test3* test11_3 = new Test3; 839 test11_3->configOutput(); 840 841 std::cout << "4\n"; 842 */ 843 /* 844 std::cout << "Test 12\n"; 845 std::cout << "1\n"; 846 847 WorldEntity* test12_1 = new WorldEntity; 848 849 std::cout << sizeof(WorldEntity) << std::endl; 850 851 std::cout << "2\n"; 852 */ 853 /* 854 std::cout << "Test 13\n"; 855 856 #define BoolToYesNo(bool) \ 857 if (bool) \ 858 std::cout << "yes "; \ 859 else \ 860 std::cout << "no " 861 862 #define TestClassTreeMask(mask) \ 863 std::cout << "========== ClassTreeMask-Test ===========" << std::endl; \ 864 std::cout << mask << std::endl << std::endl; \ 865 std::cout << " "; \ 866 BoolToYesNo(mask.isIncluded(Class(BaseObject))); \ 867 std::cout << std::endl; \ 868 \ 869 std::cout << " "; \ 870 BoolToYesNo(mask.isIncluded(Class(A1))); \ 871 std::cout << " "; \ 872 BoolToYesNo(mask.isIncluded(Class(A2))); \ 873 std::cout << " "; \ 874 BoolToYesNo(mask.isIncluded(Class(A3))); \ 875 std::cout << std::endl; \ 876 \ 877 std::cout << " "; \ 878 BoolToYesNo(mask.isIncluded(Class(A1B1))); \ 879 std::cout << " "; \ 880 BoolToYesNo(mask.isIncluded(Class(A1B2))); \ 881 std::cout << " "; \ 882 BoolToYesNo(mask.isIncluded(Class(A2B1))); \ 883 std::cout << " "; \ 884 BoolToYesNo(mask.isIncluded(Class(A2B2))); \ 885 std::cout << " "; \ 886 BoolToYesNo(mask.isIncluded(Class(A3B1))); \ 887 std::cout << " "; \ 888 BoolToYesNo(mask.isIncluded(Class(A3B2))); \ 889 std::cout << std::endl; \ 890 \ 891 BoolToYesNo(mask.isIncluded(Class(A1B1C1))); \ 892 BoolToYesNo(mask.isIncluded(Class(A1B1C2))); \ 893 BoolToYesNo(mask.isIncluded(Class(A1B2C1))); \ 894 std::cout << " "; \ 895 BoolToYesNo(mask.isIncluded(Class(A2B1C1))); \ 896 std::cout << " "; \ 897 BoolToYesNo(mask.isIncluded(Class(A2B2C1))); \ 898 std::cout << " "; \ 899 BoolToYesNo(mask.isIncluded(Class(A3B1C1))); \ 900 BoolToYesNo(mask.isIncluded(Class(A3B1C2))); \ 901 BoolToYesNo(mask.isIncluded(Class(A3B2C1))); \ 902 BoolToYesNo(mask.isIncluded(Class(A3B2C2))); \ 903 std::cout << std::endl; \ 904 std::cout << "=========================================" << std::endl 905 906 std::cout << "1\n"; 907 908 ClassTreeMask test13_1; 909 test13_1.exclude(Class(A1B1)); 910 test13_1.exclude(Class(A2)); 911 test13_1.include(Class(A2B2)); 912 test13_1.exclude(Class(A2B2C1)); 913 test13_1.exclude(Class(A3B1)); 914 test13_1.include(Class(A3B1C2)); 915 test13_1.exclude(Class(A3B2C1)); 916 test13_1.exclude(Class(A3B2C2)); 917 std::cout << "Mask 1:\n"; 918 TestClassTreeMask(test13_1); 919 920 ClassTreeMask test13_2; 921 test13_2.exclude(Class(BaseObject)); 922 test13_2.include(Class(A1)); 923 test13_2.exclude(Class(A1B2)); 924 test13_2.exclude(Class(A1B1C2)); 925 test13_2.include(Class(A2)); 926 test13_2.exclude(Class(A2B2)); 927 test13_2.include(Class(A3B1)); 928 test13_2.include(Class(A3B2)); 929 test13_2.exclude(Class(A3B2C2)); 930 std::cout << std::endl; 931 std::cout << "Mask 2:\n"; 932 TestClassTreeMask(test13_2); 933 934 std::cout << "2\n"; 935 936 ClassTreeMask test13_3; 937 test13_3.include(Class(A1), true, false); 938 test13_3.exclude(Class(A1B2), true, false); 939 test13_3.exclude(Class(A1B1C2), true, false); 940 test13_3.include(Class(A2), true, false); 941 test13_3.exclude(Class(A2B2), true, false); 942 test13_3.include(Class(A3B1), true, false); 943 test13_3.include(Class(A3B2), true, false); 944 test13_3.exclude(Class(A3B2C2), true, false); 945 std::cout << std::endl; 946 std::cout << "Mask 2 without excluded BaseObject:\n"; 947 TestClassTreeMask(test13_3); 948 test13_3.exclude(Class(BaseObject), false, false); 949 std::cout << std::endl; 950 std::cout << "Mask 2 with BaseObject excluded afterwards without overwrite:\n"; 951 TestClassTreeMask(test13_3); 952 test13_3.exclude(Class(BaseObject), true); 953 std::cout << std::endl; 954 std::cout << "Mask 2 with BaseObject excluded afterwards with overwrite:\n"; 955 TestClassTreeMask(test13_3); 956 957 ClassTreeMask test13_4; 958 test13_4.include(Class(A3B2)); 959 test13_4.exclude(Class(A1B1C2)); 960 test13_4.include(Class(A3B1)); 961 test13_4.exclude(Class(A3B2C2)); 962 test13_4.exclude(Class(BaseObject)); 963 test13_4.include(Class(A2)); 964 test13_4.exclude(Class(A1B2)); 965 test13_4.exclude(Class(A2B2)); 966 test13_4.include(Class(A1)); 967 std::cout << std::endl; 968 std::cout << "Mask 2 created in random order with overwrite and clean:\n"; 969 TestClassTreeMask(test13_4); 970 971 ClassTreeMask test13_4_2; 972 test13_4_2.include(Class(A3B2), false, false); 973 test13_4_2.exclude(Class(A1B1C2), false, false); 974 test13_4_2.include(Class(A3B1), false, false); 975 test13_4_2.exclude(Class(A3B2C2), false, false); 976 test13_4_2.exclude(Class(BaseObject), false, false); 977 test13_4_2.include(Class(A2), false, false); 978 test13_4_2.exclude(Class(A1B2), false, false); 979 test13_4_2.exclude(Class(A2B2), false, false); 980 test13_4_2.include(Class(A1), false, false); 981 std::cout << std::endl; 982 std::cout << "Mask 2 created in random order without overwrite and without clean:\n"; 983 TestClassTreeMask(test13_4_2); 984 985 std::cout << "3\n"; 986 987 ClassTreeMask test13_6 = !test13_1; 988 std::cout << std::endl; 989 std::cout << "Mask 1 inverted:\n"; 990 TestClassTreeMask(test13_6); 991 992 std::cout << "4\n"; 993 994 ClassTreeMask test13_7 = test13_1 + test13_2; 995 std::cout << std::endl; 996 std::cout << "Mask 1 + Mask 2:\n"; 997 TestClassTreeMask(test13_7); 998 999 std::cout << "5\n"; 1000 1001 ClassTreeMask test13_8 = test13_1 * test13_2; 1002 std::cout << std::endl; 1003 std::cout << "Mask 1 * Mask 2:\n"; 1004 TestClassTreeMask(test13_8); 1005 1006 std::cout << "6\n"; 1007 1008 ClassTreeMask test13_9 = test13_1 - test13_2; 1009 std::cout << std::endl; 1010 std::cout << "Mask 1 - Mask 2:\n"; 1011 TestClassTreeMask(test13_9); 1012 1013 std::cout << "7\n"; 1014 1015 ClassTreeMask test13_10 = test13_1 ^ test13_2; 1016 std::cout << std::endl; 1017 std::cout << "Mask 1 ^ Mask 2:\n"; 1018 TestClassTreeMask(test13_10); 1019 1020 std::cout << "8\n"; 1021 1022 ClassTreeMask test13_12(!test13_1); 1023 std::cout << std::endl; 1024 std::cout << "Mask 1 inverted assigned with copyconstructor + the original from before:\n"; 1025 TestClassTreeMask(test13_12); 1026 TestClassTreeMask(test13_1); 1027 1028 1029 ClassTreeMask test13_13 = test13_1 + test13_2; 1030 std::cout << std::endl; 1031 std::cout << "Mask 1 + Mask 2 assigned with copyconstructor + originals from before:\n"; 1032 TestClassTreeMask(test13_13); 1033 TestClassTreeMask(test13_1); 1034 TestClassTreeMask(test13_2); 1035 1036 ClassTreeMask test13_14 = test13_1; 1037 test13_14 += test13_2; 1038 std::cout << std::endl; 1039 std::cout << "Mask 1 + Mask 2 with += operator + original of mask 2 from before:\n"; 1040 TestClassTreeMask(test13_14); 1041 TestClassTreeMask(test13_2); 1042 1043 test13_1 = test13_1; 1044 std::cout << std::endl; 1045 std::cout << "Mask 1 assigned with = operator to itself:\n"; 1046 TestClassTreeMask(test13_1); 1047 1048 std::cout << "9\n"; 1049 1050 ClassTreeMask test13_15; 1051 test13_15.exclude(Class(Interface1)); 1052 std::cout << std::endl; 1053 std::cout << "Mask with excluded Interface 1:\n"; 1054 TestClassTreeMask(test13_15); 1055 1056 ClassTreeMask test13_16 = test13_1; 1057 test13_16.exclude(Class(Interface1)); 1058 std::cout << std::endl; 1059 std::cout << "Mask 1 with excluded Interface 1 (overwrite):\n"; 1060 TestClassTreeMask(test13_16); 1061 1062 ClassTreeMask test13_17 = test13_1; 1063 test13_17.exclude(Class(Interface1), false); 1064 std::cout << std::endl; 1065 std::cout << "Mask 1 with excluded Interface 1 (without overwrite):\n"; 1066 TestClassTreeMask(test13_17); 1067 1068 ClassTreeMask test13_18 = test13_2; 1069 test13_18.exclude(Class(Interface1), false); 1070 std::cout << std::endl; 1071 std::cout << "Mask 2 with excluded Interface 1 (without overwrite):\n"; 1072 TestClassTreeMask(test13_18); 1073 1074 std::cout << "10\n"; 1075 1076 ClassTreeMask test13_19; 1077 test13_19.exclude(Class(Test1)); 1078 std::cout << std::endl; 1079 std::cout << "Mask with excluded Test1:\n"; 1080 TestClassTreeMask(test13_19); 1081 1082 std::cout << "11\n"; 1083 1084 ClassTreeMask test13_20; 1085 test13_20.exclude(Class(DebugLevel)); 1086 std::cout << std::endl; 1087 std::cout << "Mask with excluded DebugLevel:\n"; 1088 TestClassTreeMask(test13_20); 1089 1090 std::cout << "12\n"; 1091 1092 ClassTreeMask test13_21; 1093 test13_21.excludeSingle(Class(A2)); 1094 std::cout << std::endl; 1095 std::cout << "Mask with single-excluded A2:\n"; 1096 TestClassTreeMask(test13_21); 1097 1098 test13_21.exclude(Class(A2)); 1099 std::cout << std::endl; 1100 std::cout << "Mask with excluded A2:\n"; 1101 TestClassTreeMask(test13_21); 1102 1103 test13_21.includeSingle(Class(A2)); 1104 std::cout << std::endl; 1105 std::cout << "Previous mask with single-included A2:\n"; 1106 TestClassTreeMask(test13_21); 1107 1108 test13_21.includeSingle(Class(A2), false); 1109 std::cout << std::endl; 1110 std::cout << "Previous mask with single-included A2 without clean:\n"; 1111 TestClassTreeMask(test13_21); 1112 1113 std::cout << "13\n"; 1114 */ 1115 /* 1116 std::cout << "Test 14\n"; 1117 std::cout << "1\n"; 1118 1119 SubclassIdentifier<A1> test14_1; 1120 test14_1 = Class(A1B1C1); 1121 std::cout << test14_1.getIdentifier()->getName() << std::endl; 1122 1123 SubclassIdentifier<A1> test14_2 = Class(A1B1C2); 1124 std::cout << test14_2.getIdentifier()->getName() << std::endl; 1125 1126 SubclassIdentifier<Interface1> test14_3; 1127 test14_3 = Class(A2B2C1); 1128 std::cout << test14_3.getIdentifier()->getName() << std::endl; 1129 1130 SubclassIdentifier<A1B2> test14_4; 1131 test14_4 = Class(A1B2C1); 1132 std::cout << test14_4.getIdentifier()->getName() << std::endl; 1133 1134 SubclassIdentifier<BaseObject> test14_5 = Class(Test1); 1135 std::cout << test14_5.getIdentifier()->getName() << std::endl; 1136 1137 std::cout << "2\n"; 1138 */ 1139 /* 1140 std::cout << "Test 15\n"; 1141 std::cout << "1\n"; 1142 1143 Level* test15_1 = new Level("levels/sample.oxw"); 1144 Loader::open(test15_1); 1145 1146 std::cout << "2\n"; 1147 */ 226 1148 startRenderLoop(); 227 1149 } -
code/branches/core2/src/orxonox/objects/Test.h
r871 r874 30 30 31 31 #include "core/BaseObject.h" 32 #include "core/CoreIncludes.h" 32 33 33 34 namespace orxonox
Note: See TracChangeset
for help on using the changeset viewer.